public class ResponseWriter extends Object implements ContainerResponseWriter
ContainerResponseWriter for Servlet containers.
The writer depends on provided AsyncContextDelegate to support async functionality.ContainerResponseWriter.TimeoutHandler| Constructor and Description |
|---|
ResponseWriter(boolean useSetStatusOn404,
boolean configSetStatusOverSendError,
javax.servlet.http.HttpServletResponse response,
AsyncContextDelegate asyncExt,
ScheduledExecutorService timeoutTaskExecutor)
Creates a new instance to write a single Jersey response.
|
| Modifier and Type | Method and Description |
|---|---|
void |
commit() |
boolean |
enableResponseBuffering() |
void |
failure(Throwable error) |
int |
getResponseStatus()
Provides response status captured when
writeResponseStatusAndHeaders(long, org.glassfish.jersey.server.ContainerResponse)
has been invoked. |
void |
setSuspendTimeout(long timeOut,
TimeUnit timeUnit) |
boolean |
suspend(long timeOut,
TimeUnit timeUnit,
ContainerResponseWriter.TimeoutHandler timeoutHandler) |
OutputStream |
writeResponseStatusAndHeaders(long contentLength,
ContainerResponse responseContext) |
public ResponseWriter(boolean useSetStatusOn404,
boolean configSetStatusOverSendError,
javax.servlet.http.HttpServletResponse response,
AsyncContextDelegate asyncExt,
ScheduledExecutorService timeoutTaskExecutor)
useSetStatusOn404 - true if status should be written explicitly when 404 is returnedconfigSetStatusOverSendError - if true method HttpServletResponse.setStatus(int) is used over
HttpServletResponse.sendError(int, java.lang.String)response - original HttpResponseRequestasyncExt - delegate to use for async features implementationtimeoutTaskExecutor - Jersey runtime executor used for background execution of timeout
handling tasks.public boolean suspend(long timeOut,
TimeUnit timeUnit,
ContainerResponseWriter.TimeoutHandler timeoutHandler)
suspend in interface ContainerResponseWriterpublic void setSuspendTimeout(long timeOut,
TimeUnit timeUnit)
throws IllegalStateException
setSuspendTimeout in interface ContainerResponseWriterIllegalStateExceptionpublic OutputStream writeResponseStatusAndHeaders(long contentLength, ContainerResponse responseContext) throws ContainerException
writeResponseStatusAndHeaders in interface ContainerResponseWriterContainerExceptionpublic void commit()
commit in interface ContainerResponseWriterpublic void failure(Throwable error)
failure in interface ContainerResponseWriterpublic boolean enableResponseBuffering()
enableResponseBuffering in interface ContainerResponseWriterpublic int getResponseStatus()
writeResponseStatusAndHeaders(long, org.glassfish.jersey.server.ContainerResponse)
has been invoked.
The method will block if the write method has not been called yet.Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.