Hi,
On Fri, Jun 6, 2014 at 7:28 PM, Stuart Douglas <stuart.w.douglas(a)gmail.com>
wrote:
> "The container may send the request to the welcome resource with a
> forward, a redirect, or a container specific mechanism that is
> indistinguishable from a direct request."
>
It was because of this that I decided to do a full rewrite, which comes
under the 'indistinguishable from a direct request' part.
I can understand that. It's a troublesome section and it makes it very hard
to support welcome pages in a universal way (to have an application that
directly runs on multiple containers). A forward in the Servlet spec is
really a different kind of request with respect to filters etc.
However, the JavaDoc for HttpServletRequest#getRequestURI doesn't
seem
> to allow this.
>
What makes you say that?
It's more of an interpretation, but the JavaDoc seems to say that it
returns the request as it was done by the client. This information is
important, since if internal rewrites take place you need this information
to render (postback) links that don't expose the name of the rewritten
resource. getServletPath() seems to leave a little bit of room to allow it
to point to a rewritten resource, as it talks more about the Servlet that
is invoked.
But I realize that my interpretation is subjective.
In general I have been trying to match jboss web's functionality
for under
> specified behaviour such as this.
>
If you file a JIRA I will look at changing it in 1.1.
Sure! Thanks in advance.
Btw, after some fiddling I found that with a handler containing the
following code the JBossWeb behavior can be restored:
public class RequestURIHandler implements HttpHandler {
private HttpHandler next;
public RequestURIHandler(HttpHandler next) {
this.next = next;
}
@Override
public void handleRequest(final HttpServerExchange exchange) throws
Exception {
String requestURI = exchange.getRequestURI();
next.handleRequest(exchange);
exchange.setRequestURI(requestURI);
}
}
Which I then register as an initialHandler:
public class UndertowHandlerExtension implements ServletExtension {
@Override
public void handleDeployment(final DeploymentInfo deploymentInfo, final
ServletContext servletContext) {
deploymentInfo.addInitialHandlerChainWrapper(handler -> new
RequestURIHandler(handler));
}
}
This seems to work. Is this a correct way?
Kind regards,
Arjan