changes from review #9193
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
ba58c40ad8
commit
475438796c
|
@ -359,10 +359,11 @@ public class DefaultServlet extends HttpServlet
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
|
||||||
{
|
{
|
||||||
boolean included = isIncluded(req);
|
String includedServletPath = (String)req.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
|
||||||
|
boolean included = includedServletPath != null;
|
||||||
String pathInContext;
|
String pathInContext;
|
||||||
if (included)
|
if (included)
|
||||||
pathInContext = getIncludedPathInContext(req, isPathInfoOnly());
|
pathInContext = getIncludedPathInContext(req, includedServletPath, isPathInfoOnly());
|
||||||
else
|
else
|
||||||
pathInContext = URIUtil.addPaths(isPathInfoOnly() ? "/" : req.getServletPath(), req.getPathInfo());
|
pathInContext = URIUtil.addPaths(isPathInfoOnly() ? "/" : req.getServletPath(), req.getPathInfo());
|
||||||
|
|
||||||
|
@ -477,10 +478,12 @@ public class DefaultServlet extends HttpServlet
|
||||||
}
|
}
|
||||||
|
|
||||||
_httpFields = fields.asImmutable();
|
_httpFields = fields.asImmutable();
|
||||||
|
String includedServletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
|
||||||
|
boolean included = includedServletPath != null;
|
||||||
if (request.getDispatcherType() == DispatcherType.REQUEST)
|
if (request.getDispatcherType() == DispatcherType.REQUEST)
|
||||||
_uri = getWrapped().getHttpURI();
|
_uri = getWrapped().getHttpURI();
|
||||||
else if (isIncluded(request))
|
else if (included)
|
||||||
_uri = Request.newHttpURIFrom(getWrapped(), getIncludedPathInContext(request, false));
|
_uri = Request.newHttpURIFrom(getWrapped(), getIncludedPathInContext(request, includedServletPath, false));
|
||||||
else
|
else
|
||||||
_uri = Request.newHttpURIFrom(getWrapped(), URIUtil.addPaths(_servletRequest.getServletPath(), _servletRequest.getPathInfo()));
|
_uri = Request.newHttpURIFrom(getWrapped(), URIUtil.addPaths(_servletRequest.getServletPath(), _servletRequest.getPathInfo()));
|
||||||
}
|
}
|
||||||
|
@ -920,8 +923,10 @@ public class DefaultServlet extends HttpServlet
|
||||||
HttpServletRequest request = getServletRequest(coreRequest);
|
HttpServletRequest request = getServletRequest(coreRequest);
|
||||||
String pathInContext = Request.getPathInContext(coreRequest);
|
String pathInContext = Request.getPathInContext(coreRequest);
|
||||||
String requestTarget;
|
String requestTarget;
|
||||||
if (isIncluded(request))
|
String includedServletPath = (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
|
||||||
requestTarget = getIncludedPathInContext(request, isPathInfoOnly());
|
boolean included = includedServletPath != null;
|
||||||
|
if (included)
|
||||||
|
requestTarget = getIncludedPathInContext(request, includedServletPath, isPathInfoOnly());
|
||||||
else
|
else
|
||||||
requestTarget = isPathInfoOnly() ? request.getPathInfo() : pathInContext;
|
requestTarget = isPathInfoOnly() ? request.getPathInfo() : pathInContext;
|
||||||
|
|
||||||
|
@ -1079,9 +1084,9 @@ public class DefaultServlet extends HttpServlet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getIncludedPathInContext(HttpServletRequest request, boolean isPathInfoOnly)
|
private static String getIncludedPathInContext(HttpServletRequest request, String includedServletPath, boolean isPathInfoOnly)
|
||||||
{
|
{
|
||||||
String servletPath = isPathInfoOnly ? "/" : (String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
|
String servletPath = isPathInfoOnly ? "/" : includedServletPath;
|
||||||
String pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
|
String pathInfo = (String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
|
||||||
if (servletPath == null)
|
if (servletPath == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,6 @@ import org.eclipse.jetty.server.HttpConfiguration;
|
||||||
import org.eclipse.jetty.server.LocalConnector;
|
import org.eclipse.jetty.server.LocalConnector;
|
||||||
import org.eclipse.jetty.server.ResourceService;
|
import org.eclipse.jetty.server.ResourceService;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.ServerConnector;
|
|
||||||
import org.eclipse.jetty.server.SymlinkAllowedResourceAliasChecker;
|
import org.eclipse.jetty.server.SymlinkAllowedResourceAliasChecker;
|
||||||
import org.eclipse.jetty.toolchain.test.FS;
|
import org.eclipse.jetty.toolchain.test.FS;
|
||||||
import org.eclipse.jetty.toolchain.test.MavenPaths;
|
import org.eclipse.jetty.toolchain.test.MavenPaths;
|
||||||
|
@ -114,12 +113,6 @@ public class DefaultServletTest
|
||||||
|
|
||||||
connector = new LocalConnector(server);
|
connector = new LocalConnector(server);
|
||||||
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
|
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
|
||||||
|
|
||||||
ServerConnector serverConnector = new ServerConnector(server);
|
|
||||||
serverConnector.setPort(8080);
|
|
||||||
serverConnector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
|
|
||||||
server.addConnector(serverConnector);
|
|
||||||
|
|
||||||
Path extraJarResources = MavenPaths.findTestResourceFile(ODD_JAR);
|
Path extraJarResources = MavenPaths.findTestResourceFile(ODD_JAR);
|
||||||
URL[] urls = new URL[]{extraJarResources.toUri().toURL()};
|
URL[] urls = new URL[]{extraJarResources.toUri().toURL()};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue