diff --git a/VERSION.txt b/VERSION.txt index 490740f98d5..09cd95facaf 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -4,6 +4,7 @@ jetty-7.0.2-SNAPSHOT + 296765 JMX Connector Server and ShutdownThread + 297421 Hide server/system classes from WebAppClassLoader.getResources + 297783 Handle HEAD reponses in HttpClient + + JETTY-910 Allow request listeners to access session + JETTY-1156 SSL blocking close with JVM Bug busy key fix + JETTY-1157 Don't hold array passed in write(byte[]) + COMETD-46 reset ContentExchange response content on resend diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index 3baae373c9a..dd54eefc7cc 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -597,18 +597,11 @@ public class HttpConnection implements Connection throw (ThreadDeath)e; error=true; - if (info==null) - { - Log.debug(_uri+": "+e); - _request.setHandled(true); - _generator.sendError(400, null, null, true); - } - else - { - Log.debug(""+_uri,e); - _request.setHandled(true); - _generator.sendError(500, null, null, true); - } + Log.warn(_uri+": "+e); + Log.debug(e); + _request.setHandled(true); + _generator.sendError(info==null?400:500, null, null, true); + } finally { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index e2979b5ef61..fc4c63c5f17 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1093,7 +1093,7 @@ public class Request implements HttpServletRequest public HttpSession getSession(boolean create) { if (_sessionManager==null && create) - throw new IllegalStateException("No SessionHandler or SessionManager"); + throw new IllegalStateException("No SessionManager"); if (_session != null && _sessionManager!=null && _sessionManager.isValid(_session)) return _session; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java index 66c78813f52..38253840b7d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.SessionManager; import org.eclipse.jetty.server.handler.HandlerWrapper; +import org.eclipse.jetty.server.handler.ScopedHandler; import org.eclipse.jetty.util.log.Log; /* ------------------------------------------------------------ */ @@ -36,7 +37,7 @@ import org.eclipse.jetty.util.log.Log; * * */ -public class SessionHandler extends HandlerWrapper +public class SessionHandler extends ScopedHandler { /* -------------------------------------------------------------- */ private SessionManager _sessionManager; @@ -126,12 +127,13 @@ public class SessionHandler extends HandlerWrapper _sessionManager.stop(); } + /* ------------------------------------------------------------ */ /* * @see org.eclipse.jetty.server.Handler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int) */ @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { setRequestedId(baseRequest,request); @@ -179,7 +181,18 @@ public class SessionHandler extends HandlerWrapper Log.debug("session="+session); } - getHandler().handle(target, baseRequest, request, response); + // start manual inline of nextScope(target,baseRequest,request,response); + //noinspection ConstantIfStatement + if (false) + nextScope(target,baseRequest,request,response); + else if (_nextScope!=null) + _nextScope.doScope(target,baseRequest,request, response); + else if (_outerScope!=null) + _outerScope.doHandle(target,baseRequest,request, response); + else + doHandle(target,baseRequest,request, response); + // end manual inline (pathentic attempt to reduce stack depth) + } finally { @@ -195,6 +208,26 @@ public class SessionHandler extends HandlerWrapper } } } + + + /* ------------------------------------------------------------ */ + /* + * @see org.eclipse.jetty.server.Handler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int) + */ + @Override + public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + // start manual inline of nextHandle(target,baseRequest,request,response); + //noinspection ConstantIfStatement + if (false) + nextHandle(target,baseRequest,request,response); + else if (_nextScope!=null && _nextScope==_handler) + _nextScope.doHandle(target,baseRequest,request, response); + else if (_handler!=null) + _handler.handle(target,baseRequest, request, response); + // end manual inline + } /* ------------------------------------------------------------ */ /** Look for a requested session ID in cookies and URI parameters diff --git a/test-jetty-webapp/src/main/java/com/acme/TestListener.java b/test-jetty-webapp/src/main/java/com/acme/TestListener.java index 69841e645cb..2a5dee28e1e 100644 --- a/test-jetty-webapp/src/main/java/com/acme/TestListener.java +++ b/test-jetty-webapp/src/main/java/com/acme/TestListener.java @@ -98,6 +98,7 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeL public void requestInitialized(ServletRequestEvent sre) { + ((HttpServletRequest)sre.getServletRequest()).getSession(true).getId(); sre.getServletRequest().setAttribute("requestInitialized","'"+sre.getServletContext().getContextPath()+"'"); // System.err.println("requestInitialized "+sre); }