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 Summary
ConstructorsConstructorDescriptionServerServicesInterceptorResponseWrapper(IInterceptorResponse interceptorResponse) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a response header with the given name and value.voidForces any content in the buffer to be written to the client.intReturns the actual buffer size used for the responseReturns the name of the character encodingReturns a String that indicates the content-type of the responseReturns the value of the specified request header as a StringGets the names of the headers of this response.getHeaders(String name) Gets the values of the response header with the given name.jakarta.servlet.ServletOutputStreamReturns a ServletOutputStream suitable for writing binary data in the response.intReturns the current status code of this response.Returns a PrintWriter object that can send character text to the client.booleanReturns a boolean indicating if the response has been committed.voidClears the content of the underlying buffer in the response without clearing headers or status code.voidsendError(int sc) Sends an error response to the client using the specified status code and clears the buffer.voidSends an error response to the client using the specified status code and clears the buffer.voidsetContentLength(int len) Sets the length of the content body in the responsevoidsetContentLengthLong(long len) Sets the length of the content body in the responsevoidSets a response header with the given name and value.voidsetStatus(int sc) Sets the status code for this response.
-
Constructor Details
-
ServerServicesInterceptorResponseWrapper
-
-
Method Details
-
sendError
Description copied from interface:IInterceptorResponseSends an error response to the client using the specified status code and clears the buffer.- Specified by:
sendErrorin interfaceIInterceptorResponse- Parameters:
sc- - the error status codemsg- - the descriptive message- Throws:
IOException- If an input or output exception occurs
-
sendError
Description copied from interface:IInterceptorResponseSends an error response to the client using the specified status code and clears the buffer.- Specified by:
sendErrorin interfaceIInterceptorResponse- 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:IInterceptorResponseSets the status code for this response.- Specified by:
setStatusin interfaceIInterceptorResponse- Parameters:
sc- - the status code
-
getStatus
public int getStatus()Description copied from interface:IInterceptorResponseReturns the current status code of this response.- Specified by:
getStatusin interfaceIInterceptorResponse- Returns:
- the current status code of this response
-
getHeader
Description copied from interface:IInterceptorResponseReturns the value of the specified request header as a String- Specified by:
getHeaderin interfaceIInterceptorResponse- 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
Description copied from interface:IInterceptorResponseGets the values of the response header with the given name.- Specified by:
getHeadersin interfaceIInterceptorResponse- 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
Description copied from interface:IInterceptorResponseGets the names of the headers of this response.- Specified by:
getHeaderNamesin interfaceIInterceptorResponse- Returns:
- a Collection of the names of the headers of this response
-
setHeader
Description copied from interface:IInterceptorResponseSets 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:
setHeaderin interfaceIInterceptorResponse- Parameters:
name- - the name of the headervalue- - the header value
-
addHeader
Description copied from interface:IInterceptorResponseAdds a response header with the given name and value.- Specified by:
addHeaderin interfaceIInterceptorResponse- Parameters:
name- - the name of the headervalue- - the additional header value
-
getOutputStream
Description copied from interface:IInterceptorResponseReturns a ServletOutputStream suitable for writing binary data in the response.- Specified by:
getOutputStreamin interfaceIInterceptorResponse- Returns:
- a ServletOutputStream for writing binary data
- Throws:
IOException- if the getWriter method has been called on this response
-
getWriter
Description copied from interface:IInterceptorResponseReturns a PrintWriter object that can send character text to the client.- Specified by:
getWriterin interfaceIInterceptorResponse- Returns:
- a PrintWriter object that can return character data to the client
- Throws:
IOException- if an input or output exception occurred
-
flushBuffer
Description copied from interface:IInterceptorResponseForces 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:
flushBufferin interfaceIInterceptorResponse- Throws:
IOException
-
resetBuffer
public void resetBuffer()Description copied from interface:IInterceptorResponseClears the content of the underlying buffer in the response without clearing headers or status code.- Specified by:
resetBufferin interfaceIInterceptorResponse
-
getCharacterEncoding
Description copied from interface:IInterceptorResponseReturns the name of the character encoding- Specified by:
getCharacterEncodingin interfaceIInterceptorResponse
-
isCommitted
public boolean isCommitted()Description copied from interface:IInterceptorResponseReturns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.- Specified by:
isCommittedin interfaceIInterceptorResponse- Returns:
- a boolean indicating if the response has been committed
-
getContentType
Description copied from interface:IInterceptorResponseReturns a String that indicates the content-type of the response- Specified by:
getContentTypein interfaceIInterceptorResponse- Returns:
- String that indicates the content-type of the response
-
setContentLength
public void setContentLength(int len) Description copied from interface:IInterceptorResponseSets the length of the content body in the response- Specified by:
setContentLengthin interfaceIInterceptorResponse- 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:IInterceptorResponseSets the length of the content body in the response- Specified by:
setContentLengthLongin interfaceIInterceptorResponse- 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:IInterceptorResponseReturns the actual buffer size used for the response- Specified by:
getBufferSizein interfaceIInterceptorResponse- Returns:
- an int specifying the actual buffer size used for the response
-
getAppInterceptorResponse
-