axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/transport/local LocalResponder.java
Date Thu, 15 Nov 2001 14:45:57 GMT
rubys       01/11/15 06:45:57

  Modified:    java/src/org/apache/axis/handlers
                        SimpleAuthorizationHandler.java
               java/src/org/apache/axis/security/simple
                        SimpleSecurityProvider.java
               java/src/org/apache/axis/transport/http HTTPSender.java
               java/src/org/apache/axis/transport/local LocalResponder.java
  Log:
  Eliminate more calls to java.text.MessageFormat.  This should take care of
  everything involved in a stock quote using either a Local or HTTP transport.
  
  Revision  Changes    Path
  1.24      +32 -8     xml-axis/java/src/org/apache/axis/handlers/SimpleAuthorizationHandler.java
  
  Index: SimpleAuthorizationHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/SimpleAuthorizationHandler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SimpleAuthorizationHandler.java	2001/11/07 15:13:46	1.23
  +++ SimpleAuthorizationHandler.java	2001/11/15 14:45:57	1.24
  @@ -85,7 +85,10 @@
        * Authorize the user and targetService from the msgContext
        */
       public void invoke(MessageContext msgContext) throws AxisFault {
  -        category.debug(JavaUtils.getMessage("enter00", "SimpleAuthorizationHandler::invoke")
);
  +        if (category.isDebugEnabled()) {
  +            category.debug(JavaUtils.getMessage("enter00", 
  +                "SimpleAuthorizationHandler::invoke") );
  +        }
   
           boolean allowByDefault = false;
           String optVal = (String)getOption("allowByDefault");
  @@ -110,15 +113,24 @@
           String allowedRoles = (String)serviceHandler.getOption("allowedRoles");
           if (allowedRoles == null) {
               if (allowByDefault) {
  -                category.info(JavaUtils.getMessage( "noRoles00"));
  +                if (category.isInfoEnabled()) {
  +                    category.info(JavaUtils.getMessage( "noRoles00"));
  +                }
               }
               else {
  -                category.info(JavaUtils.getMessage( "noRoles01"));
  +                if (category.isInfoEnabled()) {
  +                    category.info(JavaUtils.getMessage( "noRoles01"));
  +                }
  +
                   throw new AxisFault( "Server.Unauthorized",
                       JavaUtils.getMessage("notAuth00", userID, serviceName),
                       null, null );
  +            }
  +
  +            if (category.isDebugEnabled()) {
  +                category.debug(JavaUtils.getMessage("exit00", 
  +                    "SimpleAuthorizationHandler::invoke") );
               }
  -            category.debug(JavaUtils.getMessage("exit00", "SimpleAuthorizationHandler::invoke")
);
               return;
           }
   
  @@ -130,8 +142,16 @@
           while (st.hasMoreTokens()) {
               String thisRole = st.nextToken();
               if (provider.userMatches(user, thisRole)) {
  -                category.info(JavaUtils.getMessage("auth01", userID, serviceName));
  -                category.debug(JavaUtils.getMessage("exit00", "SimpleAuthorizationHandler::invoke")
);
  +
  +                if (category.isInfoEnabled()) {
  +                    category.info(JavaUtils.getMessage("auth01", 
  +                        userID, serviceName));
  +                }
  +
  +                if (category.isDebugEnabled()) {
  +                    category.debug(JavaUtils.getMessage("exit00", 
  +                        "SimpleAuthorizationHandler::invoke") );
  +                }
                   return;
               }
           }
  @@ -145,7 +165,11 @@
        * Nothing to undo
        */
       public void undo(MessageContext msgContext) {
  -        category.debug(JavaUtils.getMessage("enter00", "SimpleAuthorizationHandler::undo")
);
  -        category.debug(JavaUtils.getMessage("exit00", "SimpleAuthorizationHandler::undo")
);
  +        if (category.isDebugEnabled()) {
  +            category.debug(JavaUtils.getMessage("enter00", 
  +                "SimpleAuthorizationHandler::undo") );
  +            category.debug(JavaUtils.getMessage("exit00", 
  +                "SimpleAuthorizationHandler::undo") );
  +        }
       }
   };
  
  
  
  1.11      +11 -3     xml-axis/java/src/org/apache/axis/security/simple/SimpleSecurityProvider.java
  
  Index: SimpleSecurityProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/security/simple/SimpleSecurityProvider.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SimpleSecurityProvider.java	2001/11/15 12:08:11	1.10
  +++ SimpleSecurityProvider.java	2001/11/15 14:45:57	1.11
  @@ -145,7 +145,9 @@
           String password = msgContext.getStrProp(MessageContext.PASSWORD);
   
           if (users != null) {
  -            category.debug( JavaUtils.getMessage("user00", username) );
  +            if (category.isDebugEnabled()) {
  +                category.debug( JavaUtils.getMessage("user00", username) );
  +            }
   
               // in order to authenticate, the user must exist
               if ( username == null ||
  @@ -154,13 +156,19 @@
                   return null;
   
               String valid = (String) users.get(username);
  -            category.debug( JavaUtils.getMessage("password00", password) );
   
  +            if (category.isDebugEnabled()) {
  +                category.debug( JavaUtils.getMessage("password00", password) );
  +            }
  +
               // if a password is defined, then it must match
               if ( valid.length()>0 && !valid.equals(password) )
                   return null;
  +
  +            if (category.isDebugEnabled()) {
  +                category.debug( JavaUtils.getMessage("auth00", username) );
  +            }
   
  -            category.debug( JavaUtils.getMessage("auth00", username) );
               return new SimpleAuthenticatedUser(username);
           }
   
  
  
  
  1.35      +64 -16    xml-axis/java/src/org/apache/axis/transport/http/HTTPSender.java
  
  Index: HTTPSender.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPSender.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- HTTPSender.java	2001/11/12 16:43:11	1.34
  +++ HTTPSender.java	2001/11/15 14:45:57	1.35
  @@ -88,7 +88,11 @@
               Category.getInstance(HTTPSender.class.getName());
   
       public void invoke(MessageContext msgContext) throws AxisFault {
  -        category.debug( JavaUtils.getMessage("enter00", "HTTPSender::invoke") );
  +        if (category.isDebugEnabled()) {
  +            category.debug( JavaUtils.getMessage("enter00", 
  +                "HTTPSender::invoke") );
  +        }
  +
           /* Find the service we're invoking so we can grab it's options */
           /***************************************************************/
           String   targetURL = null ;
  @@ -160,7 +164,12 @@
                           InputStream tunnelInputStream = (InputStream)SSLSocketClass.getMethod("getInputStream",
new Class[] {}).invoke(tunnel, new Object[] {});
                           //BufferedReader in = new BufferedReader(new InputStreamReader(tunnelInputStream));
                           //DataInputStream in = new DataInputStream(tunnelInputStream);
  -                        category.debug(JavaUtils.getMessage("isNull00", "tunnelInputStream",
"" + (tunnelInputStream == null)));
  +                        if (category.isDebugEnabled()) {
  +                            category.debug(JavaUtils.getMessage("isNull00", 
  +                              "tunnelInputStream", 
  +                              "" + (tunnelInputStream == null)));
  +                        }
  +
                           String replyStr = ""; int i;
                           while ((i = tunnelInputStream.read()) != '\n' && i != '\r'
&& i != -1) { replyStr += String.valueOf((char)i); }
                           if (!replyStr.startsWith("HTTP/1.0 200") && !replyStr.startsWith("HTTP/1.1
200")) {
  @@ -170,20 +179,33 @@
                           // End of condensed reflective tunnel handshake method
                           sslSocket = createSocketMethod2.invoke(factory,
                                                                  new Object[] {tunnel, host,
new Integer(port), new Boolean(true)});
  -                        category.debug(JavaUtils.getMessage(
  +
  +                        if (category.isDebugEnabled()) {
  +                            category.debug(JavaUtils.getMessage(
                                   "setupTunnel00", tunnelHost, "" + tunnelPort));
  +                        }
                       }
                       // must shake out hidden errors!
                       startHandshakeMethod.invoke(sslSocket, new Object[] {});
                       sock = (Socket)sslSocket;
                   } catch (ClassNotFoundException cnfe) {
  -                    category.debug( JavaUtils.getMessage("noJSSE00"));
  +                    if (category.isDebugEnabled()) {
  +                        category.debug( JavaUtils.getMessage("noJSSE00"));
  +                    }
  +
                       throw new AxisFault(cnfe);
                   } catch (NumberFormatException nfe) {
  -                      category.debug( JavaUtils.getMessage("badProxy00", tunnelPortStr));
  +                      if (category.isDebugEnabled()) {
  +                          category.debug( JavaUtils.getMessage("badProxy00", 
  +                              tunnelPortStr));
  +                      }
  +
                         throw new AxisFault(nfe);
  +                }
  +
  +                if (category.isDebugEnabled()) {
  +                    category.debug( JavaUtils.getMessage("createdSSL00"));
                   }
  -                category.debug( JavaUtils.getMessage("createdSSL00"));
               } else {
                   String proxyHost = System.getProperty("http.proxyHost");
                   String proxyPort = System.getProperty("http.proxyPort");
  @@ -196,10 +218,18 @@
                       || proxyPort == null || proxyPort.equals("")
                       || hostInNonProxyList) {
                       sock = new Socket( host, port );
  -                    category.debug( JavaUtils.getMessage("createdHTTP00"));
  +
  +                    if (category.isDebugEnabled()) {
  +                        category.debug( JavaUtils.getMessage("createdHTTP00"));
  +                    }
                   } else {
                       sock = new Socket( proxyHost, new Integer(proxyPort).intValue() );
  -                    category.debug( JavaUtils.getMessage("createdHTTP01", proxyHost, proxyPort));
  +                    
  +                    if (category.isDebugEnabled()) {
  +                        category.debug( JavaUtils.getMessage("createdHTTP01", 
  +                            proxyHost, proxyPort));
  +                    }
  +
                       useFullURL = true;
                   }
               }
  @@ -291,9 +321,11 @@
               reqMessage.writeContentToStream(out);
               out.flush();
   
  -            category.debug( JavaUtils.getMessage("xmlSent00") );
  -            category.debug( "---------------------------------------------------");
  -            category.debug( header + reqEnv );
  +            if (category.isDebugEnabled()) {
  +                category.debug( JavaUtils.getMessage("xmlSent00") );
  +                category.debug( "---------------------------------------------------");
  +                category.debug( header + reqEnv );
  +            }
   
               byte       lastB=0, b ;
               int        len = 0 ;
  @@ -324,7 +356,11 @@
                           name = new String( buf, 0, len );
                           value = "" ;
                       }
  -                    category.debug( name + value );
  +
  +                    if (category.isDebugEnabled()) {
  +                        category.debug( name + value );
  +                    }
  +
                       if ( msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE)==null){
                           // Reader status code
                           int start = name.indexOf( ' ' ) + 1 ;
  @@ -416,7 +452,11 @@
               if ( !(e instanceof AxisFault) ) e = new AxisFault(e);
               throw (AxisFault) e ;
           }
  -        category.debug( JavaUtils.getMessage("exit00", "HTTPDispatchHandler::invoke") );
  +
  +        if (category.isDebugEnabled()) {
  +            category.debug( JavaUtils.getMessage("exit00", 
  +                "HTTPDispatchHandler::invoke") );
  +        }
       }
   
       // little helper function for cookies
  @@ -443,9 +483,13 @@
           StringTokenizer tokenizer = new StringTokenizer(nonProxyHosts,"|");
           while(tokenizer.hasMoreTokens()) {
               String pattern = tokenizer.nextToken();
  -            category.debug( JavaUtils.getMessage(
  +
  +            if (category.isDebugEnabled()) {
  +                category.debug( JavaUtils.getMessage(
                       "match00",
                       new String[] {"HTTPSender", host, pattern}));
  +            }
  +
               if(match(pattern, host, false))
                   return true;
           }
  @@ -606,8 +650,12 @@
   
   
       public void undo(MessageContext msgContext) {
  -        category.debug( JavaUtils.getMessage("enter00", "HTTPDispatchHandler::undo") );
  -        category.debug( JavaUtils.getMessage("exit00", "HTTPDispatchHandler::undo") );
  +        if (category.isDebugEnabled()) {
  +            category.debug( JavaUtils.getMessage("enter00", 
  +                "HTTPDispatchHandler::undo") );
  +            category.debug( JavaUtils.getMessage("exit00", 
  +                "HTTPDispatchHandler::undo") );
  +        }
       }
   };
   
  
  
  
  1.10      +16 -4     xml-axis/java/src/org/apache/axis/transport/local/LocalResponder.java
  
  Index: LocalResponder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalResponder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LocalResponder.java	2001/11/08 21:43:59	1.9
  +++ LocalResponder.java	2001/11/15 14:45:57	1.10
  @@ -72,13 +72,25 @@
               Category.getInstance(LocalResponder.class.getName());
   
       public void invoke(MessageContext msgContext) throws AxisFault {
  -        category.debug(JavaUtils.getMessage("enter00", "LocalResponder::invoke") );
  +        if (category.isDebugEnabled()) {
  +            category.debug(JavaUtils.getMessage("enter00", 
  +                "LocalResponder::invoke") );
  +        }
  +
           msgContext.getResponseMessage().getSOAPPart().getAsString();
  -        category.debug(JavaUtils.getMessage("exit00", "LocalResponder::invoke") );
  +
  +        if (category.isDebugEnabled()) {
  +            category.debug(JavaUtils.getMessage("exit00", 
  +                "LocalResponder::invoke") );
  +        }
       }
   
       public void undo(MessageContext msgContext) {
  -        category.debug(JavaUtils.getMessage("enter00", "LocalResponder::undo") );
  -        category.debug(JavaUtils.getMessage("exit00", "LocalResponder::undo") );
  +        if (category.isDebugEnabled()) {
  +            category.debug(JavaUtils.getMessage("enter00", 
  +                "LocalResponder::undo") );
  +            category.debug(JavaUtils.getMessage("exit00", 
  +                "LocalResponder::undo") );
  +        }
       }
   };
  
  
  

Mime
View raw message