You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2001/12/03 19:18:20 UTC
cvs commit: xml-axis/java/src/org/apache/axis/transport/http AxisHttpSession.java AxisServlet.java
rubys 01/12/03 10:18:20
Modified: java/src/org/apache/axis/transport/http AxisHttpSession.java
AxisServlet.java
Log:
Don't make the server go through the work of creating a session unless
it is actually needed...
Submitted by: Greg Truty <gt...@us.ibm.com>
Revision Changes Path
1.8 +18 -0 xml-axis/java/src/org/apache/axis/transport/http/AxisHttpSession.java
Index: AxisHttpSession.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisHttpSession.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AxisHttpSession.java 2001/10/30 16:46:40 1.7
+++ AxisHttpSession.java 2001/12/03 18:18:20 1.8
@@ -58,6 +58,7 @@
import org.apache.axis.session.Session;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
/**
* An HTTP/Servlet implementation of Axis sessions.
@@ -67,7 +68,13 @@
public class AxisHttpSession implements Session
{
private HttpSession rep;
+ private HttpServletRequest req;
+ public AxisHttpSession(HttpServletRequest realRequest)
+ {
+ req = realRequest;
+ }
+
public AxisHttpSession(HttpSession realSession)
{
rep = realSession;
@@ -88,6 +95,7 @@
*/
public Object get(String key)
{
+ ensureSession();
return rep.getAttribute(key);
}
@@ -98,6 +106,7 @@
*/
public void set(String key, Object value)
{
+ ensureSession();
rep.setAttribute(key, value);
}
@@ -107,6 +116,7 @@
*/
public void remove(String key)
{
+ ensureSession();
rep.removeAttribute(key);
}
@@ -118,6 +128,7 @@
*/
public void setTimeout(int timeout)
{
+ ensureSession();
rep.setMaxInactiveInterval(timeout);
}
@@ -127,6 +138,7 @@
* @return the timeout value for this session.
*/
public int getTimeout() {
+ ensureSession();
return rep.getMaxInactiveInterval();
}
@@ -135,5 +147,11 @@
*/
public void touch() {
// ???
+ }
+
+ protected void ensureSession() {
+ if (rep == null) {
+ rep = req.getSession();
+ }
}
}
1.66 +1 -1 xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
Index: AxisServlet.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- AxisServlet.java 2001/12/01 23:06:29 1.65
+++ AxisServlet.java 2001/12/03 18:18:20 1.66
@@ -462,7 +462,7 @@
// Create a Session wrapper for the HTTP session.
// These can/should be pooled at some point. (Sam is Watching! :-)
- msgContext.setSession(new AxisHttpSession(req.getSession()));
+ msgContext.setSession(new AxisHttpSession(req));
/* Save the real path */
/**********************/