Merge branch 'master' into jetty-9.4.x-Feature

This commit is contained in:
Greg Wilkins 2016-02-16 16:09:38 +01:00
commit 89803aec95
13 changed files with 162 additions and 145 deletions

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.jsp;
import java.io.IOException; import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -59,10 +60,10 @@ public class JettyJspServlet extends JspServlet
String servletPath=null; String servletPath=null;
String pathInfo=null; String pathInfo=null;
if (request.getAttribute("javax.servlet.include.request_uri")!=null) if (request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI)!=null)
{ {
servletPath=(String)request.getAttribute("javax.servlet.include.servlet_path"); servletPath=(String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
pathInfo=(String)request.getAttribute("javax.servlet.include.path_info"); pathInfo=(String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
if (servletPath==null) if (servletPath==null)
{ {
servletPath=request.getServletPath(); servletPath=request.getServletPath();

View File

@ -13,12 +13,15 @@
<Ref refid="Server"/> <Ref refid="Server"/>
</Arg> </Arg>
<Set name="workerName"><Property name="jetty.jdbcSession.workerName" default="node1"/></Set> <Set name="workerName"><Property name="jetty.jdbcSession.workerName" default="node1"/></Set>
<Set name="scavengeInterval"><Property name="jetty.jdbcSession.scavenge" default="1800"/></Set> <Set name="sessionScavenger">
<New class="org.eclipse.jetty.server.session.SessionScavenger">
<Set name="scavengeIntervalSec"><Property name="jetty.jdbcSession.scavenge" default="1800"/></Set>
</New>
</Set>
<!-- ===================================================================== --> <!-- ===================================================================== -->
<!-- Uncomment either the datasource or driver setup and configure --> <!-- Uncomment either the datasource or driver setup and configure -->
<!-- ===================================================================== --> <!-- ===================================================================== -->
<Get name="databaseAdaptor">
<!-- <!--
<Set name="DatasourceName"><Property name="jetty.jdbcSession.datasource" default="javax.sql.DataSource/default"/></Set> <Set name="DatasourceName"><Property name="jetty.jdbcSession.datasource" default="javax.sql.DataSource/default"/></Set>
--> -->
@ -28,6 +31,7 @@
<Arg><Property name="jetty.jdbcSession.connectionURL"/></Arg> <Arg><Property name="jetty.jdbcSession.connectionURL"/></Arg>
</Call> </Call>
--> -->
</Get>
</New> </New>
</Set> </Set>

View File

@ -25,6 +25,7 @@ import java.io.Writer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -34,9 +35,7 @@ import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.server.AsyncContextEvent;
import org.eclipse.jetty.server.Dispatcher; import org.eclipse.jetty.server.Dispatcher;
import org.eclipse.jetty.server.HttpOutput;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
@ -46,23 +45,27 @@ import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
/** /* ------------------------------------------------------------ */
* <p>Component that handles Error Pages.</p> /** Handler for Error pages
* <p>An ErrorHandler is registered with {@link ContextHandler#setErrorHandler(ErrorHandler)} or * An ErrorHandler is registered with {@link ContextHandler#setErrorHandler(ErrorHandler)} or
* {@link org.eclipse.jetty.server.Server#addBean(Object)}.</p> * {@link org.eclipse.jetty.server.Server#addBean(Object)}.
* <p>It is called by {@link HttpServletResponse#sendError(int)} to write an error page via * It is called by the HttpResponse.sendError method to write a error page via {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)}
* {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} * or via {@link #badMessageError(int, String, HttpFields)} for bad requests for which a dispatch cannot be done.
* or via {@link #badMessageError(int, String, HttpFields)} for bad requests for which a *
* dispatch cannot be done.</p>
*/ */
public class ErrorHandler extends AbstractHandler public class ErrorHandler extends AbstractHandler
{ {
private static final Logger LOG = Log.getLogger(ErrorHandler.class); private static final Logger LOG = Log.getLogger(ErrorHandler.class);
public final static String ERROR_PAGE="org.eclipse.jetty.server.error_page";
private boolean _showStacks = true; boolean _showStacks=true;
private boolean _showMessageInTitle = true; boolean _showMessageInTitle=true;
private String _cacheControl = "must-revalidate,no-cache,no-store"; String _cacheControl="must-revalidate,no-cache,no-store";
/* ------------------------------------------------------------ */
/*
* @see org.eclipse.jetty.server.server.Handler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int)
*/
@Override @Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
{ {
@ -75,28 +78,28 @@ public class ErrorHandler extends AbstractHandler
if (this instanceof ErrorPageMapper) if (this instanceof ErrorPageMapper)
{ {
String error_page = ((ErrorPageMapper)this).getErrorPage(request); String error_page=((ErrorPageMapper)this).getErrorPage(request);
if (error_page!=null && request.getServletContext()!=null)
ServletContext context = request.getServletContext();
if (context == null)
{ {
AsyncContextEvent event = baseRequest.getHttpChannelState().getAsyncContextEvent(); String old_error_page=(String)request.getAttribute(ERROR_PAGE);
context = event == null ? null : event.getServletContext(); if (old_error_page==null || !old_error_page.equals(error_page))
}
if (error_page != null && context != null)
{
Dispatcher dispatcher = (Dispatcher)context.getRequestDispatcher(error_page);
if (dispatcher != null)
{ {
request.setAttribute(ERROR_PAGE, error_page);
Dispatcher dispatcher = (Dispatcher) request.getServletContext().getRequestDispatcher(error_page);
try try
{ {
dispatcher.error(request, response); if(dispatcher!=null)
return; {
dispatcher.error(request, response);
return;
}
LOG.warn("No error page "+error_page);
} }
catch (ServletException x) catch (ServletException e)
{ {
throw new IOException(x); LOG.warn(Log.EXCEPTION, e);
return;
} }
} }
} else { } else {
@ -104,124 +107,112 @@ public class ErrorHandler extends AbstractHandler
{ {
LOG.debug("No Error Page mapping for request({} {}) (using default)",request.getMethod(),request.getRequestURI()); LOG.debug("No Error Page mapping for request({} {}) (using default)",request.getMethod(),request.getRequestURI());
} }
else
{
LOG.warn("Could not dispatch to error page: {}", error_page);
// Fall through to provide the default error page.
}
} }
} }
baseRequest.setHandled(true); baseRequest.setHandled(true);
response.setContentType(MimeTypes.Type.TEXT_HTML_8859_1.asString());
HttpOutput out = baseRequest.getResponse().getHttpOutput(); if (_cacheControl!=null)
if (!out.isAsync()) response.setHeader(HttpHeader.CACHE_CONTROL.asString(), _cacheControl);
{ ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(4096);
response.setContentType(MimeTypes.Type.TEXT_HTML_8859_1.asString()); String reason=(response instanceof Response)?((Response)response).getReason():null;
String cacheHeader = getCacheControl(); handleErrorPage(request, writer, response.getStatus(), reason);
if (cacheHeader != null) writer.flush();
response.setHeader(HttpHeader.CACHE_CONTROL.asString(), cacheHeader); response.setContentLength(writer.size());
ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(4096); writer.writeTo(response.getOutputStream());
String reason = (response instanceof Response) ? ((Response)response).getReason() : null; writer.destroy();
handleErrorPage(request, writer, response.getStatus(), reason);
writer.flush();
response.setContentLength(writer.size());
writer.writeTo(response.getOutputStream());
writer.destroy();
}
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message)
throws IOException throws IOException
{ {
writeErrorPage(request, writer, code, message, isShowStacks()); writeErrorPage(request, writer, code, message, _showStacks);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
throws IOException throws IOException
{ {
if (message == null) if (message == null)
message = HttpStatus.getMessage(code); message=HttpStatus.getMessage(code);
writer.write("<html>\n<head>\n"); writer.write("<html>\n<head>\n");
writeErrorPageHead(request, writer, code, message); writeErrorPageHead(request,writer,code,message);
writer.write("</head>\n<body>"); writer.write("</head>\n<body>");
writeErrorPageBody(request, writer, code, message, showStacks); writeErrorPageBody(request,writer,code,message,showStacks);
writer.write("\n</body>\n</html>\n"); writer.write("\n</body>\n</html>\n");
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void writeErrorPageHead(HttpServletRequest request, Writer writer, int code, String message) protected void writeErrorPageHead(HttpServletRequest request, Writer writer, int code, String message)
throws IOException throws IOException
{ {
writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n"); writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n");
writer.write("<title>Error "); writer.write("<title>Error ");
writer.write(Integer.toString(code)); writer.write(Integer.toString(code));
if (getShowMessageInTitle()) if (_showMessageInTitle)
{ {
writer.write(' '); writer.write(' ');
write(writer, message); write(writer,message);
} }
writer.write("</title>\n"); writer.write("</title>\n");
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
throws IOException throws IOException
{ {
String uri = request.getRequestURI(); String uri= request.getRequestURI();
writeErrorPageMessage(request, writer, code, message, uri); writeErrorPageMessage(request,writer,code,message,uri);
if (showStacks) if (showStacks)
writeErrorPageStacks(request, writer); writeErrorPageStacks(request,writer);
Request.getBaseRequest(request).getHttpChannel().getHttpConfiguration() Request.getBaseRequest(request).getHttpChannel().getHttpConfiguration()
.writePoweredBy(writer, "<hr>", "<hr/>\n"); .writePoweredBy(writer,"<hr>","<hr/>\n");
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void writeErrorPageMessage(HttpServletRequest request, Writer writer, int code, String message, String uri) protected void writeErrorPageMessage(HttpServletRequest request, Writer writer, int code, String message,String uri)
throws IOException throws IOException
{ {
writer.write("<h2>HTTP ERROR "); writer.write("<h2>HTTP ERROR ");
writer.write(Integer.toString(code)); writer.write(Integer.toString(code));
writer.write("</h2>\n<p>Problem accessing "); writer.write("</h2>\n<p>Problem accessing ");
write(writer, uri); write(writer,uri);
writer.write(". Reason:\n<pre> "); writer.write(". Reason:\n<pre> ");
write(writer, message); write(writer,message);
writer.write("</pre></p>"); writer.write("</pre></p>");
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void writeErrorPageStacks(HttpServletRequest request, Writer writer) protected void writeErrorPageStacks(HttpServletRequest request, Writer writer)
throws IOException throws IOException
{ {
Throwable th = (Throwable)request.getAttribute("javax.servlet.error.exception"); Throwable th = (Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
while (th != null) while(th!=null)
{ {
writer.write("<h3>Caused by:</h3><pre>"); writer.write("<h3>Caused by:</h3><pre>");
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);
th.printStackTrace(pw); th.printStackTrace(pw);
pw.flush(); pw.flush();
write(writer, sw.getBuffer().toString()); write(writer,sw.getBuffer().toString());
writer.write("</pre>\n"); writer.write("</pre>\n");
th = th.getCause(); th =th.getCause();
} }
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /** Bad Message Error body
* <p>Generate a error response body to be sent for a bad message.</p> * <p>Generate a error response body to be sent for a bad message.
* <p>In this case there is something wrong with the request, so either * In this case there is something wrong with the request, so either
* a request cannot be built, or it is not safe to build a request. * a request cannot be built, or it is not safe to build a request.
* This method allows for a simple error page body to be returned * This method allows for a simple error page body to be returned
* and some response headers to be set.</p> * and some response headers to be set.
*
* @param status The error code that will be sent * @param status The error code that will be sent
* @param reason The reason for the error code (may be null) * @param reason The reason for the error code (may be null)
* @param fields The header fields that will be sent with the response. * @param fields The header fields that will be sent with the response.
@ -229,14 +220,14 @@ public class ErrorHandler extends AbstractHandler
*/ */
public ByteBuffer badMessageError(int status, String reason, HttpFields fields) public ByteBuffer badMessageError(int status, String reason, HttpFields fields)
{ {
if (reason == null) if (reason==null)
reason = HttpStatus.getMessage(status); reason=HttpStatus.getMessage(status);
fields.put(HttpHeader.CONTENT_TYPE, MimeTypes.Type.TEXT_HTML_8859_1.asString()); fields.put(HttpHeader.CONTENT_TYPE,MimeTypes.Type.TEXT_HTML_8859_1.asString());
return BufferUtil.toBuffer("<h1>Bad Message " + status + "</h1><pre>reason: " + reason + "</pre>"); return BufferUtil.toBuffer("<h1>Bad Message " + status + "</h1><pre>reason: " + reason + "</pre>");
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /** Get the cacheControl.
* @return the cacheControl header to set on error responses. * @return the cacheControl header to set on error responses.
*/ */
public String getCacheControl() public String getCacheControl()
@ -245,7 +236,7 @@ public class ErrorHandler extends AbstractHandler
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /** Set the cacheControl.
* @param cacheControl the cacheControl header to set on error responses. * @param cacheControl the cacheControl header to set on error responses.
*/ */
public void setCacheControl(String cacheControl) public void setCacheControl(String cacheControl)
@ -255,7 +246,7 @@ public class ErrorHandler extends AbstractHandler
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @return whether stack traces are shown in the error pages * @return True if stack traces are shown in the error pages
*/ */
public boolean isShowStacks() public boolean isShowStacks()
{ {
@ -264,7 +255,7 @@ public class ErrorHandler extends AbstractHandler
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param showStacks whether stack traces are shown in the error pages * @param showStacks True if stack traces are shown in the error pages
*/ */
public void setShowStacks(boolean showStacks) public void setShowStacks(boolean showStacks)
{ {
@ -273,27 +264,25 @@ public class ErrorHandler extends AbstractHandler
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @return whether the error message appears in page title * @param showMessageInTitle if true, the error message appears in page title
*/
public boolean getShowMessageInTitle()
{
return _showMessageInTitle;
}
/* ------------------------------------------------------------ */
/**
* @param showMessageInTitle whether the error message appears in page title
*/ */
public void setShowMessageInTitle(boolean showMessageInTitle) public void setShowMessageInTitle(boolean showMessageInTitle)
{ {
_showMessageInTitle = showMessageInTitle; _showMessageInTitle = showMessageInTitle;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void write(Writer writer, String string) public boolean getShowMessageInTitle()
throws IOException
{ {
if (string == null) return _showMessageInTitle;
}
/* ------------------------------------------------------------ */
protected void write(Writer writer,String string)
throws IOException
{
if (string==null)
return; return;
writer.write(StringUtil.sanitizeXmlString(string)); writer.write(StringUtil.sanitizeXmlString(string));
@ -308,22 +297,11 @@ public class ErrorHandler extends AbstractHandler
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public static ErrorHandler getErrorHandler(Server server, ContextHandler context) public static ErrorHandler getErrorHandler(Server server, ContextHandler context)
{ {
ErrorHandler error_handler = null; ErrorHandler error_handler=null;
if (context != null) if (context!=null)
error_handler = context.getErrorHandler(); error_handler=context.getErrorHandler();
if (error_handler == null) if (error_handler==null && server!=null)
{ error_handler = server.getBean(ErrorHandler.class);
synchronized (ErrorHandler.class)
{
error_handler = server.getBean(ErrorHandler.class);
if (error_handler == null)
{
error_handler = new ErrorHandler();
error_handler.setServer(server);
server.addManaged(error_handler);
}
}
}
return error_handler; return error_handler;
} }
} }

View File

@ -61,6 +61,9 @@ public class DatabaseAdaptor
private String _connectionUrl; private String _connectionUrl;
private Driver _driver; private Driver _driver;
private DataSource _datasource; private DataSource _datasource;
private String _jndiName; private String _jndiName;
@ -217,6 +220,37 @@ public class DatabaseAdaptor
_jndiName=jndi; _jndiName=jndi;
} }
public String getDatasourceName ()
{
return _jndiName;
}
public DataSource getDatasource()
{
return _datasource;
}
public String getDriverClassName()
{
return _driverClassName;
}
public Driver getDriver()
{
return _driver;
}
public String getConnectionUrl()
{
return _connectionUrl;
}
public void initialize () public void initialize ()
throws Exception throws Exception
{ {
@ -251,7 +285,6 @@ public class DatabaseAdaptor
} }
/** /**
* Get a connection from the driver or datasource. * Get a connection from the driver or datasource.
* *

View File

@ -27,6 +27,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -76,7 +77,7 @@ public class ConcatServletTest
@Override @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{ {
String includedURI = (String)request.getAttribute("javax.servlet.include.request_uri"); String includedURI = (String)request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI);
response.getOutputStream().println(includedURI); response.getOutputStream().println(includedURI);
} }
}); });

View File

@ -43,6 +43,7 @@ import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainer
import org.eclipse.jetty.websocket.server.WebSocketServerFactory; import org.eclipse.jetty.websocket.server.WebSocketServerFactory;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
public class SessionTrackingTest public class SessionTrackingTest
@ -129,6 +130,7 @@ public class SessionTrackingTest
} }
@Test @Test
@Ignore
public void testAddRemoveSessions() throws Exception public void testAddRemoveSessions() throws Exception
{ {
// Create Client // Create Client

View File

@ -118,13 +118,9 @@ public class JdbcTestServer extends AbstractTestServer
JDBCSessionIdManager idManager = new JDBCSessionIdManager(_server); JDBCSessionIdManager idManager = new JDBCSessionIdManager(_server);
idManager.setWorkerName("w"+(__workers++)); idManager.setWorkerName("w"+(__workers++));
idManager.getDatabaseAdaptor().setDriverInfo(DRIVER_CLASS, (config==null?DEFAULT_CONNECTION_URL:(String)config)); idManager.getDatabaseAdaptor().setDriverInfo(DRIVER_CLASS, (config==null?DEFAULT_CONNECTION_URL:(String)config));
JDBCSessionIdManager.SessionIdTableSchema idTableSchema = new JDBCSessionIdManager.SessionIdTableSchema(); JDBCSessionIdManager.SessionIdTableSchema idTableSchema = idManager.getSessionIdTableSchema();
idTableSchema.setTableName("mysessionids"); idTableSchema.setTableName("mysessionids");
idTableSchema.setIdColumn("myid"); idTableSchema.setIdColumn("myid");
return idManager; return idManager;
} }
} }

View File

@ -24,6 +24,7 @@ import java.io.PrintWriter;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
@ -178,7 +179,7 @@ public class SessionDump extends HttpServlet
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
private String getURI(HttpServletRequest request) private String getURI(HttpServletRequest request)
{ {
String uri=(String)request.getAttribute("javax.servlet.forward.request_uri"); String uri=(String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
if (uri==null) if (uri==null)
uri=request.getRequestURI(); uri=request.getRequestURI();
return uri; return uri;

View File

@ -118,9 +118,7 @@
<contextPath>/test</contextPath> <contextPath>/test</contextPath>
<tempDirectory>${project.build.directory}/work</tempDirectory> <tempDirectory>${project.build.directory}/work</tempDirectory>
<sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler"> <sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler">
<sessionManager implementation="org.eclipse.jetty.server.session.HashSessionManager"> <sessionManager implementation="org.eclipse.jetty.server.session.HashSessionManager"/>
<storeDirectory>${basedir}/target/sessions</storeDirectory>
</sessionManager>
</sessionHandler> </sessionHandler>
</webApp> </webApp>
<loginServices> <loginServices>

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
@ -105,7 +106,7 @@ public class CookieDump extends HttpServlet
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
private String getURI(HttpServletRequest request) private String getURI(HttpServletRequest request)
{ {
String uri=(String)request.getAttribute("javax.servlet.forward.request_uri"); String uri=(String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
if (uri==null) if (uri==null)
uri=request.getRequestURI(); uri=request.getRequestURI();
return uri; return uri;

View File

@ -68,8 +68,8 @@ public class DispatchServlet extends HttpServlet
String info; String info;
if (sreq.getAttribute("javax.servlet.include.servlet_path") != null) if (sreq.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH) != null)
info= (String)sreq.getAttribute("javax.servlet.include.path_info"); info= (String)sreq.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
else else
info= sreq.getPathInfo(); info= sreq.getPathInfo();

View File

@ -39,6 +39,7 @@ import java.util.TimerTask;
import javax.servlet.AsyncContext; import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent; import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener; import javax.servlet.AsyncListener;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -329,7 +330,7 @@ public class Dump extends HttpServlet
// handle an error // handle an error
String error= request.getParameter("error"); String error= request.getParameter("error");
if (error != null && error.length() > 0 && request.getAttribute("javax.servlet.error.status_code")==null) if (error != null && error.length() > 0 && request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE)==null)
{ {
response.getOutputStream().println("THIS SHOULD NOT BE SEEN!"); response.getOutputStream().println("THIS SHOULD NOT BE SEEN!");
response.sendError(Integer.parseInt(error)); response.sendError(Integer.parseInt(error));
@ -874,7 +875,7 @@ public class Dump extends HttpServlet
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
private String getURI(HttpServletRequest request) private String getURI(HttpServletRequest request)
{ {
String uri= (String)request.getAttribute("javax.servlet.forward.request_uri"); String uri= (String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
if (uri == null) if (uri == null)
uri= request.getRequestURI(); uri= request.getRequestURI();
return uri; return uri;

View File

@ -23,6 +23,7 @@ import java.io.PrintWriter;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
@ -193,7 +194,7 @@ public class SessionDump extends HttpServlet
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
private String getURI(HttpServletRequest request) private String getURI(HttpServletRequest request)
{ {
String uri=(String)request.getAttribute("javax.servlet.forward.request_uri"); String uri=(String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
if (uri==null) if (uri==null)
uri=request.getRequestURI(); uri=request.getRequestURI();
return uri; return uri;