Class BaseServerResponseException

    • Constructor Detail

      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           String theMessage)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theMessage - The message
      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           String... theMessages)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theMessages - The messages
      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           String theMessage,
                                           IBaseOperationOutcome theBaseOperationOutcome)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theMessage - The message
        theBaseOperationOutcome - An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome that was returned from the server (in a client)
      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           String theMessage,
                                           Throwable theCause)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theMessage - The message
        theCause - The cause
      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           String theMessage,
                                           Throwable theCause,
                                           IBaseOperationOutcome theBaseOperationOutcome)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theMessage - The message
        theCause - The underlying cause exception
        theBaseOperationOutcome - An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome that was returned from the server (in a client)
      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           Throwable theCause)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theCause - The underlying cause exception
      • BaseServerResponseException

        public BaseServerResponseException​(int theStatusCode,
                                           Throwable theCause,
                                           IBaseOperationOutcome theBaseOperationOutcome)
        Constructor
        Parameters:
        theStatusCode - The HTTP status code corresponding to this problem
        theCause - The underlying cause exception
        theBaseOperationOutcome - An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome that was returned from the server (in a client)
    • Method Detail

      • isErrorMessageTrusted

        public boolean isErrorMessageTrusted()
        This flag can be used to signal to server infrastructure that the message supplied to this exception (ie to the constructor) is considered trusted and is safe to return to the calling client.
      • setErrorMessageTrusted

        public BaseServerResponseException setErrorMessageTrusted​(boolean theErrorMessageTrusted)
        This flag can be used to signal to server infrastructure that the message supplied to this exception (ie to the constructor) is considered trusted and is safe to return to the calling client.
      • addResponseHeader

        public BaseServerResponseException addResponseHeader​(String theName,
                                                             String theValue)
        Add a header which will be added to any responses
        Parameters:
        theName - The header name
        theValue - The header value
        Returns:
        Returns a reference to this for easy method chaining
        Since:
        2.0
      • setOperationOutcome

        public void setOperationOutcome​(IBaseOperationOutcome theBaseOperationOutcome)
        Sets the BaseOperationOutcome resource associated with this exception. In server implementations, this is the OperartionOutcome resource to include with the HTTP response. In client implementations you should not call this method.
        Parameters:
        theBaseOperationOutcome - The BaseOperationOutcome resource Sets the BaseOperationOutcome resource associated with this exception. In server implementations, this is the OperartionOutcome resource to include with the HTTP response. In client implementations you should not call this method.
      • getResponseBody

        public String getResponseBody()
        In a RESTful client, this method will be populated with the body of the HTTP respone if one was provided by the server, or null otherwise.

        In a restful server, this method is currently ignored.

      • setResponseBody

        public void setResponseBody​(String theResponseBody)
        This method is currently only called internally by HAPI, it should not be called by user code.
      • getResponseHeaders

        public Map<String,​List<String>> getResponseHeaders()
        Returns a map containing any headers which should be added to the outgoing response. This methos creates the map if none exists, so it will never return null
        Since:
        2.0 (note that this method existed in previous versions of HAPI but the method signature has been changed from Map<String, String[]> to Map<String, List<String>>
      • getResponseMimeType

        public String getResponseMimeType()
        In a RESTful client, this method will be populated with the HTTP status code that was returned with the HTTP response.

        In a restful server, this method is currently ignored.

      • setResponseMimeType

        public void setResponseMimeType​(String theResponseMimeType)
        This method is currently only called internally by HAPI, it should not be called by user code.
      • getStatusCode

        public int getStatusCode()
        Returns the HTTP status code corresponding to this problem