public final class WebResourceUtil extends Object
WebResourceContainer and give utility methods to process
WebResource requests.| Modifier and Type | Method and Description |
|---|---|
static void |
findWebResourceAndWriteResponse(WebResourceContainer webResourceContainer,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Finds the
WebResource based on the pathInfo and writes it to the output stream of the
response. |
static Collection<WebResourceURIGenerator> |
getUriGeneratorsOfServletContext(javax.servlet.ServletContext servletContext)
Retrieves the
WebResourceURIGenerator queue from the specified ServletContext
or if it is not registered yet, registers an empty one. |
static void |
writeWebResourceToResponse(WebResource webResource,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Writes a
WebResource to the response stream, asynchronously if it is supported. |
public static void findWebResourceAndWriteResponse(WebResourceContainer webResourceContainer, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
WebResource based on the pathInfo and writes it to the output stream of the
response. If the WebResource is not found, HTTP 404 is thrown.webResourceContainer - The container that is used to find the webResource.req - The Servlet request.resp - The Servlet Response which headers will be set and if the request is a GET request,
the WebResource will be written to the OutputStream of the response.IOException - if the content of the WebResource cannot be written to the output stream.public static Collection<WebResourceURIGenerator> getUriGeneratorsOfServletContext(javax.servlet.ServletContext servletContext)
WebResourceURIGenerator queue from the specified ServletContext
or if it is not registered yet, registers an empty one.Collection of WebResourceURIGenerators that are registered in the
ServletContext. The collection can be modified by the caller concurrently and
the changes will be applied within the ServletContext.public static void writeWebResourceToResponse(WebResource webResource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
WebResource to the response stream, asynchronously if it is supported.webResource - An optional WebResource. In case the WebResource is not provided, 404 error
code will be sent to the response.req - The http request that can tell if async is supported or not. The function also handles
if this is a HEAD request.resp - The response that will be used to write the content of the webResource.IOException - If there is an issue during reading the content of the WebResource or writing
to the response stream.NullPointerException - if any of the parameters is null.Copyright © 2011–2015 Everit Kft.. All rights reserved.