Class HttpResponse

  • All Implemented Interfaces:
    com.yahoo.jdisc.http.servlet.ServletOrJdiscHttpResponse

    public class HttpResponse
    extends com.yahoo.jdisc.Response
    implements com.yahoo.jdisc.http.servlet.ServletOrJdiscHttpResponse
    A HTTP response.
    Author:
    Einar M R Rosenvinge
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  HttpResponse.Status  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected HttpResponse​(com.yahoo.jdisc.Request request, int status, java.lang.String message, java.lang.Throwable error)  
    • Constructor Detail

      • HttpResponse

        protected HttpResponse​(com.yahoo.jdisc.Request request,
                               int status,
                               java.lang.String message,
                               java.lang.Throwable error)
    • Method Detail

      • isChunkedEncodingEnabled

        public boolean isChunkedEncodingEnabled()
      • setChunkedEncodingEnabled

        public void setChunkedEncodingEnabled​(boolean chunkedEncodingEnabled)
      • setMessage

        public void setMessage​(java.lang.String message)
      • getMessage

        public java.lang.String getMessage()
      • copyHeaders

        public void copyHeaders​(com.yahoo.jdisc.HeaderFields target)
        Specified by:
        copyHeaders in interface com.yahoo.jdisc.http.servlet.ServletOrJdiscHttpResponse
      • decodeSetCookieHeader

        public java.util.List<Cookie> decodeSetCookieHeader()
        Specified by:
        decodeSetCookieHeader in interface com.yahoo.jdisc.http.servlet.ServletOrJdiscHttpResponse
      • encodeSetCookieHeader

        public void encodeSetCookieHeader​(java.util.List<Cookie> cookies)
      • trailers

        public com.yahoo.jdisc.HeaderFields trailers()

        Returns the set of trailer header fields of this HttpResponse. These are typically meta-data that should have been part of Response.headers(), but were not available prior to calling ResponseHandler.handleResponse(Response). You must NOT WRITE to these headers AFTER calling ContentChannel.close(CompletionHandler), and you must NOT READ from these headers BEFORE ContentChannel.close(CompletionHandler) has been called.

        NOTE: These headers are NOT thread-safe. You need to explicitly synchronized on the returned object to prevent concurrency issues such as ConcurrentModificationExceptions.

        Returns:
        The trailer headers of this HttpRequest.
      • isServerError

        public static boolean isServerError​(com.yahoo.jdisc.Response response)
      • newInstance

        public static HttpResponse newInstance​(int status)
      • newInstance

        public static HttpResponse newInstance​(int status,
                                               java.lang.String message)
      • newError

        public static HttpResponse newError​(com.yahoo.jdisc.Request request,
                                            int status,
                                            java.lang.Throwable error)
      • newInternalServerError

        public static HttpResponse newInternalServerError​(com.yahoo.jdisc.Request request,
                                                          java.lang.Throwable error)