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 b8f9ccb9a78..8d1a2b47ed3 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 @@ -469,15 +469,23 @@ public class Response implements HttpServletResponse { buf = _connection.getRequest().getRootURL(); buf.append(URIUtil.encodePath(canonical)); - if (uri.getQuery()!=null) + String param=uri.getParam(); + if (param!=null) + { + buf.append(';'); + buf.append(param); + } + String query=uri.getQuery(); + if (query!=null) { buf.append('?'); - buf.append(uri.getQuery()); + buf.append(query); } - if (uri.getFragment()!=null) + String fragment=uri.getFragment(); + if (fragment!=null) { buf.append('#'); - buf.append(uri.getFragment()); + buf.append(fragment); } location=buf.toString(); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java index ece7e2e9649..393c65298ec 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java @@ -425,8 +425,13 @@ public class ResponseTest throws Exception { String[][] tests={ - {"/other/location?name=value","http://myhost:8888/other/location;jsessionid=12345?name=value"}, - /* {"/other/location","http://myhost:8888/other/location"}, + // No cookie + {"http://myhost:8888/other/location;jsessionid=12345?name=value","http://myhost:8888/other/location;jsessionid=12345?name=value"}, + {"/other/location;jsessionid=12345?name=value","http://myhost:8888/other/location;jsessionid=12345?name=value"}, + {"./location;jsessionid=12345?name=value","http://myhost:8888/path/location;jsessionid=12345?name=value"}, + + // From cookie + {"/other/location","http://myhost:8888/other/location"}, {"/other/l%20cation","http://myhost:8888/other/l%20cation"}, {"location","http://myhost:8888/path/location"}, {"./location","http://myhost:8888/path/location"}, @@ -434,11 +439,11 @@ public class ResponseTest {"/other/l%20cation","http://myhost:8888/other/l%20cation"}, {"l%20cation","http://myhost:8888/path/l%20cation"}, {"./l%20cation","http://myhost:8888/path/l%20cation"}, - {"../l%20cation","http://myhost:8888/l%20cation"},*/ + {"../l%20cation","http://myhost:8888/l%20cation"}, {"../locati%C3%abn","http://myhost:8888/locati%C3%ABn"}, }; - for (int i=1;i0); + request.setRequestedSessionIdFromCookie(i>2); AbstractSessionManager manager=new HashSessionManager(); manager.setSessionIdManager(new HashSessionIdManager()); request.setSessionManager(manager); @@ -462,7 +467,7 @@ public class ResponseTest int l=location.indexOf("Location: "); int e=location.indexOf('\n',l); location=location.substring(l+10,e).trim(); - assertEquals(tests[i][0],tests[i][1],location); + assertEquals("test-"+i,tests[i][1],location); } } diff --git a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/IdleSessionTest.java b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/IdleSessionTest.java index 18dbb430e34..27ba5feb862 100644 --- a/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/IdleSessionTest.java +++ b/tests/test-sessions/test-hash-sessions/src/test/java/org/eclipse/jetty/server/session/IdleSessionTest.java @@ -15,6 +15,7 @@ // You may elect to redistribute this code under either of these licenses. // ======================================================================== // + package org.eclipse.jetty.server.session; import static org.junit.Assert.assertEquals;