Class DefaultWebApplicationResponse

java.lang.Object
cloud.piranha.core.impl.DefaultWebApplicationResponse
All Implemented Interfaces:
WebApplicationResponse, jakarta.servlet.http.HttpServletResponse, jakarta.servlet.ServletResponse
Direct Known Subclasses:
EmbeddedResponse, HttpWebApplicationResponse

public class DefaultWebApplicationResponse extends Object implements WebApplicationResponse
The default WebApplicationResponse.
Author:
Manfred Riem ([email protected])
  • Field Details

    • bodyOnly

      protected boolean bodyOnly
      Stores the body only flag.
    • bufferResetting

      protected boolean bufferResetting
      Stores the buffer resetting flag.
    • characterEncoding

      protected String characterEncoding
      Stores the character encoding.
    • characterEncodingLocaleSet

      protected boolean characterEncodingLocaleSet
      Stores if the character encoding was set using setLocale.
    • characterEncodingSet

      protected boolean characterEncodingSet
      Stores if the character encoding has been set manually.
    • committed

      protected boolean committed
      Stores the committed flag.
    • contentLanguage

      protected String contentLanguage
      Stores the content language
    • contentLength

      protected long contentLength
      Stores the content length.
    • contentType

      protected String contentType
      Stores the content type.
    • contentTypeSet

      protected boolean contentTypeSet
      Stores if the content type has been set manually.
    • cookies

      protected List<jakarta.servlet.http.Cookie> cookies
      Stores the cookies.
    • gotOutput

      protected boolean gotOutput
      Stores if we acquired the output stream.
    • gotWriter

      protected boolean gotWriter
      Stores if we acquired the writer.
    • headerManager

      protected DefaultHttpHeaderManager headerManager
      Stores the header manager.
    • locale

      protected Locale locale
      Stores the locale.
    • responseCloser

      protected Runnable responseCloser
      Stores the response closer.
    • status

      protected int status
      Stores the status code.
    • statusMessage

      protected String statusMessage
      Stores the status message.
    • trailerFields

      protected Supplier<Map<String,String>> trailerFields
      Stores the trailer fields supplier.
    • webApplication

      protected WebApplication webApplication
      Stores the web application.
    • webApplicationOutputStream

      protected WebApplicationOutputStream webApplicationOutputStream
      Stores the web application output stream.
    • writer

      protected PrintWriter writer
      Stores the writer.
  • Constructor Details

    • DefaultWebApplicationResponse

      public DefaultWebApplicationResponse()
      Constructor.
  • Method Details

    • addCookie

      public void addCookie(jakarta.servlet.http.Cookie cookie)
      Specified by:
      addCookie in interface jakarta.servlet.http.HttpServletResponse
    • addDateHeader

      public void addDateHeader(String name, long date)
      Specified by:
      addDateHeader in interface jakarta.servlet.http.HttpServletResponse
    • addHeader

      public void addHeader(String name, String value)
      Specified by:
      addHeader in interface jakarta.servlet.http.HttpServletResponse
    • addIntHeader

      public void addIntHeader(String name, int value)
      Specified by:
      addIntHeader in interface jakarta.servlet.http.HttpServletResponse
    • closeAsyncResponse

      public void closeAsyncResponse()
      Description copied from interface: WebApplicationResponse
      Close the async response.
      Specified by:
      closeAsyncResponse in interface WebApplicationResponse
    • containsHeader

      public boolean containsHeader(String name)
      Specified by:
      containsHeader in interface jakarta.servlet.http.HttpServletResponse
    • encodeRedirectURL

      public String encodeRedirectURL(String url)
      Specified by:
      encodeRedirectURL in interface jakarta.servlet.http.HttpServletResponse
    • encodeURL

      public String encodeURL(String url)
      Specified by:
      encodeURL in interface jakarta.servlet.http.HttpServletResponse
    • flushBuffer

      public void flushBuffer() throws IOException
      Specified by:
      flushBuffer in interface jakarta.servlet.ServletResponse
      Throws:
      IOException
    • getBufferSize

      public int getBufferSize()
      Specified by:
      getBufferSize in interface jakarta.servlet.ServletResponse
    • getCharacterEncoding

      public String getCharacterEncoding()
      Specified by:
      getCharacterEncoding in interface jakarta.servlet.ServletResponse
    • getContentLanguage

      public String getContentLanguage()
      Description copied from interface: WebApplicationResponse
      Get the content language.
      Specified by:
      getContentLanguage in interface WebApplicationResponse
      Returns:
      the content language.
    • getContentType

      public String getContentType()
      Specified by:
      getContentType in interface jakarta.servlet.ServletResponse
    • getCookies

      public Collection<jakarta.servlet.http.Cookie> getCookies()
      Description copied from interface: WebApplicationResponse
      Returns the cookies.
      Specified by:
      getCookies in interface WebApplicationResponse
      Returns:
      the cookies
    • getHeader

      public String getHeader(String name)
      Specified by:
      getHeader in interface jakarta.servlet.http.HttpServletResponse
    • getHeaderNames

      public Collection<String> getHeaderNames()
      Specified by:
      getHeaderNames in interface jakarta.servlet.http.HttpServletResponse
    • getHeaders

      public Collection<String> getHeaders(String name)
      Specified by:
      getHeaders in interface jakarta.servlet.http.HttpServletResponse
    • getLocale

      public Locale getLocale()
      Specified by:
      getLocale in interface jakarta.servlet.ServletResponse
    • getOutputStream

      public jakarta.servlet.ServletOutputStream getOutputStream() throws IOException
      Specified by:
      getOutputStream in interface jakarta.servlet.ServletResponse
      Throws:
      IOException
    • getResponseCloser

      public Runnable getResponseCloser()
      Description copied from interface: WebApplicationResponse
      Returns the response closer.
      Specified by:
      getResponseCloser in interface WebApplicationResponse
      Returns:
      the response closer
    • getStatus

      public int getStatus()
      Specified by:
      getStatus in interface jakarta.servlet.http.HttpServletResponse
    • getStatusMessage

      public String getStatusMessage()
      Description copied from interface: WebApplicationResponse
      Get the status message.
      Specified by:
      getStatusMessage in interface WebApplicationResponse
      Returns:
      the status message.
    • getTrailerFields

      public Supplier<Map<String,String>> getTrailerFields()
      Specified by:
      getTrailerFields in interface jakarta.servlet.http.HttpServletResponse
    • getWebApplication

      public WebApplication getWebApplication()
      Description copied from interface: WebApplicationResponse
      Get the web application.
      Specified by:
      getWebApplication in interface WebApplicationResponse
      Returns:
      the web application.
    • getWebApplicationOutputStream

      public WebApplicationOutputStream getWebApplicationOutputStream()
      Description copied from interface: WebApplicationResponse
      Returns the web application output stream.
      Specified by:
      getWebApplicationOutputStream in interface WebApplicationResponse
      Returns:
      the web application output stream
    • getWriter

      public PrintWriter getWriter() throws IOException
      Specified by:
      getWriter in interface jakarta.servlet.ServletResponse
      Throws:
      IOException
    • isBodyOnly

      public boolean isBodyOnly()
      Description copied from interface: WebApplicationResponse
      Are we in body only mode.
      Specified by:
      isBodyOnly in interface WebApplicationResponse
      Returns:
      true if we are only sending the body, false otherwise.
    • isBufferResetting

      public boolean isBufferResetting()
      Description copied from interface: WebApplicationResponse
      Is the buffer resetting.
      Specified by:
      isBufferResetting in interface WebApplicationResponse
      Returns:
      true if it is, false otherwise.
    • isCommitted

      public boolean isCommitted()
      Specified by:
      isCommitted in interface jakarta.servlet.ServletResponse
    • reset

      public void reset()
      Specified by:
      reset in interface jakarta.servlet.ServletResponse
    • resetBuffer

      public void resetBuffer()
      Specified by:
      resetBuffer in interface jakarta.servlet.ServletResponse
    • sendError

      public void sendError(int status) throws IOException
      Specified by:
      sendError in interface jakarta.servlet.http.HttpServletResponse
      Throws:
      IOException
    • sendError

      public void sendError(int status, String statusMessage) throws IOException
      Specified by:
      sendError in interface jakarta.servlet.http.HttpServletResponse
      Throws:
      IOException
    • sendRedirect

      public void sendRedirect(String location) throws IOException
      Specified by:
      sendRedirect in interface jakarta.servlet.http.HttpServletResponse
      Throws:
      IOException
    • setBodyOnly

      public void setBodyOnly(boolean bodyOnly)
      Description copied from interface: WebApplicationResponse
      Set the body only mode.
      Specified by:
      setBodyOnly in interface WebApplicationResponse
      Parameters:
      bodyOnly - the body only mode.
    • setBufferSize

      public void setBufferSize(int bufferSize)
      Specified by:
      setBufferSize in interface jakarta.servlet.ServletResponse
    • setCharacterEncoding

      public void setCharacterEncoding(String characterEncoding)
      Specified by:
      setCharacterEncoding in interface jakarta.servlet.ServletResponse
    • setCommitted

      public void setCommitted(boolean committed)
      Set the committed.
      Specified by:
      setCommitted in interface WebApplicationResponse
      Parameters:
      committed - the committed flag.
    • setContentLength

      public void setContentLength(int contentLength)
      Specified by:
      setContentLength in interface jakarta.servlet.ServletResponse
    • setContentLengthLong

      public void setContentLengthLong(long contentLength)
      Specified by:
      setContentLengthLong in interface jakarta.servlet.ServletResponse
    • setContentType

      public void setContentType(String type)
      Specified by:
      setContentType in interface jakarta.servlet.ServletResponse
    • setDateHeader

      public void setDateHeader(String name, long date)
      Specified by:
      setDateHeader in interface jakarta.servlet.http.HttpServletResponse
    • setHeader

      public void setHeader(String name, String value)
      Specified by:
      setHeader in interface jakarta.servlet.http.HttpServletResponse
    • setIntHeader

      public void setIntHeader(String name, int value)
      Specified by:
      setIntHeader in interface jakarta.servlet.http.HttpServletResponse
    • setLocale

      public void setLocale(Locale locale)
      Specified by:
      setLocale in interface jakarta.servlet.ServletResponse
    • setResponseCloser

      public void setResponseCloser(Runnable responseCloser)
      Description copied from interface: WebApplicationResponse
      Set the response closer.
      Specified by:
      setResponseCloser in interface WebApplicationResponse
      Parameters:
      responseCloser - the response closer.
    • setStatus

      public void setStatus(int status)
      Specified by:
      setStatus in interface jakarta.servlet.http.HttpServletResponse
    • setTrailerFields

      public void setTrailerFields(Supplier<Map<String,String>> trailerFields)
      Specified by:
      setTrailerFields in interface jakarta.servlet.http.HttpServletResponse
    • setWebApplication

      public void setWebApplication(WebApplication webApplication)
      Description copied from interface: WebApplicationResponse
      Set the web application.
      Specified by:
      setWebApplication in interface WebApplicationResponse
      Parameters:
      webApplication - the web application.
    • setWebApplicationOutputStream

      public void setWebApplicationOutputStream(WebApplicationOutputStream outputStream)
      Description copied from interface: WebApplicationResponse
      Set the web application output stream.
      Specified by:
      setWebApplicationOutputStream in interface WebApplicationResponse
      Parameters:
      outputStream - the web application output stream.
    • verifyNotCommitted

      protected void verifyNotCommitted(String methodName)
      Verify we are not committed.
      Parameters:
      methodName - the method we are checking for.