类 DecoratingRequestContext
- 所有已实现的接口:
cn.taketoday.core.AttributeAccessor,cn.taketoday.core.io.InputStreamSource,cn.taketoday.core.io.OutputStreamSource,HttpInputMessage,HttpMessage,HttpRequest,Serializable
Provides a convenient implementation of the RequestContext that can be subclassed by developers wishing to adapt the request to web. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.
- 从以下版本开始:
- 4.0 2023/6/13 23:38
- 作者:
- Harry Yang
- 另请参阅:
-
嵌套类概要
从类继承的嵌套类/接口 cn.taketoday.web.RequestContext
RequestContext.RequestContextHttpOutputMessage -
字段概要
字段从类继承的字段 cn.taketoday.web.RequestContext
applicationContext, asyncWebRequest, bindingContext, contextPath, cookies, corsRequestFlag, EMPTY_COOKIES, httpMethod, inputStream, locale, lookupPath, method, multipartFlag, multipartRequest, notModified, outputStream, parameters, pathWithinApplication, preFlightRequestFlag, queryString, reader, redirectModel, requestDestructionCallbacks, requestHeaders, requestPath, requestURI, responseContentType, responseCookies, responseHeaders, SCOPE_REQUEST, SCOPE_SESSION, uri, webAsyncManager, writer从类继承的字段 cn.taketoday.core.AttributeAccessorSupport
attributes -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddCookie(HttpCookie cookie) Adds the specified cookie to the response.voidAdds the specified cookie to the response.binding()booleancheckNotModified(long lastModifiedTimestamp) Check whether the requested resource has been modified given the supplied last-modified timestamp (as determined by the application).booleancheckNotModified(String etag) Check whether the requested resource has been modified given the suppliedETag(entity tag), as determined by the application.booleancheckNotModified(String etag, long lastModifiedTimestamp) Check whether the requested resource has been modified given the suppliedETag(entity tag) and last-modified timestamp, as determined by the application.void<T> TcomputeAttribute(String name, Function<String, T> computeFunction) voidcopyAttributesFrom(cn.taketoday.core.AttributeAccessor source) protected AsyncWebRequestprotected MultipartRequestcreate MultipartRequesttemplate method for create request http-headerscreate a new response http-headerprotected Stringprotected HttpCookie[]protected InputStreamprotected Localeprotected Stringprotected OutputStreamtemplate method for get OutputStreamprotected Stringprotected BufferedReadertemplate method for get readerprotected RequestPathprotected Stringprotected PrintWritertemplate method for get writerbooleanvoidflush()Forces any content in the buffer to be written to the client.cn.taketoday.context.ApplicationContextReturn the WebApplicationContext that this request runs in.getAttribute(String name) String[]getBody()Return the body of the message as an input stream.longReturns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.Returns the MIME type of the body of the request, ornullif the type is not known.Returns the portion of the request URI that indicates the context of the request.Returns aHttpCookieobject the client sent with this request.Returns an array containing all of theCookieobjects the client sent with this request.abstract RequestContextReturn the headers of this message.Return read-only "input" flash attributes from request before redirect.Return read-only "input" flash attributes from request before redirect.Retrieves the body of the request as binary data using aInputStream.Returns the preferredLocalethat the client will accept content in, based on the Accept-Language header.Return the HTTP method of the request.Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.Returns aOutputStreamsuitable for writing binary data in the response.getParameter(String name) Returns the value of a request parameter as aString, ornullif the parameter does not exist.Returns anIteratorofStringobjects containing the names of the parameters contained in this request.Returns a java.util.Map of the parameters of this request.String[]getParameters(String name) Returns an array ofStringobjects containing all of the values the given request parameter has, ornullif the parameter does not exist.Returns the query string that is contained in the request URL after the path.Retrieves the body of the request as character data using aBufferedReader.Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.Obtain a unique identifier string for this request.longGet start handling this request time millisReturns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.Returns the content type used for the MIME body sent in this response.Returns the name of the scheme used to make this request, for example,http,https, orftp.Returns the host name of the server to which the request was sent.intReturns the port number to which the request was sent.intGets the current status code of this response.getURI()Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).Returns aPrintWriterobject that can send character text to the client.booleanhasAttribute(String name) booleanbooleaninthashCode()booleanprotected StringinitId()Obtain the request id to use, ornullin which case the Object identity of this request instance is used.booleanReturns a boolean indicating if the response has been committed.booleanWhether the selected handler for the current request chose to handle the request asynchronously.booleanReturnstrueif the request is a valid CORS one by checkingOriginheader presence and ensuring that origins are different.booleanbooleanbooleanReturnstrueif the request is a valid CORS pre-flight one by checking {code OPTIONS} method withOriginandAccess-Control-Request-Methodheaders presence.voidmergeToResponse(HttpHeaders headers) merge headers to response http-headers<T> TNative request eg: HttpServletRequestprotected voidpostGetParameters(cn.taketoday.util.MultiValueMap<String, String> parameters) voidpostRequestCompleted(Throwable notHandled) removeAttribute(String name) removeCookie(String name) remove the specified cookie from responsevoidSignal that the request has been completed.voidrequestCompleted(Throwable notHandled) Signal that the request has been completed.Get request HTTP headersvoidreset()Clears any data that exists in the buffer as well as the status code, headers.Get request HTTP headersvoidsendError(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 and clears the buffer.voidsendError(HttpStatusCode code) Sends an error response to the client using the specified status code and clears the buffer.voidsendError(HttpStatusCode code, String msg) Sends an error response to the client using the specified status and clears the buffer.voidsendRedirect(String location) Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.voidsetAttribute(String name, Object value) voidsetBinding(BindingContext bindingContext) voidsetContentLength(long length) Sets the length of the content body in the response , this method sets the HTTP Content-Length header.voidsetContentType(MediaType contentType) Sets the content type of the response being sent to the client, if the response has not been committed yet.voidsetContentType(String contentType) Sets the content type of the response being sent to the client, if the response has not been committed yet.voidsetMatchingMetadata(HandlerMatchingMetadata handlerMatchingMetadata) voidsetStatus(int sc) Sets the status code for this response.voidsetStatus(HttpStatusCode status) Sets the status code and message for this response.voidsetWebAsyncManagerFactory(WebAsyncManagerFactory webAsyncManagerFactory) toString()<T> TunwrapRequest(Class<T> requestClass) voidwrite headers to response从类继承的方法 cn.taketoday.web.RequestContext
getPort, getRequestProcessingTime, registerRequestDestructionCallback, registerRequestDestructionCallback, removeRequestDestructionCallback从类继承的方法 cn.taketoday.core.AttributeAccessorSupport
createAttributes
-
字段详细资料
-
serialVersionUID
private static final long serialVersionUID- 另请参阅:
-
-
构造器详细资料
-
DecoratingRequestContext
protected DecoratingRequestContext()
-
-
方法详细资料
-
getRequestTimeMillis
public long getRequestTimeMillis()从类复制的说明:RequestContextGet start handling this request time millis- 指定者:
getRequestTimeMillis在类中RequestContext- 返回:
- start handling this request time millis
-
getRequestId
从类复制的说明:RequestContextObtain a unique identifier string for this request.There is no defined format for this string. The format is implementation dependent.
- 覆盖:
getRequestId在类中RequestContext- 返回:
- A unique identifier for the request
-
initId
从类复制的说明:RequestContextObtain the request id to use, ornullin which case the Object identity of this request instance is used.- 覆盖:
initId在类中RequestContext
-
getApplicationContext
public cn.taketoday.context.ApplicationContext getApplicationContext()从类复制的说明:RequestContextReturn the WebApplicationContext that this request runs in.- 覆盖:
getApplicationContext在类中RequestContext
-
getReader
- 抛出:
IOException
-
readableChannel
- 抛出:
IOException
-
writableChannel
- 抛出:
IOException
-
getScheme
从类复制的说明:RequestContextReturns the name of the scheme used to make this request, for example,http,https, orftp. Different schemes have different rules for constructing URLs, as noted in RFC 1738.- 指定者:
getScheme在类中RequestContext- 返回:
- a
Stringcontaining the name of the scheme used to make this request
-
getServerPort
public int getServerPort()从类复制的说明:RequestContextReturns the port number to which the request was sent. It is the value of the part after ":" in theHostheader value, if any, or the server port where the client connection was accepted on.- 指定者:
getServerPort在类中RequestContext- 返回:
- an integer specifying the port number
-
getServerName
从类复制的说明:RequestContextReturns the host name of the server to which the request was sent. It is the value of the part before ":" in theHostheader value, if any, or the resolved server name, or the server IP address.- 指定者:
getServerName在类中RequestContext- 返回:
- a
Stringcontaining the name of the server
-
getContextPath
从类复制的说明:RequestContextReturns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "" character but does not end with a "" character. The container does not decode this string.- 覆盖:
getContextPath在类中RequestContext- 返回:
- a
Stringspecifying the portion of the request URI that indicates the context of the request
-
doGetContextPath
- 覆盖:
doGetContextPath在类中RequestContext
-
getURI
从接口复制的说明:HttpRequestReturn the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).- 指定者:
getURI在接口中HttpRequest- 覆盖:
getURI在类中RequestContext- 返回:
- the URI of the request (never
null)
-
getRequestURI
从类复制的说明:RequestContextReturns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. The web container does not decode this String. For example:First line of HTTP request Returned Value POST /some/path.html HTTP/1.1 /some/path.html GET http://foo.bar/a.html HTTP/1.0 /a.html HEAD /xyz?a=b HTTP/1.1 /xyz - 覆盖:
getRequestURI在类中RequestContext- 返回:
- a
Stringcontaining the part of the URL from the protocol name up to the query string
-
getLookupPath
- 覆盖:
getLookupPath在类中RequestContext
-
isPreFlightRequest
public boolean isPreFlightRequest()从类复制的说明:RequestContextReturnstrueif the request is a valid CORS pre-flight one by checking {code OPTIONS} method withOriginandAccess-Control-Request-Methodheaders presence.- 覆盖:
isPreFlightRequest在类中RequestContext
-
isCorsRequest
public boolean isCorsRequest()从类复制的说明:RequestContextReturnstrueif the request is a valid CORS one by checkingOriginheader presence and ensuring that origins are different.- 覆盖:
isCorsRequest在类中RequestContext
-
getRequestPath
- 覆盖:
getRequestPath在类中RequestContext- 另请参阅:
-
doGetRequestURI
- 指定者:
doGetRequestURI在类中RequestContext
-
getRequestURL
从类复制的说明:RequestContextThe returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.- 覆盖:
getRequestURL在类中RequestContext- 返回:
- A URL
-
getQueryString
从类复制的说明:RequestContextReturns the query string that is contained in the request URL after the path. This method returnsnullif the URL does not have a query string. Same as the value of the CGI variable QUERY_STRING.- 覆盖:
getQueryString在类中RequestContext- 返回:
- a
Stringcontaining the query string ornullif the URL contains no query string. The value is not decoded by the container.
-
doGetQueryString
- 指定者:
doGetQueryString在类中RequestContext
-
getCookies
从类复制的说明:RequestContextReturns an array containing all of theCookieobjects the client sent with this request. This method returnsnullif no cookies were sent.- 覆盖:
getCookies在类中RequestContext- 返回:
- an array of all the
Cookiesincluded with this request, orRequestContext.EMPTY_COOKIESif the request has no cookies
-
doGetCookies
- 指定者:
doGetCookies在类中RequestContext- 返回:
- an array of all the Cookies included with this request,or
RequestContext.EMPTY_COOKIESif the request has no cookies
-
getCookie
从类复制的说明:RequestContextReturns aHttpCookieobject the client sent with this request. This method returnsnullif no target cookie were sent.- 覆盖:
getCookie在类中RequestContext- 参数:
name- Cookie name- 返回:
- a
HttpCookieobject the client sent with this request. This method returnsnullif no target cookie were sent.
-
addCookie
从类复制的说明:RequestContextAdds the specified cookie to the response. This method can be called multiple times to set more than one cookie.- 覆盖:
addCookie在类中RequestContext- 参数:
cookie- the Cookie to return to the client
-
addCookie
从类复制的说明:RequestContextAdds the specified cookie to the response. This method can be called multiple times to set more than one cookie.- 覆盖:
addCookie在类中RequestContext- 参数:
name- the Cookie name to return to the clientvalue- the Cookie value to return to the client
-
removeCookie
从类复制的说明:RequestContextremove the specified cookie from response- 覆盖:
removeCookie在类中RequestContext- 参数:
name- cookie name- 返回:
- removed cookie
-
responseCookies
- 覆盖:
responseCookies在类中RequestContext
-
getParameters
从类复制的说明:RequestContextReturns a java.util.Map of the parameters of this request.Request parameters are extra information sent with the request. Parameters are contained in the query string or posted form data.
- 覆盖:
getParameters在类中RequestContext- 返回:
- java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
-
doGetParameters
- 覆盖:
doGetParameters在类中RequestContext
-
postGetParameters
- 覆盖:
postGetParameters在类中RequestContext
-
getParameterNames
从类复制的说明:RequestContextReturns anIteratorofStringobjects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an emptyIterator.- 覆盖:
getParameterNames在类中RequestContext- 返回:
- an
IteratorofStringobjects, eachStringcontaining the name of a request parameter; or an emptyIteratorif the request has no parameters
-
getParameters
从类复制的说明:RequestContextReturns an array ofStringobjects containing all of the values the given request parameter has, ornullif the parameter does not exist.If the parameter has a single value, the array has a length of 1.
- 覆盖:
getParameters在类中RequestContext- 参数:
name- aStringcontaining the name of the parameter whose value is requested- 返回:
- an array of
Stringobjects containing the parameter's values - 另请参阅:
-
getParameter
从类复制的说明:RequestContextReturns the value of a request parameter as aString, ornullif the parameter does not exist. Request parameters are extra information sent with the request. Parameters are contained in the query string or posted form data.You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use
RequestContext.getParameters(String).If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by
parameters(String).If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via
RequestContext.getInputStream()orRequestContext.getReader()can interfere with the execution of this method.- 覆盖:
getParameter在类中RequestContext- 参数:
name- aStringspecifying the name of the parameter- 返回:
- a
Stringrepresenting the single value of the parameter - 另请参阅:
-
doGetMethod
- 指定者:
doGetMethod在类中RequestContext
-
getRemoteAddress
从类复制的说明:RequestContextReturns the Internet Protocol (IP) address of the client or last proxy that sent the request.- 指定者:
getRemoteAddress在类中RequestContext- 返回:
- a
Stringcontaining the IP address of the client that sent the request
-
getContentLength
public long getContentLength()从类复制的说明:RequestContextReturns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.- 指定者:
getContentLength在类中RequestContext- 返回:
- a long containing the length of the request body or -1L if the length is not known
-
getBody
从接口复制的说明:HttpInputMessageReturn the body of the message as an input stream.- 指定者:
getBody在接口中HttpInputMessage- 覆盖:
getBody在类中RequestContext- 返回:
- the input stream body (never
null) - 抛出:
IOException- in case of I/O errors
-
getHeaders
从接口复制的说明:HttpMessageReturn the headers of this message.- 指定者:
getHeaders在接口中HttpMessage- 覆盖:
getHeaders在类中RequestContext- 返回:
- a corresponding HttpHeaders object (never
null)
-
getInputStream
从类复制的说明:RequestContextRetrieves the body of the request as binary data using aInputStream. Either this method orRequestContext.getReader()may be called to read the body, not both.- 指定者:
getInputStream在接口中cn.taketoday.core.io.InputStreamSource- 覆盖:
getInputStream在类中RequestContext- 返回:
- a
InputStreamobject containing the body of the request - 抛出:
IOException- if an input or output exception occurred
-
doGetInputStream
- 指定者:
doGetInputStream在类中RequestContext- 抛出:
IOException
-
getReader
从类复制的说明:RequestContextRetrieves the body of the request as character data using aBufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method orRequestContext.getInputStream()may be called to read the body, not both.- 指定者:
getReader在接口中cn.taketoday.core.io.InputStreamSource- 覆盖:
getReader在类中RequestContext- 返回:
- a
BufferedReadercontaining the body of the request - 抛出:
IOException- if an input or output exception occurred- 另请参阅:
-
doGetReader
从类复制的说明:RequestContexttemplate method for get reader- 覆盖:
doGetReader在类中RequestContext- 抛出:
IOException
-
isMultipart
public boolean isMultipart()- 覆盖:
isMultipart在类中RequestContext- 返回:
- return whether this request is multipart
-
getContentType
从类复制的说明:RequestContextReturns the MIME type of the body of the request, ornullif the type is not known.- 指定者:
getContentType在类中RequestContext- 返回:
- a
Stringcontaining the name of the MIME type of the request, or null if the type is not known
-
requestHeaders
从类复制的说明:RequestContextGet request HTTP headers- 覆盖:
requestHeaders在类中RequestContext- 返回:
- request read only HTTP header ,never be
null
-
createRequestHeaders
从类复制的说明:RequestContexttemplate method for create request http-headers- 指定者:
createRequestHeaders在类中RequestContext
-
getLocale
从类复制的说明:RequestContextReturns the preferredLocalethat the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.- 覆盖:
getLocale在类中RequestContext- 返回:
- the preferred
Localefor the client
-
doGetLocale
- 覆盖:
doGetLocale在类中RequestContext
-
checkNotModified
public boolean checkNotModified(long lastModifiedTimestamp) 从类复制的说明:RequestContextCheck whether the requested resource has been modified given the supplied last-modified timestamp (as determined by the application).This will also transparently set the "Last-Modified" response header and HTTP status when applicable.
Typical usage:
public String myHandleMethod(RequestContext request, Model model) { long lastModified = // application-specific calculation if (request.checkNotModified(lastModified)) { // shortcut exit - no further processing necessary return null; } // further request processing, actually building content model.addAttribute(...); return "myViewName"; }This method works with conditional GET/HEAD requests, but also with conditional POST/PUT/DELETE requests.
Note: you can use either this
#checkNotModified(long)method; orRequestContext.checkNotModified(String). If you want enforce both a strong entity tag and a Last-Modified value, as recommended by the HTTP specification, then you should useRequestContext.checkNotModified(String, long).If the "If-Modified-Since" header is set but cannot be parsed to a date value, this method will ignore the header and proceed with setting the last-modified timestamp on the response.
- 覆盖:
checkNotModified在类中RequestContext- 参数:
lastModifiedTimestamp- the last-modified timestamp in milliseconds that the application determined for the underlying resource- 返回:
- whether the request qualifies as not modified, allowing to abort request processing and relying on the response telling the client that the content has not been modified
-
checkNotModified
从类复制的说明:RequestContextCheck whether the requested resource has been modified given the suppliedETag(entity tag), as determined by the application.This will also transparently set the "ETag" response header and HTTP status when applicable.
Typical usage:
public String myHandleMethod(RequestContext request, Model model) { String eTag = // application-specific calculation if (request.checkNotModified(eTag)) { // shortcut exit - no further processing necessary return null; } // further request processing, actually building content model.addAttribute(...); return "myViewName"; }Note: you can use either this
#checkNotModified(String)method; orRequestContext.checkNotModified(long). If you want enforce both a strong entity tag and a Last-Modified value, as recommended by the HTTP specification, then you should useRequestContext.checkNotModified(String, long).- 覆盖:
checkNotModified在类中RequestContext- 参数:
etag- the entity tag that the application determined for the underlying resource. This parameter will be padded with quotes (") if necessary.- 返回:
- true if the request does not require further processing.
-
checkNotModified
从类复制的说明:RequestContextCheck whether the requested resource has been modified given the suppliedETag(entity tag) and last-modified timestamp, as determined by the application.This will also transparently set the "ETag" and "Last-Modified" response headers, and HTTP status when applicable.
Typical usage:
public String myHandleMethod(RequestContext request, Model model) { String eTag = // application-specific calculation long lastModified = // application-specific calculation if (request.checkNotModified(eTag, lastModified)) { // shortcut exit - no further processing necessary return null; } // further request processing, actually building content model.addAttribute(...); return "myViewName"; }This method works with conditional GET/HEAD requests, but also with conditional POST/PUT/DELETE requests.
Note: The HTTP specification recommends setting both ETag and Last-Modified values, but you can also use
#checkNotModified(String)orRequestContext.checkNotModified(long).- 覆盖:
checkNotModified在类中RequestContext- 参数:
etag- the entity tag that the application determined for the underlying resource. This parameter will be padded with quotes (") if necessary.lastModifiedTimestamp- the last-modified timestamp in milliseconds that the application determined for the underlying resource- 返回:
- true if the request does not require further processing.
-
isNotModified
public boolean isNotModified()- 覆盖:
isNotModified在类中RequestContext
-
setContentLength
public void setContentLength(long length) 从类复制的说明:RequestContextSets the length of the content body in the response , this method sets the HTTP Content-Length header.- 覆盖:
setContentLength在类中RequestContext- 参数:
length- an long specifying the length of the content being returned to the client; sets the Content-Length header
-
isCommitted
public boolean isCommitted()从类复制的说明:RequestContextReturns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.- 指定者:
isCommitted在类中RequestContext- 返回:
- a boolean indicating if the response has been committed
- 另请参阅:
-
reset
public void reset()从类复制的说明:RequestContextClears any data that exists in the buffer as well as the status code, headers. The state of callingRequestContext.getWriter()orRequestContext.getOutputStream()is also cleared. It is legal, for instance, to callRequestContext.getWriter(), reset() and thenRequestContext.getOutputStream(). IfRequestContext.getWriter()orRequestContext.getOutputStream()have been called before this method, then the corresponding returned Writer or OutputStream will be staled and the behavior of using the stale object is undefined. If the response has been committed, this method throws anIllegalStateException.- 覆盖:
reset在类中RequestContext
-
sendRedirect
从类复制的说明:RequestContextSends a temporary redirect response to the client using the specified redirect location URL and clears the buffer. The buffer will be replaced with the data set by this method. Calling this method sets the status code to 302 (Found). This method can accept relative URLs;the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root. If the location is relative with two leading '/' the container interprets it as a network-path reference (see RFC 3986: Uniform Resource Identifier (URI): Generic Syntax, section 4.2 "Relative Reference").If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
- 指定者:
sendRedirect在类中RequestContext- 参数:
location- the redirect location URL- 抛出:
IOException- If an input or output exception occurs
-
setStatus
public void setStatus(int sc) 从类复制的说明:RequestContextSets the status code for this response.This method is used to set the return status code when there is no error .
This method preserves any cookies and other response headers.
Valid status codes are those in the 2XX, 3XX, 4XX, and 5XX ranges. Other status codes are treated as container specific.
- 指定者:
setStatus在类中RequestContext- 参数:
sc- the status code
-
setStatus
从类复制的说明:RequestContextSets the status code and message for this response.- 覆盖:
setStatus在类中RequestContext- 参数:
status- the status
-
getStatus
public int getStatus()从类复制的说明:RequestContextGets the current status code of this response.- 指定者:
getStatus在类中RequestContext- 返回:
- the current status code of this response
-
sendError
从类复制的说明:RequestContextSends an error response to the client using the specified status code and clears the buffer. The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid response. If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back the error pageIf the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
- 覆盖:
sendError在类中RequestContext- 参数:
code- the error status code- 抛出:
IOException- If an input or output exception occurs
-
sendError
从类复制的说明:RequestContextSends an error response to the client using the specified status and clears the buffer. The server defaults to creating the response to look like an HTML-formatted server error page containing the specified message, setting the content type to "text/html". The caller is not responsible for escaping or re-encoding the message to ensure it is safe with respect to the current response encoding and content type. This aspect of safety is the responsibility of the container, as it is generating the error page containing the message. The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid response.
If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back in preference to the suggested msg parameter and the msg parameter will be ignored.
If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
- 覆盖:
sendError在类中RequestContext- 参数:
code- the error status codemsg- the descriptive message- 抛出:
IOException- If an input or output exception occurs
-
sendError
从类复制的说明:RequestContextSends an error response to the client using the specified status code and clears the buffer. The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid response. If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back the error pageIf the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
- 指定者:
sendError在类中RequestContext- 参数:
sc- the error status code- 抛出:
IOException- If an input or output exception occurs
-
sendError
从类复制的说明:RequestContextSends an error response to the client using the specified status and clears the buffer. The server defaults to creating the response to look like an HTML-formatted server error page containing the specified message, setting the content type to "text/html". The caller is not responsible for escaping or re-encoding the message to ensure it is safe with respect to the current response encoding and content type. This aspect of safety is the responsibility of the container, as it is generating the error page containing the message. The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid response.
If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back in preference to the suggested msg parameter and the msg parameter will be ignored.
If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
- 指定者:
sendError在类中RequestContext- 参数:
sc- the error status codemsg- the descriptive message- 抛出:
IOException- If an input or output exception occurs
-
getOutputStream
从类复制的说明:RequestContextReturns aOutputStreamsuitable for writing binary data in the response. The Server container does not encode the binary data.Calling flush() on the
OutputStreamcommits the response. Either this method orRequestContext.getWriter()may be called to write the body, not both, except whenRequestContext.reset()has been called.- 指定者:
getOutputStream在接口中cn.taketoday.core.io.OutputStreamSource- 覆盖:
getOutputStream在类中RequestContext- 返回:
- a
OutputStreamfor writing binary data - 抛出:
IOException- if an input or output exception occurred- 另请参阅:
-
doGetOutputStream
从类复制的说明:RequestContexttemplate method for get OutputStream- 指定者:
doGetOutputStream在类中RequestContext- 抛出:
IOException
-
getWriter
从类复制的说明:RequestContextReturns aPrintWriterobject that can send character text to the client. ThePrintWriteruses the UTF-8 character encoding.Calling flush() on the
PrintWritercommits the response.Either this method or
RequestContext.getOutputStream()may be called to write the body, not both, except whenRequestContext.reset()has been called.- 指定者:
getWriter在接口中cn.taketoday.core.io.OutputStreamSource- 覆盖:
getWriter在类中RequestContext- 返回:
- a
PrintWriterobject that can return character data to the client - 抛出:
IOException- if an input or output exception occurred- 另请参阅:
-
doGetWriter
从类复制的说明:RequestContexttemplate method for get writer- 覆盖:
doGetWriter在类中RequestContext- 抛出:
IOException
-
setContentType
从类复制的说明:RequestContextSets the content type of the response being sent to the client, if the response has not been committed yet. The given content type may include a character encoding specification, for example,text/html;charset=UTF-8. The response's character encoding is only set from the given content type if this method is called beforegetWriteris called.This method may be called repeatedly to change content type and character encoding. This method has no effect if called after the response has been committed. It does not set the response's character encoding if it is called after
getWriterhas been called or after the response has been committed.Containers must communicate the content type and the character encoding used for the servlet response's writer to the client if the protocol provides a way for doing so. In the case of HTTP, the
Content-Typeheader is used.- 覆盖:
setContentType在类中RequestContext- 参数:
contentType- aStringspecifying the MIME type of the content
-
setContentType
从类复制的说明:RequestContextSets the content type of the response being sent to the client, if the response has not been committed yet. The given content type may include a character encoding specification, for example,text/html;charset=UTF-8. The response's character encoding is only set from the given content type if this method is called beforegetWriteris called.This method may be called repeatedly to change content type and character encoding. This method has no effect if called after the response has been committed. It does not set the response's character encoding if it is called after
getWriterhas been called or after the response has been committed.Containers must communicate the content type and the character encoding used for the servlet response's writer to the client if the protocol provides a way for doing so. In the case of HTTP, the
Content-Typeheader is used.- 覆盖:
setContentType在类中RequestContext- 参数:
contentType- aStringspecifying the MIME type of the content
-
getResponseContentType
从类复制的说明:RequestContextReturns the content type used for the MIME body sent in this response. The content type proper must have been specified usingRequestContext.setContentType(java.lang.String)before the response is committed. If no content type has been specified, this method returns null.- 覆盖:
getResponseContentType在类中RequestContext- 返回:
- a
Stringspecifying the content type, for example,text/html; charset=UTF-8, or null - 另请参阅:
-
responseHeaders
从类复制的说明:RequestContextGet request HTTP headers- 覆盖:
responseHeaders在类中RequestContext
-
mergeToResponse
从类复制的说明:RequestContextmerge headers to response http-headers- 覆盖:
mergeToResponse在类中RequestContext
-
createResponseHeaders
从类复制的说明:RequestContextcreate a new response http-header- 覆盖:
createResponseHeaders在类中RequestContext
-
asHttpOutputMessage
- 覆盖:
asHttpOutputMessage在类中RequestContext
-
nativeRequest
public <T> T nativeRequest()从类复制的说明:RequestContextNative request eg: HttpServletRequest- 指定者:
nativeRequest在类中RequestContext
-
unwrapRequest
- 指定者:
unwrapRequest在类中RequestContext- 参数:
requestClass- wrapped request class- 返回:
- returns
nullindicated that not a requestClass
-
getMatchingMetadata
- 覆盖:
getMatchingMetadata在类中RequestContext
-
setMatchingMetadata
- 覆盖:
setMatchingMetadata在类中RequestContext
-
hasMatchingMetadata
public boolean hasMatchingMetadata()- 覆盖:
hasMatchingMetadata在类中RequestContext
-
getAttribute
- 指定者:
getAttribute在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
getAttribute在类中cn.taketoday.core.AttributeAccessorSupport
-
setAttribute
- 指定者:
setAttribute在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
setAttribute在类中cn.taketoday.core.AttributeAccessorSupport
-
removeAttribute
- 指定者:
removeAttribute在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
removeAttribute在类中cn.taketoday.core.AttributeAccessorSupport
-
clearAttributes
public void clearAttributes()- 指定者:
clearAttributes在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
clearAttributes在类中cn.taketoday.core.AttributeAccessorSupport
-
getAttributeNames
- 指定者:
getAttributeNames在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
getAttributeNames在类中cn.taketoday.core.AttributeAccessorSupport
-
writeHeaders
public void writeHeaders()从类复制的说明:RequestContextwrite headers to response- 覆盖:
writeHeaders在类中RequestContext
-
flush
从类复制的说明:RequestContextForces 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. Ensure that the headers and the content of the response are written out.After the first flush, headers can no longer be changed. Only further content writing and content flushing is possible.
- 覆盖:
flush在类中RequestContext- 抛出:
IOException- if the act of flushing the buffer cannot be completed.- 另请参阅:
-
requestCompleted
public void requestCompleted()从类复制的说明:RequestContextSignal that the request has been completed.Executes all request destruction callbacks and other resources cleanup
- 覆盖:
requestCompleted在类中RequestContext
-
requestCompleted
从类复制的说明:RequestContextSignal that the request has been completed.Executes all request destruction callbacks and other resources cleanup
- 覆盖:
requestCompleted在类中RequestContext- 参数:
notHandled- exception not handled
-
createMultipartRequest
从类复制的说明:RequestContextcreate MultipartRequest- 指定者:
createMultipartRequest在类中RequestContext
-
createAsyncWebRequest
- 指定者:
createAsyncWebRequest在类中RequestContext
-
getAsyncWebRequest
- 覆盖:
getAsyncWebRequest在类中RequestContext
-
isConcurrentHandlingStarted
public boolean isConcurrentHandlingStarted()从类复制的说明:RequestContextWhether the selected handler for the current request chose to handle the request asynchronously. A return value of "true" indicates concurrent handling is under way and the response will remain open. A return value of "false" means concurrent handling was either not started or possibly that it has completed and the request was dispatched for further processing of the concurrent result. -
getMultipartRequest
- 覆盖:
getMultipartRequest在类中RequestContext- 另请参阅:
-
setBinding
- 覆盖:
setBinding在类中RequestContext
-
getBinding
- 覆盖:
getBinding在类中RequestContext
-
binding
- 覆盖:
binding在类中RequestContext
-
hasBinding
public boolean hasBinding()- 覆盖:
hasBinding在类中RequestContext
-
getInputRedirectModel
从类复制的说明:RequestContextReturn read-only "input" flash attributes from request before redirect.- 覆盖:
getInputRedirectModel在类中RequestContext- 返回:
- a RedirectModel, or
nullif not found - 另请参阅:
-
getInputRedirectModel
从类复制的说明:RequestContextReturn read-only "input" flash attributes from request before redirect.- 覆盖:
getInputRedirectModel在类中RequestContext- 参数:
manager- RedirectModelManager manage RedirectModel- 返回:
- a RedirectModel, or
nullif not found - 另请参阅:
-
computeAttribute
- 指定者:
computeAttribute在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
computeAttribute在类中cn.taketoday.core.AttributeAccessorSupport
-
hasAttribute
- 指定者:
hasAttribute在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
hasAttribute在类中cn.taketoday.core.AttributeAccessorSupport
-
attributeNames
- 指定者:
attributeNames在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
attributeNames在类中cn.taketoday.core.AttributeAccessorSupport
-
copyAttributesFrom
public void copyAttributesFrom(cn.taketoday.core.AttributeAccessor source) - 指定者:
copyAttributesFrom在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
copyAttributesFrom在类中cn.taketoday.core.AttributeAccessorSupport
-
hasAttributes
public boolean hasAttributes()- 指定者:
hasAttributes在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
hasAttributes在类中cn.taketoday.core.AttributeAccessorSupport
-
getAttributes
- 指定者:
getAttributes在接口中cn.taketoday.core.AttributeAccessor- 覆盖:
getAttributes在类中cn.taketoday.core.AttributeAccessorSupport
-
getMethod
从接口复制的说明:HttpRequestReturn the HTTP method of the request.- 指定者:
getMethod在接口中HttpRequest- 覆盖:
getMethod在类中RequestContext- 返回:
- the HTTP method as an HttpMethod value
- 另请参阅:
-
getMethodValue
从类复制的说明:RequestContextReturns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- 指定者:
getMethodValue在接口中HttpRequest- 覆盖:
getMethodValue在类中RequestContext- 返回:
- a
Stringspecifying the name of the method with which this request was made - 另请参阅:
-
matchingMetadata
- 覆盖:
matchingMetadata在类中RequestContext
-
getAsyncManager
- 覆盖:
getAsyncManager在类中RequestContext
-
setWebAsyncManagerFactory
-
postRequestCompleted
- 覆盖:
postRequestCompleted在类中RequestContext
-
doGetRequestPath
- 覆盖:
doGetRequestPath在类中RequestContext
-
getDelegate
-
equals
- 覆盖:
equals在类中cn.taketoday.core.AttributeAccessorSupport
-
hashCode
public int hashCode()- 覆盖:
hashCode在类中cn.taketoday.core.AttributeAccessorSupport
-
toString
- 覆盖:
toString在类中RequestContext
-