Class ServletContextResponse
java.lang.Object
org.eclipse.jetty.server.Response.Wrapper
org.eclipse.jetty.server.handler.ContextResponse
org.eclipse.jetty.ee10.servlet.ServletContextResponse
- All Implemented Interfaces:
ServletContextHandler.ServletResponseInfo, org.eclipse.jetty.io.Content.Sink, org.eclipse.jetty.server.Response
public class ServletContextResponse
extends org.eclipse.jetty.server.handler.ContextResponse
implements ServletContextHandler.ServletResponseInfo
A core response wrapper that carries the servlet related response state,
which may be used directly by the associated
ServletApiResponse.
Non servlet related state, is used indirectly via ServletChannel.getResponse()
which may be a wrapper of this response.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumprotected static enumNested classes/interfaces inherited from interface org.eclipse.jetty.server.Response
org.eclipse.jetty.server.Response.Wrapper -
Constructor Summary
ConstructorsConstructorDescriptionServletContextResponse(ServletChannel servletChannel, ServletContextRequest request, org.eclipse.jetty.server.Response response) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcompleteOutput(org.eclipse.jetty.util.Callback callback) getCharacterEncoding(boolean setContentType) longorg.eclipse.jetty.http.HttpFields.Mutableprotected org.eclipse.jetty.http.MimeTypes.TypeGet the raw value of the Character Encoding field.org.eclipse.jetty.server.Responseprotected ServletContextRequeststatic ServletContextResponsegetServletContextResponse(jakarta.servlet.ServletResponse response) voidincluded()booleanisAllContentWritten(long written) booleanisContentIncomplete(long written) booleanbooleanbooleanprotected ServletApiResponsevoidreset()voidvoidvoidsetCharacterEncoding(String encoding, ServletContextResponse.EncodingFrom from) Update the Content-Type, MimeType, and headers from the provided Character Encoding and EncodingFrom.voidsetContentLength(int len) voidsetContentLength(long len) voidvoidsetOutputType(ServletContextResponse.OutputType outputType) voidsetTrailers(Supplier<Map<String, String>> trailers) voidsetWriter(ResponseWriter writer) voidwrite(boolean last, ByteBuffer content, org.eclipse.jetty.util.Callback callback) Methods inherited from class org.eclipse.jetty.server.Response.Wrapper
getRequest, getStatus, getTrailersSupplier, getWrapped, hasLastWrite, isCommitted, isCompletedSuccessfully, setStatus, setTrailersSupplier, writeInterim
-
Constructor Details
-
ServletContextResponse
public ServletContextResponse(ServletChannel servletChannel, ServletContextRequest request, org.eclipse.jetty.server.Response response)
-
-
Method Details
-
getServletContextResponse
public static ServletContextResponse getServletContextResponse(jakarta.servlet.ServletResponse response) -
getResponse
public org.eclipse.jetty.server.Response getResponse()- Specified by:
getResponsein interfaceServletContextHandler.ServletResponseInfo
-
getWriter
- Specified by:
getWriterin interfaceServletContextHandler.ServletResponseInfo
-
setWriter
- Specified by:
setWriterin interfaceServletContextHandler.ServletResponseInfo
-
getLocale
- Specified by:
getLocalein interfaceServletContextHandler.ServletResponseInfo
-
setLocale
- Specified by:
setLocalein interfaceServletContextHandler.ServletResponseInfo
-
getEncodingFrom
- Specified by:
getEncodingFromin interfaceServletContextHandler.ServletResponseInfo
-
getMimeType
protected org.eclipse.jetty.http.MimeTypes.Type getMimeType() -
getTrailers
- Specified by:
getTrailersin interfaceServletContextHandler.ServletResponseInfo
-
setTrailers
- Specified by:
setTrailersin interfaceServletContextHandler.ServletResponseInfo
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfaceServletContextHandler.ServletResponseInfo
-
setOutputType
- Specified by:
setOutputTypein interfaceServletContextHandler.ServletResponseInfo
-
getContentType
- Specified by:
getContentTypein interfaceServletContextHandler.ServletResponseInfo
-
getOutputType
- Specified by:
getOutputTypein interfaceServletContextHandler.ServletResponseInfo
-
getServletContextRequest
-
newServletApiResponse
-
getHttpOutput
-
getServletRequestState
-
getServletApiResponse
-
resetForForward
public void resetForForward() -
included
public void included() -
completeOutput
public void completeOutput(org.eclipse.jetty.util.Callback callback) -
isAllContentWritten
public boolean isAllContentWritten(long written) -
isContentIncomplete
public boolean isContentIncomplete(long written) -
setContentLength
public void setContentLength(int len) -
getHeaders
public org.eclipse.jetty.http.HttpFields.Mutable getHeaders()- Specified by:
getHeadersin interfaceorg.eclipse.jetty.server.Response- Overrides:
getHeadersin classorg.eclipse.jetty.server.Response.Wrapper
-
setContentLength
public void setContentLength(long len) -
getContentLength
public long getContentLength() -
write
- Specified by:
writein interfaceorg.eclipse.jetty.io.Content.Sink- Specified by:
writein interfaceorg.eclipse.jetty.server.Response- Overrides:
writein classorg.eclipse.jetty.server.handler.ContextResponse
-
closeOutput
- Throws:
IOException
-
reset
public void reset()- Specified by:
resetin interfaceorg.eclipse.jetty.server.Response- Overrides:
resetin classorg.eclipse.jetty.server.Response.Wrapper
-
resetContent
public void resetContent() -
getRawCharacterEncoding
Get the raw value of the Character Encoding field.This is only the value as set, not from any other discovered source (eg: mimetypes, Content-Type, ServletContext, etc)
- Returns:
- the raw character encoding
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfaceServletContextHandler.ServletResponseInfo
-
setCharacterEncoding
Update the Content-Type, MimeType, and headers from the provided Character Encoding and EncodingFrom.- Specified by:
setCharacterEncodingin interfaceServletContextHandler.ServletResponseInfo- Parameters:
encoding- the character encodingfrom- where encoding came from
-
isWriting
public boolean isWriting()- Specified by:
isWritingin interfaceServletContextHandler.ServletResponseInfo
-
isStreaming
public boolean isStreaming() -
isWritingOrStreaming
public boolean isWritingOrStreaming()
-