io.undertow.server.HttpHandler#handleRequest(io.undertow.server.HttpServerExchange) method,
otherwise the request is handled as a normal servlet request.
By default we only allow a restricted set of extensions.
Todo
this thing needs a lot more work. In particular: - caching for blocking requests - correct mime type - range/last-modified and other headers to be handled properly - head requests - and probably heaps of other things
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| private Set | |
| public static final String | |
| private boolean | |
| public static final String | |
| private static final Set | |
| private boolean | |
| private Deployment | |
| public static final String | |
| private boolean | |
| private Set | |
| public static final String | |
| public static final String | |
| private boolean | |
| private ResourceSupplier |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private IoCallback | |
| protected void | doDelete(HttpServletRequest
the req, HttpServletResponse HttpServletRequest object that contains the request the client made of the servletthe resp)HttpServletResponse object that contains the response the servlet returns to the clientOverrides jakarta. Called by the server (via the |
| protected void | doGet(final HttpServletRequest
an req, final HttpServletResponse HttpServletRequest object that contains the request the client has made of the servletan resp)HttpServletResponse object that contains the response the servlet sends to the clientOverrides jakarta. Called by the server (via the |
| protected void | doOptions(HttpServletRequest
the req, HttpServletResponse HttpServletRequest object that contains the request the client made of the servletthe resp)HttpServletResponse object that contains the response the servlet returns to the clientOverrides jakarta. Called by the server (via the |
| protected void | doPost(HttpServletRequest
an req, HttpServletResponse HttpServletRequest object that contains the request the client has made of the servletan resp)HttpServletResponse object that contains the response the servlet sends to the clientOverrides jakarta. Called by the server (via the |
| protected void | doPut(HttpServletRequest
the req, HttpServletResponse HttpServletRequest object that contains the request the client made of the servletthe resp)HttpServletResponse object that contains the response the servlet returns to the clientOverrides jakarta. Called by the server (via the |
| protected void | doTrace(HttpServletRequest
the req, HttpServletResponse HttpServletRequest object that contains the request the client made of the servletthe resp)HttpServletResponse object that contains the response the servlet returns to the clientOverrides jakarta. Called by the server (via the |
| private String | |
| public void | init(ServletConfig
the config)ServletConfig object that contains configuration information for this servletOverrides jakarta. Implements jakarta. Called by the servlet container to indicate to a servlet that the servlet is being placed into service. |
| private boolean | |
| private void | serveFileBlocking(final HttpServletRequest req, final HttpServletResponse resp, final Resource resource, HttpServerExchange exchange)
|
| ALLOW_POST | back to summary |
|---|---|
| public static final String ALLOW_POST | |
| allowed | back to summary |
|---|---|
| private Set<String> allowed | |
| ALLOWED_EXTENSIONS | back to summary |
|---|---|
| public static final String ALLOWED_EXTENSIONS | |
| allowPost | back to summary |
|---|---|
| private boolean allowPost | |
| DEFAULT_ALLOWED | back to summary |
|---|---|
| public static final String DEFAULT_ALLOWED | |
| DEFAULT_ALLOWED_EXTENSIONS | back to summary |
|---|---|
| private static final Set<String> DEFAULT_ALLOWED_EXTENSIONS | |
| defaultAllowed | back to summary |
|---|---|
| private boolean defaultAllowed | |
| deployment | back to summary |
|---|---|
| private Deployment deployment | |
| DIRECTORY_LISTING | back to summary |
|---|---|
| public static final String DIRECTORY_LISTING | |
| directoryListingEnabled | back to summary |
|---|---|
| private boolean directoryListingEnabled | |
| disallowed | back to summary |
|---|---|
| private Set<String> disallowed | |
| DISALLOWED_EXTENSIONS | back to summary |
|---|---|
| public static final String DISALLOWED_EXTENSIONS | |
| RESOLVE_AGAINST_CONTEXT_ROOT | back to summary |
|---|---|
| public static final String RESOLVE_AGAINST_CONTEXT_ROOT | |
| resolveAgainstContextRoot | back to summary |
|---|---|
| private boolean resolveAgainstContextRoot | |
| resourceSupplier | back to summary |
|---|---|
| private ResourceSupplier resourceSupplier | |
| DefaultServlet | back to summary |
|---|---|
| public DefaultServlet() | |
| completionCallback | back to summary |
|---|---|
| private IoCallback completionCallback(final boolean include) | |
| doDelete | back to summary |
|---|---|
| protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Overrides jakarta. Doc from jakarta. Called by the server (via the This method does not need to be either safe or idempotent. Operations requested through DELETE can have side effects for which users can be held accountable. When using this method, it may be useful to save a copy of the affected URL in temporary storage.
If the HTTP DELETE request is incorrectly formatted,
| |
| doGet | back to summary |
|---|---|
| protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException Overrides jakarta. Doc from jakarta. Called by the server (via the Overriding this method to support a GET request also automatically supports an HTTP HEAD request. A HEAD request is a GET request that returns no body in the response, only the request header fields.
When overriding this method, read the request data, write the response headers, get the response's writer or output
stream object, and finally, write the response data. It's best to include content type and encoding. When using a
The servlet container must write the headers before committing the response, because in HTTP the headers must be sent before the response body.
Where possible, set the Content-Length header (with the When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set the Content-Length header. The GET method should be safe, that is, without any side effects for which users are held responsible. For example, most form queries have no side effects. If a client request is intended to change stored data, the request should use some other HTTP method. The GET method should also be idempotent, meaning that it can be safely repeated. Sometimes making a method safe also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product online or modifying data is neither safe nor idempotent.
If the request is incorrectly formatted,
| |
| doOptions | back to summary |
|---|---|
| protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Overrides jakarta. Doc from jakarta. Called by the server (via the
There's no need to override this method unless the servlet implements new HTTP methods, beyond those implemented by HTTP 1.1.
| |
| doPost | back to summary |
|---|---|
| protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Overrides jakarta. Doc from jakarta. Called by the server (via the
When overriding this method, read the request data, write the response headers, get the response's writer or output
stream object, and finally, write the response data. It's best to include content type and encoding. When using a
The servlet container must write the headers before committing the response, because in HTTP the headers must be sent before the response body.
Where possible, set the Content-Length header (with the When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set the Content-Length header. This method does not need to be either safe or idempotent. Operations requested through POST can have side effects for which the user can be held accountable, for example, updating stored data or buying items online.
If the HTTP POST request is incorrectly formatted,
| |
| doPut | back to summary |
|---|---|
| protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Overrides jakarta. Doc from jakarta. Called by the server (via the When overriding this method, leave intact any content headers sent with the request (including Content-Length, Content-Type, Content-Transfer-Encoding, Content-Encoding, Content-Base, Content-Language, Content-Location, Content-MD5, and Content-Range). If your method cannot handle a content header, it must issue an error message (HTTP 501 - Not Implemented) and discard the request. For more information on HTTP 1.1 and the PUT method, see RFC 7231 .
This method does not need to be either safe or idempotent. Operations that
If the HTTP PUT request is incorrectly formatted,
| |
| doTrace | back to summary |
|---|---|
| protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Overrides jakarta. Doc from jakarta. Called by the server (via the
| |
| getPath | back to summary |
|---|---|
| private String getPath(final HttpServletRequest request) | |
| init | back to summary |
|---|---|
| public void init(ServletConfig config) throws ServletException Overrides jakarta. Implements jakarta. Doc from jakarta. Called by the servlet container to indicate to a servlet that the servlet is being placed into service. See
This implementation stores the
| |
| isAllowed | back to summary |
|---|---|
| private boolean isAllowed(String path, DispatcherType dispatcherType) | |
| serveFileBlocking | back to summary |
|---|---|
| private void serveFileBlocking(final HttpServletRequest req, final HttpServletResponse resp, final Resource resource, HttpServerExchange exchange) throws IOException | |