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 ve...@apache.org on 2010/01/22 22:19:05 UTC

svn commit: r902271 - in /webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http: AbstractAgent.java AxisServlet.java AxisServletListener.java ListingAgent.java

Author: veithen
Date: Fri Jan 22 21:19:05 2010
New Revision: 902271

URL: http://svn.apache.org/viewvc?rev=902271&view=rev
Log:
Removed support for servlet API versions <= 2.2 (i.e. Tomcat 3). This also avoids getting error messages such as 'Old Servlet API :java.lang.StackOverflowError'.

Modified:
    webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java
    webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServletListener.java
    webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/ListingAgent.java

Modified: webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java?rev=902271&r1=902270&r2=902271&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java (original)
+++ webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AbstractAgent.java Fri Jan 22 21:19:05 2010
@@ -117,12 +117,8 @@
                               HttpServletResponse httpServletResponse)
             throws IOException, ServletException {
         httpServletResponse.setContentType("text/html");
-        try {
-            httpServletRequest.getRequestDispatcher(Constants.AXIS_WEB_CONTENT_ROOT + jspName)
-                    .include(httpServletRequest, httpServletResponse);
-        } catch (Throwable t) {
-            log.info("Old Servlet API :" + t);
-        }
+        httpServletRequest.getRequestDispatcher(Constants.AXIS_WEB_CONTENT_ROOT + jspName)
+                .include(httpServletRequest, httpServletResponse);
     }
 
     private void preloadMethods() {
@@ -158,11 +154,7 @@
 
     protected void populateSessionInformation(HttpServletRequest req) {
         HashMap services = configContext.getAxisConfiguration().getServices();
-        try {
-            req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-            req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
-        } catch (Throwable t){
-            log.info("Old Servlet API :" + t);    
-        }
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
     }
 }

Modified: webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java?rev=902271&r1=902270&r2=902271&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java Fri Jan 22 21:19:05 2010
@@ -126,11 +126,7 @@
     protected void doPost(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException {
         //set the initial buffer for a larger value
-        try {
         response.setBufferSize(BUFFER_SIZE);
-        } catch (Throwable t){
-            log.info("Old Servlet API :" + t);
-        }
 
         preprocessRequest(request);
 
@@ -142,13 +138,7 @@
             msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
             try {
                 // adding ServletContext into msgContext;
-                String url;
-                try {
-                    url = request.getRequestURL().toString();
-                } catch (Throwable t){
-                    log.info("Old Servlet API (fallback to HttpServletRequest.getRequestURI) :" + t);    
-                    url = request.getRequestURI();
-                }
+                String url = request.getRequestURL().toString();
                 
                 OutputStream bufferedOut = new BufferedOutputStream(out);
                 
@@ -591,14 +581,7 @@
         if (contextRoot != null && contextRoot.trim().length() != 0) {
             return;
         }
-        String contextPath = null;
-        // Support older servlet API's
-        try {
-            contextPath = req.getContextPath();
-        } catch (Throwable t) {
-            log.info("Old Servlet API (Fallback to HttpServletRequest.getServletPath) :" + t);    
-            contextPath = req.getServletPath();
-        }
+        String contextPath = req.getContextPath();
         //handling ROOT scenario, for servlets in the default (root) context, this method returns ""
         if (contextPath != null && contextPath.length() == 0) {
             contextPath = "/";
@@ -668,16 +651,8 @@
         MessageContext msgContext = configContext.createMessageContext();
         String requestURI = request.getRequestURI();
 
-        String trsPrefix = null;
-        int sepindex = -1;
-        // Support older servlet API's
-        try { 
-            trsPrefix = request.getRequestURL().toString();
-        } catch (Throwable t){
-            log.info("Old Servlet API (Fallback to HttpServletRequest.getRequestURI) :" + t);    
-            trsPrefix = request.getRequestURI();
-        }
-        sepindex = trsPrefix.indexOf(':');
+        String trsPrefix = request.getRequestURL().toString();
+        int sepindex = trsPrefix.indexOf(':');
         if (sepindex > -1) {
             trsPrefix = trsPrefix.substring(0, sepindex);
             msgContext.setIncomingTransportName(trsPrefix);

Modified: webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServletListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServletListener.java?rev=902271&r1=902270&r2=902271&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServletListener.java (original)
+++ webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/AxisServletListener.java Fri Jan 22 21:19:05 2010
@@ -107,19 +107,13 @@
         SessionContext sessionContext =
                 (SessionContext) req.getSession(true).getAttribute(
                         Constants.SESSION_CONTEXT_PROPERTY);
-        String sessionId = null;
-        try {
-            sessionId = req.getSession().getId();
-            if (sessionContext == null) {
+        String sessionId = req.getSession().getId();
+        if (sessionContext == null) {
             sessionContext = new SessionContext(null);
             sessionContext.setCookieID(sessionId);
             req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
                                           sessionContext);
         }
-        } catch (Throwable t){
-            log.info("Old Servlet API :" + t);
-            return null;
-        }
         messageContext.setSessionContext(sessionContext);
         messageContext.setProperty(AxisServlet.SESSION_ID, sessionId);
         return sessionContext;

Modified: webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/ListingAgent.java?rev=902271&r1=902270&r2=902271&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/ListingAgent.java Fri Jan 22 21:19:05 2010
@@ -83,11 +83,7 @@
         String serviceName = req.getParameter("serviceName");
         if (serviceName != null) {
             AxisService service = configContext.getAxisConfiguration().getService(serviceName);
-            try {
-                req.getSession().setAttribute(Constants.SINGLE_SERVICE, service);
-            } catch (Throwable t) {
-                log.info("Old Servlet API :" + t);
-            }
+            req.getSession().setAttribute(Constants.SINGLE_SERVICE, service);
         }
         renderView(LIST_FAULTY_SERVICES_JSP_NAME, req, res);
     }
@@ -167,13 +163,7 @@
                                    HttpServletResponse res)
             throws IOException, ServletException {
 
-        String url;
-        try {
-        url = req.getRequestURL().toString();
-        } catch (Throwable t) {
-            log.info("Old Servlet API (Fallback to HttpServletRequest.getRequestURI) :" + t);    
-            url = req.getRequestURI();
-        }
+        String url = req.getRequestURL().toString();
         String serviceName = extractServiceName(url);
         HashMap services = configContext.getAxisConfiguration().getServices();
         String query = req.getQueryString();
@@ -311,19 +301,11 @@
 
                     return;
                 } else {
-                    try {
-                        req.getSession().setAttribute(Constants.SINGLE_SERVICE,
-                                serviceObj);
-                    } catch (Throwable t) {
-                        log.info("Old Servlet API :" + t);
-                    }
+                    req.getSession().setAttribute(Constants.SINGLE_SERVICE,
+                            serviceObj);
                 }
             } else {
-                try {
-                    req.getSession().setAttribute(Constants.SINGLE_SERVICE, null);
-                } catch (Throwable t){
-                    log.info("Old Servlet API :" + t);    
-                }
+                req.getSession().setAttribute(Constants.SINGLE_SERVICE, null);
                     
                 res.sendError(HttpServletResponse.SC_NOT_FOUND, url);
             }
@@ -339,12 +321,8 @@
            return;
         }
         populateSessionInformation(req);
-        try {
-            req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
-                                          configContext.getAxisConfiguration().getFaultyServices());
-        } catch (Throwable t){
-            log.info("Old Servlet API :" + t);    
-        }
+        req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
+                                      configContext.getAxisConfiguration().getFaultyServices());
         renderView(LIST_MULTIPLE_SERVICE_JSP_NAME, req, res);
     }