Class Response<T>

  • Type Parameters:
    T -
    Direct Known Subclasses:
    ProxyResponse, ServiceResponse

    public abstract class Response<T>
    extends Exchange<T>
    The root class for implementing a Response providing the implementation for common methods
    Author:
    Andrea Di Cesare <andrea@softinstigate.com>
    • Constructor Detail

      • Response

        protected Response​(io.undertow.server.HttpServerExchange exchange)
    • Method Detail

      • of

        public static Response of​(io.undertow.server.HttpServerExchange exchange)
      • type

        public static Type type()
      • getContentType

        public static String getContentType​(io.undertow.server.HttpServerExchange exchange)
      • setContentType

        public void setContentType​(String responseContentType)
        Parameters:
        responseContentType - the responseContentType to set
      • setContentTypeAsJson

        public void setContentTypeAsJson()
        sets Content-Type=application/json
      • getStatusCode

        public int getStatusCode()
        Returns:
        the responseStatusCode of -1 if not set
      • setStatusCode

        public void setStatusCode​(int responseStatusCode)
        Parameters:
        responseStatusCode - the responseStatusCode to set
      • getMDCContext

        public Map<String,​String> getMDCContext()
        Logging MDC Context is bind to the thread context. In case of a thread switch it must be restored from this exchange attachment using MDC.setContextMap()
        Returns:
        the MDC Context
      • setMDCContext

        public void setMDCContext​(Map<String,​String> mdcCtx)
      • setInError

        public abstract void setInError​(int code,
                                        String message,
                                        Throwable t)
        Parameters:
        code -
        message -
        t - can be null
      • setInError

        public void setInError​(int code,
                               String message)
        Parameters:
        code -
        message -