axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@sundn.de>
Subject AW: cvs commit: xml-axis/java/src/org/apache/axis/utils Options.java
Date Tue, 02 Oct 2001 15:18:31 GMT
Many thanks, Glen, for applying the patch!!!


Carsten

Open Source Group                        sunShine - b:Integrated
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de                          mailto: cziegeler@sundn.de
================================================================

> -----Urspr√ľngliche Nachricht-----
> Von: gdaniels@apache.org [mailto:gdaniels@apache.org]
> Gesendet: Dienstag, 2. Oktober 2001 17:02
> An: xml-axis-cvs@apache.org
> Betreff: cvs commit: xml-axis/java/src/org/apache/axis/utils
> Options.java
>
>
> gdaniels    01/10/02 08:01:31
>
>   Modified:    java     build.xml
>                java/src/org/apache/axis AxisEngine.java
>                java/src/org/apache/axis/transport/http HTTPSender.java
>                java/src/org/apache/axis/utils Options.java
>   Added:       java/src log4j.properties
>   Log:
>   Two changes:
>
>   1) Merge in Carsten Zeigeler's HTTPSender proxy support code.
>
>   2) Enable more reasonable log4j initialization.  Put a log4j.properties
>       file at the top level of the axis.jar, so it'll get picked
> up if another
>       one (from the app server for instance) doesn't get found first.
>
>   Revision  Changes    Path
>   1.45      +3 -0      xml-axis/java/build.xml
>
>   Index: build.xml
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/build.xml,v
>   retrieving revision 1.44
>   retrieving revision 1.45
>   diff -u -r1.44 -r1.45
>   --- build.xml	2001/09/20 22:04:44	1.44
>   +++ build.xml	2001/10/02 15:01:31	1.45
>   @@ -164,8 +164,11 @@
>              toDir="${build.dest}/org/apache/axis/server"/>
>        <copy file="${src.dir}/org/apache/axis/client/client-config.xml"
>              toDir="${build.dest}/org/apache/axis/client"/>
>   +    <copy file="${src.dir}/log4j.properties"
>   +          toDir="${build.dest}"/>
>        <jar jarfile="${build.lib}/${name}.jar" basedir="${build.dest}" >
>          <include name="org/**" />
>   +      <include name="log4j.properties"/>
>        </jar>
>        <copy file="${wsdl4j.jar}" toDir="${build.lib}"/>
>        <copy file="${log4j-core.jar}" toDir="${build.lib}"/>
>
>
>
>   1.1                  xml-axis/java/src/log4j.properties
>
>   Index: log4j.properties
>   ===================================================================
>   # Set root category priority to ERROR and its only appender to A1.
>   log4j.rootCategory=ERROR, A1
>
>   # A1 is set to be a ConsoleAppender.
>   log4j.appender.A1=org.apache.log4j.ConsoleAppender
>
>   # A1 uses PatternLayout.
>   log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>   log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
>
>
>
>   1.32      +9 -19     xml-axis/java/src/org/apache/axis/AxisEngine.java
>
>   Index: AxisEngine.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
>   retrieving revision 1.31
>   retrieving revision 1.32
>   diff -u -r1.31 -r1.32
>   --- AxisEngine.java	2001/09/05 17:22:58	1.31
>   +++ AxisEngine.java	2001/10/02 15:01:31	1.32
>   @@ -55,24 +55,19 @@
>
>    package org.apache.axis;
>
>   -import java.io.*;
>   -import java.net.URL;
>   -import java.util.* ;
>   -import org.apache.axis.* ;
>   -import org.apache.axis.client.Transport;
>   -import org.apache.axis.utils.* ;
>   -import org.apache.axis.handlers.* ;
>   -import org.apache.axis.handlers.soap.* ;
>   -import org.apache.axis.registries.* ;
>   +import org.apache.axis.encoding.DeserializerFactory;
>   +import org.apache.axis.encoding.SOAPTypeMappingRegistry;
>   +import org.apache.axis.encoding.Serializer;
>   +import org.apache.axis.encoding.TypeMappingRegistry;
>   +import org.apache.axis.handlers.BasicHandler;
>   +import org.apache.axis.handlers.soap.SOAPService;
>   +import org.apache.axis.registries.HandlerRegistry;
>   +import org.apache.axis.registries.SupplierRegistry;
>    import org.apache.axis.session.Session;
>    import org.apache.axis.session.SimpleSession;
>   -import org.apache.axis.encoding.*;
>   +import org.apache.axis.utils.QName;
>    import org.apache.log4j.Category;
>   -import org.apache.log4j.BasicConfigurator;
>   -import org.apache.log4j.Priority;
>
>   -import org.w3c.dom.*;
>   -
>    /**
>     * An <code>AxisEngine</code> is the base class for AxisClient and
>     * AxisServer.  Handles common functionality like dealing with the
>   @@ -84,11 +79,6 @@
>    {
>        static Category category =
>                Category.getInstance(AxisEngine.class.getName());
>   -
>   -    static {
>   -        BasicConfigurator.configure();
>   -        Category.getRoot().setPriority(Priority.FATAL);
>   -    }
>
>        // Engine property names
>        public static final String PROP_XML_DECL = "sendXMLDeclaration";
>
>
>
>   1.20      +27 -14
> 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/HTTPSen
> der.java,v
>   retrieving revision 1.19
>   retrieving revision 1.20
>   diff -u -r1.19 -r1.20
>   --- HTTPSender.java	2001/09/14 19:12:23	1.19
>   +++ HTTPSender.java	2001/10/02 15:01:31	1.20
>   @@ -96,6 +96,7 @@
>                URL      tmpURL = new URL( targetURL );
>                byte[]   buf    = new byte[4097];
>                int      returnCode     = 0 ;
>   +            boolean  useFullURL = false;
>
>                // default SOAPAction to request namespaceURI/method
>                String   action =
> msgContext.getStrProp(HTTPConstants.MC_HTTP_SOAPACTION);
>   @@ -112,11 +113,11 @@
>                if ( (port = tmpURL.getPort()) == -1 ) port = 80;
>
>                Socket             sock = null ;
>   +            String proxyHost = System.getProperty("https.proxyHost");
>   +            String proxyPort = System.getProperty("https.proxyPort");
>
>                if (tmpURL.getProtocol().equalsIgnoreCase("https")) {
>                    if ( (port = tmpURL.getPort()) == -1 ) port = 443;
>   -                String tunnelHost =
> System.getProperty("https.proxyHost");
>   -                String tunnelPortString =
> System.getProperty("https.proxyPort");
>                    String tunnelUsername =
> System.getProperty("https.proxyUsername");
>                    String tunnelPassword =
> System.getProperty("https.proxyPassword");
>                    try {
>   @@ -132,7 +133,7 @@
>
> SSLSocketClass.getMethod("startHandshake", new Class[] {});
>                        Object factory =
> getDefaultMethod.invoke(null, new Object[] {});
>                        Object sslSocket = null;
>   -                    if (tunnelHost == null || tunnelHost.equals("")) {
>   +                    if (proxyHost == null || proxyHost.equals("")) {
>                            // direct SSL connection
>                            sslSocket = createSocketMethod .invoke(factory,
>
> new Object[] {host, new Integer(port)});
>   @@ -141,9 +142,9 @@
>                            Method createSocketMethod2 =
>
> SSLSocketFactoryClass.getMethod("createSocket",
>
>                      new Class[] {Socket.class, String.class,
> Integer.TYPE, Boolean.TYPE});
>   -                        int tunnelPort = (tunnelPortString !=
> null? (Integer.parseInt(tunnelPortString) < 0? 443:
> Integer.parseInt(tunnelPortString)): 443);
>   +                        int tunnelPort = (proxyPort != null?
> (Integer.parseInt(proxyPort) < 0? 443: Integer.parseInt(proxyPort)): 443);
>                            Object tunnel = createSocketMethod
> .invoke(factory,
>   -
>     new Object[] {tunnelHost, new Integer(tunnelPort)});
>   +
>     new Object[] {proxyHost, new Integer(tunnelPort)});
>                            // The tunnel handshake method
> (condensed and made reflexive)
>                            OutputStream tunnelOutputStream =
> (OutputStream)SSLSocketClass.getMethod("getOutputStream", new
> Class[] {}).invoke(tunnel, new Object[] {});
>                            PrintWriter out = new PrintWriter(new
> BufferedWriter(new OutputStreamWriter(tunnelOutputStream)));
>   @@ -156,12 +157,12 @@
>                            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")) {
>   -                            throw new IOException("Unable to
> tunnel through " + tunnelHost + ":" + tunnelPort + ".  Proxy
> returns \"" + replyStr + "\"");
>   +                            throw new IOException("Unable to
> tunnel through " + proxyHost + ":" + tunnelPort + ".  Proxy
> returns \"" + replyStr + "\"");
>                            }
>                            // End of condensed reflective tunnel
> handshake method
>                            sslSocket = createSocketMethod2.invoke(factory,
>
> new Object[] {tunnel, host, new Integer(port), new Boolean(true)});
>   -                        category.debug( "Set up SSL tunnelling
> through " + tunnelHost + ":" +tunnelPort);
>   +                        category.debug( "Set up SSL tunnelling
> through " + proxyHost + ":" +tunnelPort);
>                        }
>                        // must shake out hidden errors!
>                        startHandshakeMethod.invoke(sslSocket, new
> Object[] {});
>   @@ -170,14 +171,22 @@
>                        category.debug( "SSL feature disallowed:
> JSSE files not installed or present in classpath");
>                        throw new AxisFault(cnfe);
>                    } catch (NumberFormatException nfe) {
>   -                      category.debug( "Proxy port number, \""
> + tunnelPortString + "\", incorrectly formatted");
>   +                      category.debug( "Proxy port number, \""
> + proxyPort + "\", incorrectly formatted");
>                          throw new AxisFault(nfe);
>                    }
>                    category.debug( "Created an SSL connection");
>                } else {
>                    if ((port = tmpURL.getPort()) == -1 ) port = 80;
>   -                sock    = new Socket( host, port );
>   -                category.debug( "Created an insecure HTTP connection");
>   +
>   +                if (proxyHost == null || proxyHost.equals("")
>   +                    || proxyPort == null || proxyPort.equals("")) {
>   +                    sock = new Socket( host, port );
>   +                    category.debug( "Created an insecure HTTP
> connection");
>   +                } else {
>   +                    sock = new Socket( proxyHost, new
> Integer(proxyPort).intValue() );
>   +                    category.debug( "Created an insecure HTTP
> connection using proxy "+proxyHost+" port "+proxyPort);
>   +                    useFullURL = true;
>   +                }
>                }
>
>                // optionally set a timeout for the request
>   @@ -234,10 +243,14 @@
>                byte[] request = reqEnv.getBytes();
>
>                header.append( HTTPConstants.HEADER_POST )
>   -             .append(" " )
>   -             .append( ((tmpURL.getFile() == null ||
>   -                        tmpURL.getFile().equals(""))? "/":
> tmpURL.getFile()) )
>   -             .append( " HTTP/1.0\r\n" )
>   +             .append(" " );
>   +            if (useFullURL == true) {
>   +                header.append(tmpURL.toExternalForm());
>   +            } else {
>   +                header.append( ((tmpURL.getFile() == null ||
>   +                        tmpURL.getFile().equals(""))? "/":
> tmpURL.getFile()) );
>   +            }
>   +            header.append( " HTTP/1.0\r\n" )
>                 .append( HTTPConstants.HEADER_CONTENT_LENGTH )
>                 .append( ": " )
>                 .append( request.length )
>
>
>
>   1.16      +3 -8
> xml-axis/java/src/org/apache/axis/utils/Options.java
>
>   Index: Options.java
>   ===================================================================
>   RCS file:
> /home/cvs/xml-axis/java/src/org/apache/axis/utils/Options.java,v
>   retrieving revision 1.15
>   retrieving revision 1.16
>   diff -u -r1.15 -r1.16
>   --- Options.java	2001/09/06 17:43:40	1.15
>   +++ Options.java	2001/10/02 15:01:31	1.16
>   @@ -63,20 +63,15 @@
>     */
>
>    import org.apache.log4j.Category;
>   -import org.apache.log4j.BasicConfigurator;
>    import org.apache.log4j.Priority;
>
>   -import java.net.* ;
>   -import java.util.* ;
>   +import java.net.MalformedURLException;
>   +import java.net.URL;
>   +import java.util.ArrayList;
>
>    public class Options {
>        static Category category =
>                Category.getInstance(Options.class.getName());
>   -
>   -    static {
>   -        BasicConfigurator.configure();
>   -        Category.getRoot().setPriority(Priority.FATAL);
>   -    }
>
>        String  args[] = null ;
>
>
>
>


Mime
View raw message