[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] [servlet] ProxyServlet handling of paths with extensions

In ProxyServlet.processAlias, when an alias is passed with an extension, the
following code executes:

    registration = (Registration) registrations.get(alias + extensionAlias);
    if (registration != null) // extensions should be handled on the full
alias
        alias = HttpServletRequestAdaptor.getDispatchPathInfo(req);
    else
        registration = (Registration) registrations.get(alias);

Now, if the registration is not null, then this code sets the alias to the
entire request path. However, the following code in
ResourceRegistration.handleRequest subsequently fails:

    String pathInfo = HttpServletRequestAdaptor.getDispatchPathInfo(req);
    int aliasLength = alias.equals("/") ? 0 : alias.length(); //$NON-NLS-1$
    String resourcePath = internalName + pathInfo.substring(aliasLength);
    URL testURL = httpContext.getResource(resourcePath);

because pathInfo has the same value as alias, so
pathInfo.substring(aliasLength) always results in a resourcePath of
internalName.

The following patch fixes all of my use cases:

http://pastebin.ca/582438

Cheers,
Raman Gupta

-- 
View this message in context: http://www.nabble.com/-servlet--ProxyServlet-handling-of-paths-with-extensions-tf3962018.html#a11243866
Sent from the Equinox - Dev mailing list archive at Nabble.com.