snichol 2002/08/03 19:47:32 Modified: java/src/org/apache/soap/server/http MessageRouterServlet.java RPCRouterServlet.java java/docs changes.html Log: Add the ability to suppress session creation per service by specifying <isd:option key="SessionRequired" value="false"/> within the isd:provider element in the deployment descriptor. Revision Changes Path 1.35 +18 -2 xml-soap/java/src/org/apache/soap/server/http/MessageRouterServlet.java Index: MessageRouterServlet.java =================================================================== RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/server/http/MessageRouterServlet.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- MessageRouterServlet.java 17 Jun 2002 04:08:39 -0000 1.34 +++ MessageRouterServlet.java 4 Aug 2002 02:47:31 -0000 1.35 @@ -71,6 +71,7 @@ import org.apache.soap.util.*; import org.apache.soap.util.xml.*; import org.apache.soap.transport.*; +import org.apache.soap.encoding.soapenc.SoapEncUtils; /** * This servlet routes messages to the appropriate listener method. @@ -78,6 +79,7 @@ * @author Sanjiva Weerawarana ([EMAIL PROTECTED]) * @author Matthew J. Duftler ([EMAIL PROTECTED]) * @author Bill Nagy ([EMAIL PROTECTED]) + * @author Scott Nichol ([EMAIL PROTECTED]) */ public class MessageRouterServlet extends HttpServlet { /* @@ -240,7 +242,7 @@ { ServletConfig config = getServletConfig(); ServletContext context = config.getServletContext (); - HttpSession session = req.getSession (); + HttpSession session; ServiceManager serviceManager = ServerHTTPUtils.getServiceManagerFromContext (context, configFilename); int status; @@ -256,7 +258,6 @@ try { try { reqCtx.setProperty( Constants.BAG_HTTPSERVLET, this ); - reqCtx.setProperty( Constants.BAG_HTTPSESSION, session ); reqCtx.setProperty( Constants.BAG_HTTPSERVLETREQUEST, req ); reqCtx.setProperty( Constants.BAG_HTTPSERVLETRESPONSE, res ); @@ -291,6 +292,21 @@ dd = serviceManager.query (targetID); reqCtx.setProperty( Constants.BAG_DEPLOYMENTDESCRIPTOR, dd ); + // Get the session, but only create a new session if the scope + // is session or there is no deployment descriptor option + // SessionRequired with a value of false (i.e. the desire to + // suppress sessions must be explicitly indicated for backward + // compatibility). + Hashtable props = dd.getProps(); + String sessionRequired = props != null ? (String) props.get("SessionRequired") : null; + session = req.getSession( + dd.getScope() == DeploymentDescriptor.SCOPE_SESSION || + sessionRequired == null || + SoapEncUtils.decodeBooleanValue(sessionRequired) + ); + if (session != null) + reqCtx.setProperty(Constants.BAG_HTTPSESSION, session); + Provider provider; if ( dd.getProviderType() == DeploymentDescriptor.PROVIDER_JAVA ) { // Handle Java based services 1.39 +19 -3 xml-soap/java/src/org/apache/soap/server/http/RPCRouterServlet.java Index: RPCRouterServlet.java =================================================================== RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/server/http/RPCRouterServlet.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- RPCRouterServlet.java 17 Jun 2002 04:08:39 -0000 1.38 +++ RPCRouterServlet.java 4 Aug 2002 02:47:31 -0000 1.39 @@ -73,6 +73,7 @@ import org.apache.soap.util.xml.*; import org.apache.soap.transport.EnvelopeEditor; import org.apache.soap.transport.EnvelopeEditorFactory; +import org.apache.soap.encoding.soapenc.SoapEncUtils; /** * This servlet routes RPC requests to the intended method of @@ -85,6 +86,7 @@ * @author Kevin J. Mitchell ([EMAIL PROTECTED]) * @author Wouter Cloetens ([EMAIL PROTECTED]) * @author Bill Nagy ([EMAIL PROTECTED]) + * @author Scott Nichol ([EMAIL PROTECTED]) */ public class RPCRouterServlet extends HttpServlet { /* @@ -273,7 +275,7 @@ throws ServletException, IOException { ServletConfig config = getServletConfig(); ServletContext context = config.getServletContext (); - HttpSession session = req.getSession (); + HttpSession session; ServiceManager serviceManager = ServerHTTPUtils.getServiceManagerFromContext (context, configFilename); Call call = null; @@ -295,7 +297,6 @@ // extract the call try {// Exception extracting the call reqCtx.setProperty( Constants.BAG_HTTPSERVLET, this ); - reqCtx.setProperty( Constants.BAG_HTTPSESSION, session ); reqCtx.setProperty( Constants.BAG_HTTPSERVLETREQUEST, req ); reqCtx.setProperty( Constants.BAG_HTTPSERVLETRESPONSE, res ); @@ -335,7 +336,22 @@ // not known) dd = serviceManager.query (targetID); reqCtx.setProperty( Constants.BAG_DEPLOYMENTDESCRIPTOR, dd ); - + + // Get the session, but only create a new session if the scope + // is session or there is no deployment descriptor option + // SessionRequired with a value of false (i.e. the desire to + // suppress sessions must be explicitly indicated for backward + // compatibility). + Hashtable props = dd.getProps(); + String sessionRequired = props != null ? (String) props.get("SessionRequired") : null; + session = req.getSession( + dd.getScope() == DeploymentDescriptor.SCOPE_SESSION || + sessionRequired == null || + SoapEncUtils.decodeBooleanValue(sessionRequired) + ); + if (session != null) + reqCtx.setProperty(Constants.BAG_HTTPSESSION, session); + Provider provider; if ( dd.getProviderType() == DeploymentDescriptor.PROVIDER_JAVA ) { // Handle Java based services 1.36 +6 -0 xml-soap/java/docs/changes.html Index: changes.html =================================================================== RCS file: /home/cvs/xml-soap/java/docs/changes.html,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- changes.html 1 Aug 2002 03:07:32 -0000 1.35 +++ changes.html 4 Aug 2002 02:47:32 -0000 1.36 @@ -54,8 +54,14 @@ than the TCP segment size, assuming the server platform uses a long delayed ACK timer (typically 200 ms).</li> <li>Support authentication for https proxies.</li> + <li>Add the ability to suppress session creation per service + by specifying + <code><isd:option key="SessionRequired" value="false"/></code> + within the <code>isd:provider</code> element in the deployment descriptor.</li> </ul> </li> +</ul> +<ul> <li><A name="v2.3.1"><STRONG>Version 2.3.1</STRONG></A> <ul> <li>Added logic to use xsi:nil, instead of xsi:null,
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>