diff --git a/VERSION.txt b/VERSION.txt index 50175d5af5b..1b95d617c18 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,6 +1,7 @@ jetty-7.0.0.RC2-SNAPSHOT + 283844 Webapp / TLD errors are not clear + 283375 improved extensibility of SSL connectors + + 283818 fixed merge of forward parameters + backport jetty-8 annotation parsing to jetty-7 jetty-7.0.0.RC1 15 June 2009 diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java index 0608a02885a..92998e9c7f2 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java @@ -201,6 +201,7 @@ public class Dispatcher implements RequestDispatcher { Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest(); Response base_response=baseRequest.getResponse(); + response.resetBuffer(); base_response.fwdReset(); request.removeAttribute(__JSP_FILE); // TODO remove when glassfish 1044 is fixed @@ -221,21 +222,26 @@ public class Dispatcher implements RequestDispatcher _contextHandler.handle(_named,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response); else { - String query=_dQuery; + // process any query string from the dispatch URL + String query=_dQuery; if (query!=null) { + // extract parameters from dispatch query MultiMap parameters=new MultiMap(); UrlEncoded.decodeTo(query,parameters,request.getCharacterEncoding()); - boolean rewrite_old_query = false; + boolean merge_old_query = false; + // Have we evaluated parameters if( old_params == null ) { - baseRequest.getParameterNames(); // force parameters to be evaluated + // no - so force parameters to be evaluated + baseRequest.getParameterNames(); old_params = baseRequest.getParameters(); } + // Are there any existing parameters? if (old_params!=null && old_params.size()>0) { // Merge parameters; new parameters of the same name take precedence. @@ -245,24 +251,20 @@ public class Dispatcher implements RequestDispatcher Map.Entry entry = (Map.Entry)iter.next(); String name=(String)entry.getKey(); + // If the names match, we will need to remake the query string if (parameters.containsKey(name)) - { - rewrite_old_query = true; - } - else - { - Object values=entry.getValue(); - for (int i=0;i0) { - if ( rewrite_old_query ) + if ( merge_old_query ) { StringBuilder overridden_query_string = new StringBuilder(); MultiMap overridden_old_query = new MultiMap(); @@ -333,12 +335,18 @@ public class Dispatcher implements RequestDispatcher if (baseRequest.getConnection().getResponse().isWriting()) { try {response.getWriter().close();} - catch(IllegalStateException e) { response.getOutputStream().close(); } + catch(IllegalStateException e) + { + response.getOutputStream().close(); + } } else { try {response.getOutputStream().close();} - catch(IllegalStateException e) { response.getWriter().close(); } + catch(IllegalStateException e) + { + response.getWriter().close(); + } } } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index 798354630a9..aa6a71c2dc5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -985,6 +985,7 @@ public class Response implements HttpServletResponse */ public void reset() { + resetBuffer(); fwdReset(); _status=200; _reason=null; diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java index c29b99ac448..14038786ba9 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java @@ -59,15 +59,13 @@ import org.eclipse.jetty.util.log.Log; * This filter extends {@link UserAgentFilter} and if the the initParameter excludedAgents * is set to a comma separated list of user agents, then these agents will be excluded from gzip content. *

- * - * * */ public class GzipFilter extends UserAgentFilter { protected Set _mimeTypes; protected int _bufferSize=8192; - protected int _minGzipSize=1; + protected int _minGzipSize=256; protected Set _excluded; public void init(FilterConfig filterConfig) throws ServletException @@ -421,10 +419,12 @@ public class GzipFilter extends UserAgentFilter public void resetBuffer() { + if (_response.isCommitted()) + throw new IllegalStateException("Committed"); _closed=false; _out=null; _bOut=null; - if (_gzOut!=null && !_response.isCommitted()) + if (_gzOut!=null) _response.setHeader("Content-Encoding",null); _gzOut=null; } @@ -449,6 +449,9 @@ public class GzipFilter extends UserAgentFilter public void close() throws IOException { + if (_closed) + return; + if (_request.getAttribute("javax.servlet.include.request_uri")!=null) flush(); else @@ -561,10 +564,7 @@ public class GzipFilter extends UserAgentFilter private void checkOut(int length) throws IOException { if (_closed) - { - new Throwable().printStackTrace(); throw new IOException("CLOSED"); - } if (_out==null) { @@ -579,7 +579,7 @@ public class GzipFilter extends UserAgentFilter { if (_response.isCommitted() || (_contentLength>=0 && _contentLength<_minGzipSize)) doNotGzip(); - else if (length>=(_bOut.size()-_bOut.getCount())) + else if (length>=(_bOut.getBuf().length -_bOut.getCount())) doGzip(); } } diff --git a/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java b/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java index 339eee86d45..d353d414819 100644 --- a/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java +++ b/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java @@ -27,6 +27,8 @@ import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; +import org.eclipse.jetty.util.log.Log; + /* ------------------------------------------------------------ */ /** Test Servlet RequestDispatcher. @@ -152,11 +154,15 @@ public class DispatchServlet extends HttpServlet dispatch.forward(sreq, sres); try { + // should be closed out.println("IOException"); + // should not get here throw new IllegalStateException(); } catch(IOException e) - {} + { + Log.ignore(e); + } } else {