[Httpunit-commit] CVS: httpunit/src/com/meterware/servletunit InvocationContextImpl.java,1.8,1.9 Ser
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-10-21 13:34:23
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory usw-pr-cvs1:/tmp/cvs-serv5578/src/com/meterware/servletunit
Modified Files:
InvocationContextImpl.java ServletUnitHttpResponse.java
WebApplication.java
Log Message:
Use application context as session cookie path
Index: InvocationContextImpl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/InvocationContextImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- InvocationContextImpl.java 17 Oct 2002 23:50:49 -0000 1.8
+++ InvocationContextImpl.java 21 Oct 2002 13:34:19 -0000 1.9
@@ -91,7 +91,9 @@
if (_webResponse == null) {
HttpSession session = _request.getSession( /* create */ false );
if (session != null && session.isNew()) {
- _response.addCookie( new Cookie( ServletUnitHttpSession.SESSION_COOKIE_NAME, session.getId() ) );
+ Cookie cookie = new Cookie( ServletUnitHttpSession.SESSION_COOKIE_NAME, session.getId() );
+ cookie.setPath( _application.getContextPath() );
+ _response.addCookie( cookie );
}
_webResponse = new ServletUnitWebResponse( _client, _target, _requestURL, _response );
}
Index: ServletUnitHttpResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpResponse.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ServletUnitHttpResponse.java 2 Oct 2002 14:50:39 -0000 1.12
+++ ServletUnitHttpResponse.java 21 Oct 2002 13:34:19 -0000 1.13
@@ -570,7 +570,7 @@
StringBuffer sb = new StringBuffer();
for (Enumeration e = _cookies.elements(); e.hasMoreElements();) {
Cookie cookie = (Cookie) e.nextElement();
- sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() );
+ sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ).append( ";path=" ).append( cookie.getPath() );
if (e.hasMoreElements()) sb.append( ',' );
}
setHeader( "Set-Cookie", sb.toString() );
Index: WebApplication.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/WebApplication.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- WebApplication.java 9 Oct 2002 19:15:29 -0000 1.14
+++ WebApplication.java 21 Oct 2002 13:34:19 -0000 1.15
@@ -101,6 +101,11 @@
}
+ String getContextPath() {
+ return _contextPath;
+ }
+
+
/**
* Registers a servlet class to be run.
**/
|