@@ -155,7 +155,13 @@ public boolean handle(Request request, Response response, Callback callback)
155155 out .append ("Attribute " ).append (name ).append (" = " ).append (session .getAttribute (name )).append ('\n' );
156156 out .append ("URI [" )
157157 .append (session .encodeURI (request , "/some/path" , request .getHeaders ().contains (HttpHeader .COOKIE )))
158- .append ("]" );
158+ .append ("]\n " );
159+ out .append ("RELATIVE URI [" )
160+ .append (session .encodeURI (request , "../" , request .getHeaders ().contains (HttpHeader .COOKIE )))
161+ .append ("]\n " );
162+ out .append ("ABSOLUTE URI [" )
163+ .append (session .encodeURI (request , "http://localhost:80/foo/bar/" , request .getHeaders ().contains (HttpHeader .COOKIE )))
164+ .append ("]\n " );
159165 }
160166 else
161167 {
@@ -488,6 +494,8 @@ public void testCookieAndURI() throws Exception
488494 String content = response .getContent ();
489495 assertThat (content , startsWith ("Session=" ));
490496 assertThat (content , containsString ("URI [/some/path;session_id=%s]" .formatted (id ))); // Cookies not known to be in use
497+ assertThat (content , containsString ("RELATIVE URI [../;session_id=%s]" .formatted (id ))); // Cookies not known to be in use
498+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/;session_id=%s]" .formatted (id ))); // Cookies not known to be in use
491499
492500 // Get with cookie
493501 endPoint .addInput ("""
@@ -503,6 +511,8 @@ public void testCookieAndURI() throws Exception
503511 content = response .getContent ();
504512 assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
505513 assertThat (content , containsString ("URI [/some/path]" )); // Cookies known to be in use
514+ assertThat (content , containsString ("RELATIVE URI [../]" ));
515+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/" ));
506516
507517 // Get with parameter
508518 endPoint .addInput ("""
@@ -517,6 +527,8 @@ public void testCookieAndURI() throws Exception
517527 content = response .getContent ();
518528 assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
519529 assertThat (content , containsString ("URI [/some/path;session_id=%s]" .formatted (id ))); // Cookies not in use
530+ assertThat (content , containsString ("RELATIVE URI [../;session_id=%s]" .formatted (id )));
531+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/;session_id=%s]" .formatted (id )));
520532
521533 // Get with both, but param wrong
522534 endPoint .addInput ("""
@@ -532,6 +544,8 @@ public void testCookieAndURI() throws Exception
532544 content = response .getContent ();
533545 assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
534546 assertThat (content , containsString ("URI [/some/path]" )); // Cookies known to be in use
547+ assertThat (content , containsString ("RELATIVE URI [../]" ));
548+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/]" ));
535549
536550 // Get with both, but cookie wrong
537551 endPoint .addInput ("""
@@ -547,6 +561,8 @@ public void testCookieAndURI() throws Exception
547561 content = response .getContent ();
548562 assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
549563 assertThat (content , containsString ("URI [/some/path]" )); // Cookies known to be in use
564+ assertThat (content , containsString ("RELATIVE URI [../]" ));
565+ assertThat (content , containsString ("ABSOLUTE URI [http://localhost:80/foo/bar/]" ));
550566 }
551567 }
552568
@@ -789,5 +805,4 @@ public void testFlushOnResponseCommit() throws Exception
789805 assertThat (content , containsString ("Session=" + id .substring (0 , id .indexOf (".node0" ))));
790806 assertThat (content , containsString ("attribute = value" ));
791807 }
792-
793808}
0 commit comments