- Direct Known Subclasses:
ValidationContext
- Since:
- 2.0.2
- Author:
- edgar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic class -
Field Summary
Fields inherited from interface io.jooby.Context
ACCEPT, GMT, PORT, RFC1123, RFC1123_PATTERN, SECURE_PORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTrue if the given type matches the `Accept` header.Check if the accept type list matches the given produces list and return the most specific media type from produces list.body()HTTP body which provides access to body content.<T> TConvert the HTTP body to the given type.<T> TConvert the HTTP body to the given type.<T> TConverts a value (single or hash) into the given type.<T> TconvertOrNull(ValueNode value, Class<T> type) Converts a value (single or hash) into the given type.Get a cookie matching the given name.Request cookies.<T> TConvert the HTTP body to the given type.Get a decoder for the given content type or get anStatusCode.UNSUPPORTED_MEDIA_TYPE.detach(Route.Handler next) Tells context that response will be generated form a different thread.Dispatch context to a worker threads.Dispatch context to the given executor.A file upload that matches the given field name.files()All file uploads.All file uploads that matches the given field name.flash()Flash map.Get a flash attribute.form()Get form data.<T> TConvert form data to the given type.Get a form field that matches the given name.formMap()Form data as single-value map.Forward executing to another route.<T> TgetAttribute(String key) Get an attribute by his key.Context attributes (a.k.a request attributes).The certificates presented by the client for mutual TLS.getHost()Return the host that this request was sent to, in general this will be the value of the Host header, minus the port specifier.Return the host and port that this request was sent to, in general this will be the value of the Host.HTTP method in upper-case form.intgetPort()Return the port that this request was sent to.The name of the protocol the request.The IP address of the client or last proxy that sent the request.longRequestContent-Lengthheader or-1when missing.Request path without decoding (a.k.a raw Path) without query string.RequestContent-Typeheader ornullwhen missing.getRequestType(MediaType defaults) RequestContent-Typeheader ornullwhen missing.Recreates full/entire url of the current request using theHostheader.getRequestURL(String path) Recreates full/entire request url using theHostheader with a custom path/suffix.booleanTrue if response headers are cleared on application error.Get response status code.getResponseHeader(String name) Get response header.longGet response content length or-1when none was set.Get response content type.getRoute()Matching route.Get the HTTP router (usually this represents an instance ofJooby.HTTP scheme in lower case.Server host.intServer port for current request.<T> TgetUser()Current user ornullif none was set.header()Request headers asValueNode.Get a header that matches the given name.Header as single-value map.booleanTrue when request runs in IO threads.booleanTrue if response already started.booleanisSecure()Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.booleanCheck if the request path matches the given pattern.onComplete(Route.Complete task) Add a complete listener.path()ConvertContext.pathMap()to aValueNodeobject.<T> TConvert theContext.pathMap()to the given type.Path variable.pathMap()Path map represent all the path keys with their values.query()Query string asValueNodeobject.<T> TConvert the queryString to the given type.Get a query parameter that matches the given name.queryMap()Query string as simple map.Query string with the leading?removeResponseHeader(String name) Remove a response header.Clear/reset all the headers, including cookies.Render a value and send the response to client.<T> Trequire(ServiceKey<T> key) Provides an instance of the given type.<T> TProvides an instance of the given type.<T> TProvides an instance of the given type where name matches it.HTTP response channel as chunker.HTTP response channel as output stream.responseStream(MediaType contentType) HTTP response channel as output stream.responseStream(MediaType contentType, SneakyThrows.Consumer<OutputStream> consumer) HTTP response channel as output stream.responseStream(SneakyThrows.Consumer<OutputStream> consumer) HTTP response channel as output stream.HTTP response channel as response writer.responseWriter(MediaType contentType) HTTP response channel as response writer.responseWriter(MediaType contentType, SneakyThrows.Consumer<PrintWriter> consumer) HTTP response channel as response writer.responseWriter(MediaType contentType, Charset charset) HTTP response channel as response writer.responseWriter(MediaType contentType, Charset charset, SneakyThrows.Consumer<PrintWriter> consumer) HTTP response channel as response writer.responseWriter(SneakyThrows.Consumer<PrintWriter> consumer) HTTP response channel as response writer.send(byte[] data) Send response data.send(byte[]... data) Send response data.send(DataBuffer data) Send response data.send(FileDownload file) Send a file download response.send(StatusCode statusCode) Send an empty response with the given status code.send(InputStream input) Send response data.Send response data.Send response data.send(ByteBuffer data) Send response data.send(ByteBuffer[] data) Send response data.send(FileChannel file) Send a file response.send(ReadableByteChannel channel) Send response data.Send a file response.Send an error response.sendError(Throwable cause, StatusCode code) Send an error response.sendRedirect(StatusCode redirect, String location) Send a redirect response.sendRedirect(String location) Send a302response.session()Find a session or creates a new session.Find a session attribute using the given name.Find an existing session.setAttribute(String key, Object value) Set an application attribute.setDefaultResponseType(MediaType contentType) Set the default response content type header.Set the host (without the port value).Set HTTP method in upper-case form.setPathMap(Map<String, String> pathMap) Set path map.setPort(int port) Set port this request was sent to.setRemoteAddress(String remoteAddress) Set IP address of client or last proxy that sent the request.setRequestPath(String path) Set request path.setResetHeadersOnError(boolean value) Set whenever reset/clear headers on application error.setResponseCode(int statusCode) Set response status code.setResponseCode(StatusCode statusCode) Set response status code.setResponseCookie(Cookie cookie) Set/add a cookie to response.setResponseHeader(String name, Object value) Set response header.setResponseHeader(String name, String value) Set response header.setResponseHeader(String name, Instant value) Set response header.setResponseHeader(String name, Date value) Set response header.setResponseLength(long length) Set response content length header.setResponseType(MediaType contentType) Set response content type header.setResponseType(MediaType contentType, Charset charset) Set response content type header.setResponseType(String contentType) Set response content type header.Set matching route.Set HTTP scheme in lower case.Set current user.toString()upgrade(ServerSentEmitter.Handler handler) Perform a server-sent event handshake and upgrade HTTP GET into a Server-Sent protocol.upgrade(WebSocket.Initializer handler) Perform a websocket handsahke and upgrade a HTTP GET into a websocket protocol.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.jooby.Context
getContextPath, isPreflight, locale, locale, locales, locales, lookup, lookup, lookup
-
Constructor Details
-
ForwardingContext
Creates a new forwarding context.- Parameters:
context- Source context.
-
-
Method Details
-
getUser
@Nullable public <T> T getUser()Description copied from interface:ContextCurrent user ornullif none was set. -
setUser
Description copied from interface:ContextSet current user. -
getDelegate
-
forward
Description copied from interface:ContextForward executing to another route. We use the given path to find a matching route.NOTE: the entire handler pipeline is executed (filter, decorator, etc.).
-
matches
Description copied from interface:ContextCheck if the request path matches the given pattern. -
isSecure
public boolean isSecure()Description copied from interface:ContextReturns a boolean indicating whether this request was made using a secure channel, such as HTTPS. -
getAttributes
Description copied from interface:ContextContext attributes (a.k.a request attributes).- Specified by:
getAttributesin interfaceContext- Returns:
- Mutable Context attributes.
-
getAttribute
Description copied from interface:ContextGet an attribute by his key. This is just an utility method aroundContext.getAttributes(). This method look first in current context and fallback to application attributes.- Specified by:
getAttributein interfaceContext- Type Parameters:
T- Attribute type.- Parameters:
key- Attribute key.- Returns:
- Attribute value or
null.
-
setAttribute
Description copied from interface:ContextSet an application attribute.- Specified by:
setAttributein interfaceContext- Parameters:
key- Attribute key.value- Attribute value.- Returns:
- This router.
-
getRouter
Description copied from interface:ContextGet the HTTP router (usually this represents an instance ofJooby. -
getBufferFactory
- Specified by:
getBufferFactoryin interfaceContext
-
flash
Description copied from interface:ContextFlash map. -
flash
Description copied from interface:ContextGet a flash attribute. -
session
Description copied from interface:ContextFind a session attribute using the given name. If there is no session or attribute under that name a missing value is returned. -
session
Description copied from interface:ContextFind a session or creates a new session. -
sessionOrNull
Description copied from interface:ContextFind an existing session.- Specified by:
sessionOrNullin interfaceContext- Returns:
- Existing session or
null.
-
cookie
Description copied from interface:ContextGet a cookie matching the given name. -
cookieMap
Description copied from interface:ContextRequest cookies. -
getMethod
Description copied from interface:ContextHTTP method in upper-case form. -
setMethod
Description copied from interface:ContextSet HTTP method in upper-case form. -
getRoute
Description copied from interface:ContextMatching route. -
setRoute
Description copied from interface:ContextSet matching route. This is part of public API, but shouldn't be use by application code. -
getRequestPath
Description copied from interface:ContextRequest path without decoding (a.k.a raw Path) without query string.- Specified by:
getRequestPathin interfaceContext- Returns:
- Request path without decoding (a.k.a raw Path) without query string.
-
setRequestPath
Description copied from interface:ContextSet request path. This is usually done by Web Server or framework, but by user.- Specified by:
setRequestPathin interfaceContext- Parameters:
path- Request path.- Returns:
- This context.
-
path
Description copied from interface:ContextPath variable. Value is decoded. -
path
Description copied from interface:ContextConvert theContext.pathMap()to the given type. -
path
Description copied from interface:ContextConvertContext.pathMap()to aValueNodeobject. -
pathMap
Description copied from interface:ContextPath map represent all the path keys with their values.
A call to:{ get("/:id", ctx -> ctx.pathMap()); }GET /678
Produces a path map like:id: 678 -
setPathMap
Description copied from interface:ContextSet path map. This method is part of public API but shouldn't be use it by application code.- Specified by:
setPathMapin interfaceContext- Parameters:
pathMap- Path map.- Returns:
- This context.
-
query
Description copied from interface:ContextQuery string asValueNodeobject. -
query
Description copied from interface:ContextGet a query parameter that matches the given name.{ get("/search", ctx -> { String q = ctx.query("q").value(); ... }); } -
queryString
Description copied from interface:ContextQuery string with the leading?or empty string. This is the raw query string, without decoding it.- Specified by:
queryStringin interfaceContext- Returns:
- Query string with the leading
?or empty string. This is the raw query string, without decoding it.
-
query
Description copied from interface:ContextConvert the queryString to the given type. -
queryMap
Description copied from interface:ContextQuery string as simple map.
Produces/search?q=jooby&sort=name{q: jooby, sort: name} -
header
Description copied from interface:ContextRequest headers asValueNode. -
header
Description copied from interface:ContextGet a header that matches the given name. -
headerMap
Description copied from interface:ContextHeader as single-value map. -
accept
Description copied from interface:ContextTrue if the given type matches the `Accept` header. This method returnstrueif there is no accept header. -
accept
Description copied from interface:ContextCheck if the accept type list matches the given produces list and return the most specific media type from produces list. -
getRequestType
Description copied from interface:ContextRequestContent-Typeheader ornullwhen missing.- Specified by:
getRequestTypein interfaceContext- Returns:
- Request
Content-Typeheader ornullwhen missing.
-
getRequestType
Description copied from interface:ContextRequestContent-Typeheader ornullwhen missing.- Specified by:
getRequestTypein interfaceContext- Parameters:
defaults- Default content type to use when the header is missing.- Returns:
- Request
Content-Typeheader ornullwhen missing.
-
getRequestLength
public long getRequestLength()Description copied from interface:ContextRequestContent-Lengthheader or-1when missing.- Specified by:
getRequestLengthin interfaceContext- Returns:
- Request
Content-Lengthheader or-1when missing.
-
getRemoteAddress
Description copied from interface:ContextThe IP address of the client or last proxy that sent the request.If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set
Router.setTrustProxy(boolean)option.- Specified by:
getRemoteAddressin interfaceContext- Returns:
- The IP address of the client or last proxy that sent the request or
empty stringfor interrupted requests.
-
setRemoteAddress
Description copied from interface:ContextSet IP address of client or last proxy that sent the request.- Specified by:
setRemoteAddressin interfaceContext- Parameters:
remoteAddress- Remote Address.- Returns:
- This context.
-
getHost
Description copied from interface:ContextReturn the host that this request was sent to, in general this will be the value of the Host header, minus the port specifier. Unless, it is set manually using theContext.setHost(String)method.If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set
Router.setTrustProxy(boolean)option. -
setHost
Description copied from interface:ContextSet the host (without the port value).Please keep in mind this method doesn't alter/modify the
hostheader. -
getServerPort
public int getServerPort()Description copied from interface:ContextServer port for current request.- Specified by:
getServerPortin interfaceContext- Returns:
- Server port for current request.
-
getServerHost
Description copied from interface:ContextServer host.- Specified by:
getServerHostin interfaceContext- Returns:
- Server host.
-
getPort
public int getPort()Description copied from interface:ContextReturn the port that this request was sent to. In general this will be the value of the Host header, minus the host name.If no host header is present, this method returns the value of
Context.getServerPort(). -
setPort
Description copied from interface:ContextSet port this request was sent to. -
getHostAndPort
Description copied from interface:ContextReturn the host and port that this request was sent to, in general this will be the value of the Host.If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set
Router.setTrustProxy(boolean)option.- Specified by:
getHostAndPortin interfaceContext- Returns:
- Return the host that this request was sent to, in general this will be the value of the Host header.
-
getRequestURL
Description copied from interface:ContextRecreates full/entire url of the current request using theHostheader.If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set
Router.setTrustProxy(boolean)option.- Specified by:
getRequestURLin interfaceContext- Returns:
- Full/entire request url using the
Hostheader.
-
getRequestURL
Description copied from interface:ContextRecreates full/entire request url using theHostheader with a custom path/suffix.If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set
Router.setTrustProxy(boolean)option.- Specified by:
getRequestURLin interfaceContext- Parameters:
path- Path or suffix to use, can also include query string parameters.- Returns:
- Full/entire request url using the
Hostheader.
-
getProtocol
Description copied from interface:ContextThe name of the protocol the request. Always in lower-case.- Specified by:
getProtocolin interfaceContext- Returns:
- The name of the protocol the request. Always in lower-case.
-
getClientCertificates
Description copied from interface:ContextThe certificates presented by the client for mutual TLS. Empty if ssl is not enabled, or client authentication is not required.- Specified by:
getClientCertificatesin interfaceContext- Returns:
- The certificates presented by the client for mutual TLS. Empty if ssl is not enabled, or client authentication is not required.
-
getScheme
Description copied from interface:ContextHTTP scheme in lower case. -
setScheme
Description copied from interface:ContextSet HTTP scheme in lower case. -
form
Description copied from interface:ContextGet form data.Only for
application/x-www-form-urlencodedormultipart/form-datarequest. -
form
Description copied from interface:ContextGet a form field that matches the given name.File upload retrieval is available using
Context.file(String).Only for
multipart/form-datarequest. -
form
Description copied from interface:ContextConvert form data to the given type.Only for
application/x-www-form-urlencodedormultipart/form-datarequest. -
formMap
Description copied from interface:ContextForm data as single-value map.Only for
application/x-www-form-urlencodedormultipart/form-datarequest. -
files
Description copied from interface:ContextAll file uploads. Only formultipart/form-datarequest. -
files
Description copied from interface:ContextAll file uploads that matches the given field name.Only for
multipart/form-datarequest. -
file
Description copied from interface:ContextA file upload that matches the given field name.Only for
multipart/form-datarequest. -
body
Description copied from interface:ContextHTTP body which provides access to body content. -
body
Description copied from interface:ContextConvert the HTTP body to the given type. -
body
Description copied from interface:ContextConvert the HTTP body to the given type. -
convert
Description copied from interface:ContextConverts a value (single or hash) into the given type. -
convertOrNull
Description copied from interface:ContextConverts a value (single or hash) into the given type.- Specified by:
convertOrNullin interfaceContext- Type Parameters:
T- Generic type.- Parameters:
value- Value to convert.type- Expected type.- Returns:
- Converted value or
null.
-
decode
Description copied from interface:ContextConvert the HTTP body to the given type. -
decoder
Description copied from interface:ContextGet a decoder for the given content type or get anStatusCode.UNSUPPORTED_MEDIA_TYPE. -
isInIoThread
public boolean isInIoThread()Description copied from interface:ContextTrue when request runs in IO threads.- Specified by:
isInIoThreadin interfaceContext- Returns:
- True when request runs in IO threads.
-
dispatch
Description copied from interface:ContextDispatch context to a worker threads. Worker threads allow to execute blocking code. The default worker thread pool is provided by web server or by application code using theJooby.setWorker(Executor).Example:
get("/", ctx -> { return ctx.dispatch(() -> { // run blocking code }): }); -
dispatch
Description copied from interface:ContextDispatch context to the given executor.Example:
Executor executor = ...; get("/", ctx -> { return ctx.dispatch(executor, () -> { // run blocking code }): }); -
detach
Description copied from interface:ContextTells context that response will be generated form a different thread. This operation is similar toContext.dispatch(Runnable)except there is no thread dispatching here.This operation integrates easily with third-party libraries like rxJava or others.
-
upgrade
Description copied from interface:ContextPerform a websocket handsahke and upgrade a HTTP GET into a websocket protocol.NOTE: This method is part of Public API, but shouldn't be used by client code.
-
upgrade
Description copied from interface:ContextPerform a server-sent event handshake and upgrade HTTP GET into a Server-Sent protocol.NOTE: This method is part of Public API, but shouldn't be used by client code.
-
setResponseHeader
Description copied from interface:ContextSet response header.- Specified by:
setResponseHeaderin interfaceContext- Parameters:
name- Header name.value- Header value.- Returns:
- This context.
-
setResponseHeader
Description copied from interface:ContextSet response header.- Specified by:
setResponseHeaderin interfaceContext- Parameters:
name- Header name.value- Header value.- Returns:
- This context.
-
setResponseHeader
Description copied from interface:ContextSet response header.- Specified by:
setResponseHeaderin interfaceContext- Parameters:
name- Header name.value- Header value.- Returns:
- This context.
-
setResponseHeader
Description copied from interface:ContextSet response header.- Specified by:
setResponseHeaderin interfaceContext- Parameters:
name- Header name.value- Header value.- Returns:
- This context.
-
removeResponseHeader
Description copied from interface:ContextRemove a response header.- Specified by:
removeResponseHeaderin interfaceContext- Parameters:
name- Header's name.- Returns:
- This context.
-
removeResponseHeaders
Description copied from interface:ContextClear/reset all the headers, including cookies.- Specified by:
removeResponseHeadersin interfaceContext- Returns:
- This context.
-
getResponseHeader
Description copied from interface:ContextGet response header.- Specified by:
getResponseHeaderin interfaceContext- Parameters:
name- Header's name.- Returns:
- Header's value (if set previously) or
null.
-
getResponseLength
public long getResponseLength()Description copied from interface:ContextGet response content length or-1when none was set.- Specified by:
getResponseLengthin interfaceContext- Returns:
- Response content length or
-1when none was set.
-
setResponseLength
Description copied from interface:ContextSet response content length header.- Specified by:
setResponseLengthin interfaceContext- Parameters:
length- Response length.- Returns:
- This context.
-
setResponseCookie
Description copied from interface:ContextSet/add a cookie to response.- Specified by:
setResponseCookiein interfaceContext- Parameters:
cookie- Cookie to add.- Returns:
- This context.
-
setResponseType
Description copied from interface:ContextSet response content type header.- Specified by:
setResponseTypein interfaceContext- Parameters:
contentType- Content type.- Returns:
- This context.
-
setResponseType
Description copied from interface:ContextSet response content type header.- Specified by:
setResponseTypein interfaceContext- Parameters:
contentType- Content type.- Returns:
- This context.
-
setResponseType
Description copied from interface:ContextSet response content type header.- Specified by:
setResponseTypein interfaceContext- Parameters:
contentType- Content type.charset- Charset.- Returns:
- This context.
-
setDefaultResponseType
Description copied from interface:ContextSet the default response content type header. It is used if the response content type header was not set yet.- Specified by:
setDefaultResponseTypein interfaceContext- Parameters:
contentType- Content type.- Returns:
- This context.
-
getResponseType
Description copied from interface:ContextGet response content type.- Specified by:
getResponseTypein interfaceContext- Returns:
- Response content type.
-
setResponseCode
Description copied from interface:ContextSet response status code.- Specified by:
setResponseCodein interfaceContext- Parameters:
statusCode- Status code.- Returns:
- This context.
-
setResponseCode
Description copied from interface:ContextSet response status code.- Specified by:
setResponseCodein interfaceContext- Parameters:
statusCode- Status code.- Returns:
- This context.
-
getResponseCode
Description copied from interface:ContextGet response status code.- Specified by:
getResponseCodein interfaceContext- Returns:
- Response status code.
-
render
Description copied from interface:ContextRender a value and send the response to client. -
responseStream
Description copied from interface:ContextHTTP response channel as output stream. Usually for chunked responses.- Specified by:
responseStreamin interfaceContext- Returns:
- HTTP channel as output stream. Usually for chunked responses.
-
responseStream
Description copied from interface:ContextHTTP response channel as output stream. Usually for chunked responses.- Specified by:
responseStreamin interfaceContext- Parameters:
contentType- Media type.- Returns:
- HTTP channel as output stream. Usually for chunked responses.
-
responseStream
@NonNull public Context responseStream(@NonNull MediaType contentType, @NonNull SneakyThrows.Consumer<OutputStream> consumer) throws Exception Description copied from interface:ContextHTTP response channel as output stream. Usually for chunked responses.- Specified by:
responseStreamin interfaceContext- Parameters:
contentType- Content type.consumer- Output stream consumer.- Returns:
- HTTP channel as output stream. Usually for chunked responses.
- Throws:
Exception- Is something goes wrong.
-
responseStream
@NonNull public Context responseStream(@NonNull SneakyThrows.Consumer<OutputStream> consumer) throws Exception Description copied from interface:ContextHTTP response channel as output stream. Usually for chunked responses.- Specified by:
responseStreamin interfaceContext- Parameters:
consumer- Output stream consumer.- Returns:
- HTTP channel as output stream. Usually for chunked responses.
- Throws:
Exception- Is something goes wrong.
-
responseSender
Description copied from interface:ContextHTTP response channel as chunker.- Specified by:
responseSenderin interfaceContext- Returns:
- HTTP channel as chunker. Usually for chunked response.
-
responseWriter
Description copied from interface:ContextHTTP response channel as response writer.- Specified by:
responseWriterin interfaceContext- Returns:
- HTTP channel as response writer. Usually for chunked response.
-
responseWriter
Description copied from interface:ContextHTTP response channel as response writer.- Specified by:
responseWriterin interfaceContext- Parameters:
contentType- Content type.- Returns:
- HTTP channel as response writer. Usually for chunked response.
-
responseWriter
@NonNull public PrintWriter responseWriter(@NonNull MediaType contentType, @Nullable Charset charset) Description copied from interface:ContextHTTP response channel as response writer.- Specified by:
responseWriterin interfaceContext- Parameters:
contentType- Content type.charset- Charset.- Returns:
- HTTP channel as response writer. Usually for chunked response.
-
responseWriter
@NonNull public Context responseWriter(@NonNull SneakyThrows.Consumer<PrintWriter> consumer) throws Exception Description copied from interface:ContextHTTP response channel as response writer.- Specified by:
responseWriterin interfaceContext- Parameters:
consumer- Writer consumer.- Returns:
- This context.
- Throws:
Exception- Is something goes wrong.
-
responseWriter
@NonNull public Context responseWriter(@NonNull MediaType contentType, @NonNull SneakyThrows.Consumer<PrintWriter> consumer) throws Exception Description copied from interface:ContextHTTP response channel as response writer.- Specified by:
responseWriterin interfaceContext- Parameters:
contentType- Content type.consumer- Writer consumer.- Returns:
- This context.
- Throws:
Exception- Is something goes wrong.
-
responseWriter
@NonNull public Context responseWriter(@NonNull MediaType contentType, @Nullable Charset charset, @NonNull SneakyThrows.Consumer<PrintWriter> consumer) throws Exception Description copied from interface:ContextHTTP response channel as response writer.- Specified by:
responseWriterin interfaceContext- Parameters:
contentType- Content type.charset- Charset.consumer- Writer consumer.- Returns:
- This context.
- Throws:
Exception- Is something goes wrong.
-
sendRedirect
Description copied from interface:ContextSend a302response.- Specified by:
sendRedirectin interfaceContext- Parameters:
location- Location.- Returns:
- This context.
-
sendRedirect
Description copied from interface:ContextSend a redirect response.- Specified by:
sendRedirectin interfaceContext- Parameters:
redirect- Redirect status code.location- Location.- Returns:
- This context.
-
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend response data. -
send
Description copied from interface:ContextSend a file download response. -
send
Description copied from interface:ContextSend a file response. -
send
Description copied from interface:ContextSend a file response. -
send
Description copied from interface:ContextSend an empty response with the given status code. -
sendError
Description copied from interface:ContextSend an error response. Status code is computed viaRouter.errorCode(Throwable). -
sendError
Description copied from interface:ContextSend an error response. -
isResponseStarted
public boolean isResponseStarted()Description copied from interface:ContextTrue if response already started.- Specified by:
isResponseStartedin interfaceContext- Returns:
- True if response already started.
-
getResetHeadersOnError
public boolean getResetHeadersOnError()Description copied from interface:ContextTrue if response headers are cleared on application error. If none set it uses the default/global value specified byRouterOption.RESET_HEADERS_ON_ERROR.- Specified by:
getResetHeadersOnErrorin interfaceContext- Returns:
- True if response headers are cleared on application error. If none set it uses the
default/global value specified by
RouterOption.RESET_HEADERS_ON_ERROR.
-
setResetHeadersOnError
Description copied from interface:ContextSet whenever reset/clear headers on application error.- Specified by:
setResetHeadersOnErrorin interfaceContext- Parameters:
value- True for reset/clear headers.- Returns:
- This context.
-
onComplete
Description copied from interface:ContextAdd a complete listener.- Specified by:
onCompletein interfaceContext- Parameters:
task- Task to execute.- Returns:
- This context.
-
require
Description copied from interface:RegistryProvides an instance of the given type.- Specified by:
requirein interfaceRegistry- Type Parameters:
T- Object type.- Parameters:
type- Object type.- Returns:
- Instance of this type.
- Throws:
RegistryException- If there was a runtime failure while providing an instance.
-
require
@NonNull public <T> T require(@NonNull Class<T> type, @NonNull String name) throws RegistryException Description copied from interface:RegistryProvides an instance of the given type where name matches it.- Specified by:
requirein interfaceRegistry- Type Parameters:
T- Object type.- Parameters:
type- Object type.name- Object name.- Returns:
- Instance of this type.
- Throws:
RegistryException- If there was a runtime failure while providing an instance.
-
require
Description copied from interface:RegistryProvides an instance of the given type.- Specified by:
requirein interfaceRegistry- Type Parameters:
T- Object type.- Parameters:
key- Object key.- Returns:
- Instance of this type.
- Throws:
RegistryException- If there was a runtime failure while providing an instance.
-
toString
-