Class ServerServicesInterceptorResponseWrapper

java.lang.Object
com.esri.arcgis.enterprise.interceptor.server.ServerServicesInterceptorResponseWrapper
All Implemented Interfaces:
IInterceptorResponse

public class ServerServicesInterceptorResponseWrapper extends Object implements IInterceptorResponse
The ServerServicesInterceptorResponseWrapper class is an implementation of the IInterceptorResponse interface that wraps an underlying HttpServletResponse.

This wrapper delegates all response-related operations to the underlying HttpServletResponse, enabling interceptors to interact with HTTP response data in a consistent and framework-agnostic manner. It also provides access to the original IInterceptorResponse and uses reflection to extract the underlying servlet response when necessary.

Typical usage includes:

  • Setting and retrieving HTTP headers and status codes
  • Accessing output streams and writers for response data
  • Flushing and resetting the response buffer
  • Chaining and unwrapping nested interceptor responses
  • Constructor Details

    • ServerServicesInterceptorResponseWrapper

      public ServerServicesInterceptorResponseWrapper(IInterceptorResponse interceptorResponse)
  • Method Details

    • sendError

      public void sendError(int sc, String msg) throws IOException
      Description copied from interface: IInterceptorResponse
      Sends an error response to the client using the specified status code and clears the buffer.
      Specified by:
      sendError in interface IInterceptorResponse
      Parameters:
      sc - - the error status code
      msg - - the descriptive message
      Throws:
      IOException - If an input or output exception occurs
    • sendError

      public void sendError(int sc) throws IOException
      Description copied from interface: IInterceptorResponse
      Sends an error response to the client using the specified status code and clears the buffer.
      Specified by:
      sendError in interface IInterceptorResponse
      Parameters:
      sc - - the error status code
      Throws:
      IOException - If an input or output exception occurs
    • setStatus

      public void setStatus(int sc)
      Description copied from interface: IInterceptorResponse
      Sets the status code for this response.
      Specified by:
      setStatus in interface IInterceptorResponse
      Parameters:
      sc - - the status code
    • getStatus

      public int getStatus()
      Description copied from interface: IInterceptorResponse
      Returns the current status code of this response.
      Specified by:
      getStatus in interface IInterceptorResponse
      Returns:
      the current status code of this response
    • getHeader

      public String getHeader(String name)
      Description copied from interface: IInterceptorResponse
      Returns the value of the specified request header as a String
      Specified by:
      getHeader in interface IInterceptorResponse
      Parameters:
      name - - the name of the response header whose value to return
      Returns:
      the value of the response header with the given name, or null if no header with the given name has been set on this response
    • getHeaders

      public Collection<String> getHeaders(String name)
      Description copied from interface: IInterceptorResponse
      Gets the values of the response header with the given name.
      Specified by:
      getHeaders in interface IInterceptorResponse
      Parameters:
      name - - the name of the response header whose values to return
      Returns:
      a Collection of the values of the response header with the given name
    • getHeaderNames

      public Collection<String> getHeaderNames()
      Description copied from interface: IInterceptorResponse
      Gets the names of the headers of this response.
      Specified by:
      getHeaderNames in interface IInterceptorResponse
      Returns:
      a Collection of the names of the headers of this response
    • setHeader

      public void setHeader(String name, String value)
      Description copied from interface: IInterceptorResponse
      Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one.
      Specified by:
      setHeader in interface IInterceptorResponse
      Parameters:
      name - - the name of the header
      value - - the header value
    • addHeader

      public void addHeader(String name, String value)
      Description copied from interface: IInterceptorResponse
      Adds a response header with the given name and value.
      Specified by:
      addHeader in interface IInterceptorResponse
      Parameters:
      name - - the name of the header
      value - - the additional header value
    • getOutputStream

      public jakarta.servlet.ServletOutputStream getOutputStream() throws IOException
      Description copied from interface: IInterceptorResponse
      Returns a ServletOutputStream suitable for writing binary data in the response.
      Specified by:
      getOutputStream in interface IInterceptorResponse
      Returns:
      a ServletOutputStream for writing binary data
      Throws:
      IOException - if the getWriter method has been called on this response
    • getWriter

      public PrintWriter getWriter() throws IOException
      Description copied from interface: IInterceptorResponse
      Returns a PrintWriter object that can send character text to the client.
      Specified by:
      getWriter in interface IInterceptorResponse
      Returns:
      a PrintWriter object that can return character data to the client
      Throws:
      IOException - if an input or output exception occurred
    • flushBuffer

      public void flushBuffer() throws IOException
      Description copied from interface: IInterceptorResponse
      Forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written.
      Specified by:
      flushBuffer in interface IInterceptorResponse
      Throws:
      IOException
    • resetBuffer

      public void resetBuffer()
      Description copied from interface: IInterceptorResponse
      Clears the content of the underlying buffer in the response without clearing headers or status code.
      Specified by:
      resetBuffer in interface IInterceptorResponse
    • getCharacterEncoding

      public String getCharacterEncoding()
      Description copied from interface: IInterceptorResponse
      Returns the name of the character encoding
      Specified by:
      getCharacterEncoding in interface IInterceptorResponse
    • isCommitted

      public boolean isCommitted()
      Description copied from interface: IInterceptorResponse
      Returns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.
      Specified by:
      isCommitted in interface IInterceptorResponse
      Returns:
      a boolean indicating if the response has been committed
    • getContentType

      public String getContentType()
      Description copied from interface: IInterceptorResponse
      Returns a String that indicates the content-type of the response
      Specified by:
      getContentType in interface IInterceptorResponse
      Returns:
      String that indicates the content-type of the response
    • setContentLength

      public void setContentLength(int len)
      Description copied from interface: IInterceptorResponse
      Sets the length of the content body in the response
      Specified by:
      setContentLength in interface IInterceptorResponse
      Parameters:
      len - - an int specifying the length of the content being returned to the client; sets the Content-Length header
    • setContentLengthLong

      public void setContentLengthLong(long len)
      Description copied from interface: IInterceptorResponse
      Sets the length of the content body in the response
      Specified by:
      setContentLengthLong in interface IInterceptorResponse
      Parameters:
      len - - a long specifying the length of the content being returned to the client; sets the Content-Length header
    • getBufferSize

      public int getBufferSize()
      Description copied from interface: IInterceptorResponse
      Returns the actual buffer size used for the response
      Specified by:
      getBufferSize in interface IInterceptorResponse
      Returns:
      an int specifying the actual buffer size used for the response
    • getAppInterceptorResponse

      public IInterceptorResponse getAppInterceptorResponse()