You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ve...@apache.org on 2009/08/16 12:38:11 UTC

svn commit: r804656 - in /webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http: AxisServlet.java TransportHeaders.java

Author: veithen
Date: Sun Aug 16 10:38:10 2009
New Revision: 804656

URL: http://svn.apache.org/viewvc?rev=804656&view=rev
Log:
Fixed some warnings.

Modified:
    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/TransportHeaders.java

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=804656&r1=804655&r2=804656&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 Sun Aug 16 10:38:10 2009
@@ -66,7 +66,6 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintWriter;
-import java.net.SocketException;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Map;
@@ -77,8 +76,9 @@
  * Class AxisServlet
  */
 public class AxisServlet extends HttpServlet implements TransportListener {
-
-    private static final Log log = LogFactory.getLog(AxisServlet.class);
+    private static final long serialVersionUID = 3105135058353738906L;
+    
+    static final Log log = LogFactory.getLog(AxisServlet.class);
     public static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
     public static final String SESSION_ID = "SessionId";
     
@@ -110,6 +110,7 @@
      * @throws ServletException
      * @throws IOException
      */
+    @Override
     protected void doPost(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException {
         //set the initial buffer for a larger value
@@ -226,7 +227,7 @@
      * @throws ServletException
      * @throws IOException
      */
-
+    @Override
     protected void doGet(HttpServletRequest request,
                          HttpServletResponse response) throws ServletException, IOException {
 
@@ -272,7 +273,7 @@
      * @throws ServletException
      * @throws IOException
      */
-
+    @Override
     protected void doDelete(HttpServletRequest request,
                             HttpServletResponse response) throws ServletException, IOException {
 
@@ -294,6 +295,7 @@
      * @throws ServletException
      * @throws IOException
      */
+    @Override
     protected void doPut(HttpServletRequest request,
                          HttpServletResponse response) throws ServletException, IOException {
 
@@ -327,7 +329,7 @@
      * @param messageContext
      * @throws ServletException
      */
-    private void closeStaxBuilder(MessageContext messageContext) throws ServletException {
+    void closeStaxBuilder(MessageContext messageContext) throws ServletException {
         if (closeReader && messageContext != null) {
             try {
                 SOAPEnvelope envelope = messageContext.getEnvelope();
@@ -351,8 +353,8 @@
      * @param out
      * @param e
      */
-    private void processAxisFault(MessageContext msgContext, HttpServletResponse res,
-                                  OutputStream out, AxisFault e) {
+    void processAxisFault(MessageContext msgContext, HttpServletResponse res,
+                          OutputStream out, AxisFault e) {
         try {
             // If the fault is not going along the back channel we should be 202ing
             if (AddressingHelper.isFaultRedirected(msgContext)) {
@@ -427,6 +429,7 @@
      * @param config
      * @throws ServletException
      */
+    @Override
     public void init(ServletConfig config) throws ServletException {
         
         // prevent this method from being called more than once per instance
@@ -463,6 +466,7 @@
     /**
      * distroy the ConfigurationContext
      */
+    @Override
     public void destroy() {
         //stoping listner manager
         try {
@@ -503,6 +507,7 @@
      *
      * @throws ServletException
      */
+    @Override
     public void init() throws ServletException {
         if (this.servletConfig != null
                 &&
@@ -563,7 +568,7 @@
      * @param req
      * @return Map
      */
-    protected Map getTransportHeaders(HttpServletRequest req) {
+    protected Map<String,String> getTransportHeaders(HttpServletRequest req) {
         return new TransportHeaders(req);
     }
 
@@ -671,7 +676,7 @@
 
         //setting the RequestResponseTransport object
         msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
-                new ServletRequestResponseTransport(response));
+                new ServletRequestResponseTransport());
 
         return msgContext;
     }
@@ -715,7 +720,6 @@
     }
 
     protected class ServletRequestResponseTransport implements RequestResponseTransport {
-        private HttpServletResponse response;
         private boolean responseWritten = false;
         private CountDownLatch responseReadySignal = new CountDownLatch(1);
 		// The initial status must be WAITING, as the main servlet will do some other
@@ -724,10 +728,6 @@
         private RequestResponseTransportStatus status = RequestResponseTransportStatus.WAITING;
         AxisFault faultToBeThrownOut = null;
 
-        ServletRequestResponseTransport(HttpServletResponse response) {
-            this.response = response;
-        }
-
         public void acknowledgeMessage(MessageContext msgContext) throws AxisFault {
             status = RequestResponseTransportStatus.ACKED;
             responseReadySignal.countDown();
@@ -768,7 +768,7 @@
         
     }
 
-    private void setResponseState(MessageContext messageContext, HttpServletResponse response) {
+    void setResponseState(MessageContext messageContext, HttpServletResponse response) {
         String state = (String) messageContext.getProperty(Constants.HTTP_RESPONSE_STATE);
         if (state != null) {
             int stateInt = Integer.parseInt(state);

Modified: webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/TransportHeaders.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/TransportHeaders.java?rev=804656&r1=804655&r2=804656&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/TransportHeaders.java (original)
+++ webservices/axis2/trunk/java/modules/transport/http/src/org/apache/axis2/transport/http/TransportHeaders.java Sun Aug 16 10:38:10 2009
@@ -23,22 +23,21 @@
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
 /**
  * Pass-Thru / delayed get and put of the values from HttpServletRequest
  */
-public class TransportHeaders implements Map {
+public class TransportHeaders implements Map<String,String> {
     HttpServletRequest req;
     // This map contains the headers from the request; it will be filled in lazily if needed, 
     // for performance 
-    HashMap headerMap = null;
+    Map<String,String> headerMap = null;
     // This map contains properties that have been put onto the map; it is not populated by values
     // from the HttpServletRequest.  A null value means the headerMap has been fully populated and
     // any values that were in localHeaderMap have been migrated to headerMap.
-    HashMap localHeaderMap = new HashMap();
+    Map<String,String> localHeaderMap = new HashMap<String,String>();
 
     public TransportHeaders(HttpServletRequest req) {
         this.req = req;
@@ -56,8 +55,8 @@
      * After that localHeaderMap is released and only headerMap is used after that. 
      */
     private void init() {
-        headerMap = new HashMap();
-        Enumeration headerNames = req.getHeaderNames();
+        headerMap = new HashMap<String,String>();
+        Enumeration<?> headerNames = req.getHeaderNames();
 
         while (headerNames.hasMoreElements()) {
             String key = (String) headerNames.nextElement();
@@ -68,10 +67,7 @@
         
         // Migrate any previously set local properties to the newly created hashmap then release
         // the local hashmap
-        Set localHeaderSet = localHeaderMap.entrySet();
-        Iterator localHeaderIterator = localHeaderSet.iterator();
-        while (localHeaderIterator.hasNext()) {
-            Map.Entry localHeaderEntry = (Map.Entry) localHeaderIterator.next();
+        for (Map.Entry<String,String> localHeaderEntry : localHeaderMap.entrySet()) {
             headerMap.put(localHeaderEntry.getKey(), localHeaderEntry.getValue());
         }
         localHeaderMap = null;
@@ -114,38 +110,38 @@
         return headerMap.containsValue(value);
     }
 
-    public Collection values() {
+    public Collection<String> values() {
         if (headerMap == null) {
             init();
         }
         return headerMap.values();
     }
 
-    public void putAll(Map t) {
+    public void putAll(Map<? extends String,? extends String> t) {
         if (headerMap == null) {
             init();
         }
         headerMap.putAll(t);
     }
 
-    public Set entrySet() {
+    public Set<Map.Entry<String,String>> entrySet() {
         if (headerMap == null) {
             init();
         }
         return headerMap.entrySet();
     }
 
-    public Set keySet() {
+    public Set<String> keySet() {
         if (headerMap == null) {
             init();
         }
         return headerMap.keySet();
     }
 
-    public Object get(Object key) {
+    public String get(Object key) {
         // If there is a local map, look there first.
         if (localHeaderMap != null) {
-            Object returnValue = null;
+            String returnValue = null;
             returnValue = localHeaderMap.get(key);
             if (returnValue != null) {
                 return returnValue;
@@ -157,14 +153,14 @@
         return headerMap.get(key);
     }
 
-    public Object remove(Object key) {
+    public String remove(Object key) {
         if (headerMap == null) {
             init();
         }
         return headerMap.remove(key);
     }
 
-    public Object put(Object key, Object value) {
+    public String put(String key, String value) {
         if (localHeaderMap != null) {
             return localHeaderMap.put(key, value);
         }