Revision: 30452e7e847c
Author:   [email protected] <[email protected]>
Date:     Fri Jul 12 04:23:35 2013
Log:      Fixed Issue #79 and Fixed Issue #80 in one go

http://code.google.com/p/jain-slee/source/detail?r=30452e7e847c&repo=http

Modified:
/resources/http-servlet/common/src/main/java/org/mobicents/slee/resource/http/HttpServletRaSessionListener.java /resources/http-servlet/common/src/main/java/org/mobicents/slee/resource/http/HttpServletResourceEntryPoint.java
 /resources/http-servlet/du/src/main/resources/META-INF/deploy-config.xml
/resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpServletRaSbbInterfaceImpl.java /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpServletResourceAdaptor.java /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpSessionActivityImpl.java /resources/http-servlet/ra/src/main/resources/META-INF/resource-adaptor-jar.xml /resources/http-servlet/ratype/src/main/java/net/java/slee/resource/http/HttpSessionActivity.java

=======================================
--- /resources/http-servlet/common/src/main/java/org/mobicents/slee/resource/http/HttpServletRaSessionListener.java Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/common/src/main/java/org/mobicents/slee/resource/http/HttpServletRaSessionListener.java Fri Jul 12 04:23:35 2013
@@ -81,7 +81,7 @@
                        if (name != null) {
HttpServletResourceEntryPoint resourceEntryPoint = HttpServletResourceEntryPointManager.getResourceEntryPoint(name);
                                if (resourceEntryPoint != null) {
-                                       
resourceEntryPoint.onSessionTerminated(session.getId());
+                                       
resourceEntryPoint.onSessionTerminated(wrapper);
                                }
                        }
                }
=======================================
--- /resources/http-servlet/common/src/main/java/org/mobicents/slee/resource/http/HttpServletResourceEntryPoint.java Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/common/src/main/java/org/mobicents/slee/resource/http/HttpServletResourceEntryPoint.java Fri Jul 12 04:23:35 2013
@@ -39,6 +39,6 @@

public void onRequest(HttpServletRequest request, HttpServletResponse response);

-       public void onSessionTerminated(String sessionId);
+       public void onSessionTerminated(HttpSessionWrapper httpSessionWrapper);

 }
=======================================
--- /resources/http-servlet/du/src/main/resources/META-INF/deploy-config.xml Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/du/src/main/resources/META-INF/deploy-config.xml Fri Jul 12 04:23:35 2013
@@ -3,6 +3,7 @@
<ra-entity resource-adaptor-id="ResourceAdaptorID[name=HttpServletResourceAdaptor,vendor=org.mobicents,version=1.0]" entity-name="HttpServletRA">
     <properties>
<property name="name" type="java.lang.String" value="${servlet-name}" /> + <property name="HTTP_REQUEST_TIMEOUT" type="java.lang.Integer" value="60000" />
     </properties>
     <ra-link name="HttpServletRA" />
   </ra-entity>
=======================================
--- /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpServletRaSbbInterfaceImpl.java Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpServletRaSbbInterfaceImpl.java Fri Jul 12 04:23:35 2013
@@ -69,7 +69,7 @@
                        throw new IllegalArgumentException();
                }
final HttpSessionWrapper httpSessionWrapper = (HttpSessionWrapper) httpSession; - final HttpSessionActivityImpl activity = new HttpSessionActivityImpl(httpSession.getId()); + final HttpSessionActivityImpl activity = new HttpSessionActivityImpl(httpSessionWrapper);
                if (httpSessionWrapper.getResourceEntryPoint() == null) {
                        
ra.getSleeEndpoint().startActivitySuspended(activity,activity);
                        httpSessionWrapper.setResourceEntryPoint(ra.getName());
=======================================
--- /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpServletResourceAdaptor.java Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpServletResourceAdaptor.java Fri Jul 12 04:23:35 2013
@@ -82,8 +82,12 @@
         * the ra entity name, which matches the servlet name
         */
        private String name;
+
+       private int httpRequestTimeout;

        private static final String NAME_CONFIG_PROPERTY = "name";
+
+ private static final String CFG_PROPERTY_HTTP_REQUEST_TIMEOUT = "HTTP_REQUEST_TIMEOUT";

        /**
         *
@@ -145,6 +149,7 @@
         */
        public void raConfigure(ConfigProperties arg0) {
                name = (String) 
arg0.getProperty(NAME_CONFIG_PROPERTY).getValue();
+ httpRequestTimeout = (Integer)arg0.getProperty(CFG_PROPERTY_HTTP_REQUEST_TIMEOUT).getValue();
        }

        /*
@@ -211,20 +216,37 @@
         */
        public void raVerifyConfiguration(ConfigProperties arg0)
                        throws 
javax.slee.resource.InvalidConfigurationException {
-               ConfigProperties.Property property = arg0
-                               .getProperty(NAME_CONFIG_PROPERTY);
-               if (property == null) {
+ ConfigProperties.Property nameProperty = arg0.getProperty(NAME_CONFIG_PROPERTY);
+
+               if (nameProperty == null) {
                        throw new InvalidConfigurationException("name property not 
found");
                }
-               if (!property.getType().equals(String.class.getName())) {
+
+               if (!nameProperty.getType().equals(String.class.getName())) {
                        throw new InvalidConfigurationException(
                                        "name property must be of type 
java.lang.String");
                }
-               if (property.getValue() == null) {
+               if (nameProperty.getValue() == null) {
                        // don't think this can happen, but just to be sure
                        throw new InvalidConfigurationException(
                                        "name property must not have a null 
value");
                }
+
+ ConfigProperties.Property httpTimeoutProperty = arg0.getProperty(CFG_PROPERTY_HTTP_REQUEST_TIMEOUT);
+               if (httpTimeoutProperty == null) {
+ throw new InvalidConfigurationException("HTTP_REQUEST_TIMEOUT property not found");
+        }
+
+               if 
(!httpTimeoutProperty.getType().equals(Integer.class.getName())) {
+            throw new InvalidConfigurationException(
+ "HTTP_REQUEST_TIMEOUT property must be of type java.lang.Integer");
+        }
+
+               if (httpTimeoutProperty.getValue() == null) {
+            // don't think this can happen, but just to be sure
+            throw new InvalidConfigurationException(
+ "HTTP_REQUEST_TIMEOUT property must not have a null value");
+        }
        };

        /*
@@ -476,7 +498,7 @@
                        // create request activity
                        activity = new HttpServletRequestActivityImpl();
                } else {
-                       activity = new HttpSessionActivityImpl(session.getId());
+                       activity = new HttpSessionActivityImpl(session);
                        if (session.getResourceEntryPoint() != null) {
                                createActivity = false;
                        }
@@ -512,7 +534,7 @@
                                                null, 
EventFlags.REQUEST_EVENT_UNREFERENCED_CALLBACK);
                                // block thread until event has been processed
                                // otherwise jboss web replies to the request
-                               lock.wait(15000);
+                               lock.wait(this.httpRequestTimeout);
                                // the event was unreferenced or 15s timeout, 
if the activity is
                                // the request then end it
                                if (session == null) {
@@ -542,8 +564,8 @@
         * @seeorg.mobicents.slee.resource.http.HttpServletResourceEntryPoint#
         * onSessionTerminated(java.lang.String)
         */
-       public void onSessionTerminated(String sessionId) {
-               endActivity(new HttpSessionActivityImpl(sessionId));
+       public void onSessionTerminated(HttpSessionWrapper httpSessionWrapper) {
+               endActivity(new HttpSessionActivityImpl(httpSessionWrapper));
        }

 }
=======================================
--- /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpSessionActivityImpl.java Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/ra/src/main/java/org/mobicents/slee/resource/http/HttpSessionActivityImpl.java Fri Jul 12 04:23:35 2013
@@ -31,18 +31,28 @@
  *
  */
public class HttpSessionActivityImpl extends AbstractHttpServletActivity implements HttpSessionActivity {
+
+    private final HttpSessionWrapper httpSessionWrapper;

        /**
         *
         */
        private static final long serialVersionUID = 1L;

-       public HttpSessionActivityImpl(String sessionId) {
-               super(sessionId);
-       }
-
+       public HttpSessionActivityImpl(HttpSessionWrapper httpSessionWrapper) {
+        super(httpSessionWrapper.getId());
+        this.httpSessionWrapper = httpSessionWrapper;
+    }
+
+
        public String getSessionId() {
                return id;
        }
+
+
+    @Override
+    public void endActivity() {
+        this.httpSessionWrapper.invalidate();
+    }

 }
=======================================
--- /resources/http-servlet/ra/src/main/resources/META-INF/resource-adaptor-jar.xml Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/ra/src/main/resources/META-INF/resource-adaptor-jar.xml Fri Jul 12 04:23:35 2013
@@ -26,8 +26,12 @@
         <config-property>
             <config-property-name>name</config-property-name>
             <config-property-type>java.lang.String</config-property-type>
-            <config-property-value>${servlet-name}</config-property-value>
         </config-property>
+               <config-property>
+ <description>Once HTTP request is received, RA will wait for configured milliseconds before responding back empty HTTP Response</description>
+                       
<config-property-name>HTTP_REQUEST_TIMEOUT</config-property-name>
+                       
<config-property-type>java.lang.Integer</config-property-type>
+               </config-property>

     </resource-adaptor>

=======================================
--- /resources/http-servlet/ratype/src/main/java/net/java/slee/resource/http/HttpSessionActivity.java Wed Aug 15 08:42:06 2012 +++ /resources/http-servlet/ratype/src/main/java/net/java/slee/resource/http/HttpSessionActivity.java Fri Jul 12 04:23:35 2013
@@ -45,5 +45,8 @@
         */
        public String getSessionId();

-
+       /**
+        * Ends the underlying Activiity and invalidates the HttpSession
+        */
+       public void endActivity();
 }

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to