Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2014-12-04 11:35:58 +0000
committerJan Bartel2014-12-04 11:35:58 +0000
commit7fa276b7ec0280626ef18f6e5b2f9407a24e38cc (patch)
treecf071ea162549a6f95239989a2c7bd165c0c88d2
parentdd6ab368673985997c73e5ecfbf85e176e7bd205 (diff)
downloadorg.eclipse.jetty.project-7fa276b7ec0280626ef18f6e5b2f9407a24e38cc.tar.gz
org.eclipse.jetty.project-7fa276b7ec0280626ef18f6e5b2f9407a24e38cc.tar.xz
org.eclipse.jetty.project-7fa276b7ec0280626ef18f6e5b2f9407a24e38cc.zip
452261 Ensure <jsp-file> works with new JettyJspServlet
-rw-r--r--apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java36
-rw-r--r--jetty-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java27
2 files changed, 39 insertions, 24 deletions
diff --git a/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java b/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java
index abe8d217c8..4be7ab565b 100644
--- a/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java
+++ b/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java
@@ -44,11 +44,13 @@ public class JettyJspServlet extends JspServlet
*/
private static final long serialVersionUID = -5387857473125086791L;
+
+
+
+
@Override
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
-
-
HttpServletRequest request = null;
if (req instanceof HttpServletRequest)
request = (HttpServletRequest)req;
@@ -74,23 +76,31 @@ public class JettyJspServlet extends JspServlet
}
String pathInContext = URIUtil.addPaths(servletPath,pathInfo);
-
- if (pathInContext.endsWith("/"))
+
+ String jspFile = getInitParameter("jspFile");
+
+ //if this is a forced-path from a jsp-file, we want the jsp servlet to handle it,
+ //otherwise the default servlet might handle it
+ if (jspFile == null)
{
- //dispatch via forward to the default servlet
- getServletContext().getNamedDispatcher("default").forward(req, resp);
- return;
- }
- else
- {
- //check if it resolves to a directory
- Resource resource = ((ContextHandler.Context)getServletContext()).getContextHandler().getResource(pathInContext);
- if (resource!=null && resource.isDirectory())
+ if (pathInContext.endsWith("/"))
{
//dispatch via forward to the default servlet
getServletContext().getNamedDispatcher("default").forward(req, resp);
return;
}
+ else
+ {
+ //check if it resolves to a directory
+ Resource resource = ((ContextHandler.Context)getServletContext()).getContextHandler().getResource(pathInContext);
+
+ if (resource!=null && resource.isDirectory())
+ {
+ //dispatch via forward to the default servlet
+ getServletContext().getNamedDispatcher("default").forward(req, resp);
+ return;
+ }
+ }
}
//fall through to the normal jsp servlet handling
diff --git a/jetty-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java b/jetty-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java
index db7fe085b2..8066ee6285 100644
--- a/jetty-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java
+++ b/jetty-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java
@@ -75,25 +75,30 @@ public class JettyJspServlet extends JspServlet
}
String pathInContext = URIUtil.addPaths(servletPath,pathInfo);
+ String jspFile = getInitParameter("jspFile");
- if (pathInContext.endsWith("/"))
+ //if the request is for a jsp file then fall through to the jsp servlet
+ if (jspFile == null)
{
- //dispatch via forward to the default servlet
- getServletContext().getNamedDispatcher("default").forward(req, resp);
- return;
- }
- else
- {
- //check if it resolves to a directory
- Resource resource = ((ContextHandler.Context)getServletContext()).getContextHandler().getResource(pathInContext);
- if (resource!=null && resource.isDirectory())
+ if (pathInContext.endsWith("/"))
{
//dispatch via forward to the default servlet
getServletContext().getNamedDispatcher("default").forward(req, resp);
return;
}
+ else
+ {
+ //check if it resolves to a directory
+ Resource resource = ((ContextHandler.Context)getServletContext()).getContextHandler().getResource(pathInContext);
+ if (resource!=null && resource.isDirectory())
+ {
+ //dispatch via forward to the default servlet
+ getServletContext().getNamedDispatcher("default").forward(req, resp);
+ return;
+ }
+ }
}
-
+
//fall through to the normal jsp servlet handling
super.service(req, resp);
}

Back to the top