axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Kopecky <ja...@idoox.com>
Subject Re: cvs commit: xml-axis/java/src/org/apache/axis/utils Constants.java
Date Wed, 07 Feb 2001 14:00:23 GMT
 Hello. 8-)
 I've committed the first part of a cleanup I see necessary.
 The cleanup incorporates:

 1) Hierarchizing the message context namespace
 2) Moving HTTP stuff to org.apache.axis.transport.http
 3) Splitting the Constants
 4) Maybe moving SOAP stuff to axis.protocol, but I'll ask about that
explicitly later.

 Enjoy! 8-)

                            Jacek Kopecky
                               Idoox



On 7 Feb 2001 jacek@apache.org wrote:

 > jacek       01/02/07 05:52:06
 > 
 >   Modified:    java/src/org/apache/axis/client HTTPCall.java
 >                         HTTPMessage.java
 >                java/src/org/apache/axis/handlers HTTPDispatchHandler.java
 >                         SimpleAuthorizationHandler.java
 >                java/src/org/apache/axis/message SOAPEnvelope.java
 >                         SOAPHeader.java
 >                java/src/org/apache/axis/server SimpleAxisEngine.java
 >   Added:       java/src/org/apache/axis Constants.java
 >                java/src/org/apache/axis/transport/http AxisServlet.java
 >                         HTTPConstants.java
 >   Removed:     java/src/org/apache/axis/server/transports AxisServlet.java
 >                java/src/org/apache/axis/utils Constants.java
 >   Log:
 >   Constants cleanup
 >   Also a little repackaging - HTTP servlet sent to org.apache.axis.transport.http
 >   More cleanup will follow.
 >   
 >   Revision  Changes    Path
 >   1.1                  xml-axis/java/src/org/apache/axis/Constants.java
 >   
 >   Index: Constants.java
 >   ===================================================================
 >   /*
 >    * The Apache Software License, Version 1.1
 >    *
 >    *
 >    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
 >    * reserved.
 >    *
 >    * Redistribution and use in source and binary forms, with or without
 >    * modification, are permitted provided that the following conditions
 >    * are met:
 >    *
 >    * 1. Redistributions of source code must retain the above copyright
 >    *    notice, this list of conditions and the following disclaimer. 
 >    *
 >    * 2. Redistributions in binary form must reproduce the above copyright
 >    *    notice, this list of conditions and the following disclaimer in
 >    *    the documentation and/or other materials provided with the
 >    *    distribution.
 >    *
 >    * 3. The end-user documentation included with the redistribution,
 >    *    if any, must include the following acknowledgment:  
 >    *       "This product includes software developed by the
 >    *        Apache Software Foundation (http://www.apache.org/)."
 >    *    Alternately, this acknowledgment may appear in the software itself,
 >    *    if and wherever such third-party acknowledgments normally appear.
 >    *
 >    * 4. The names "Axis" and "Apache Software Foundation" must
 >    *    not be used to endorse or promote products derived from this
 >    *    software without prior written permission. For written 
 >    *    permission, please contact apache@apache.org.
 >    *
 >    * 5. Products derived from this software may not be called "Apache",
 >    *    nor may "Apache" appear in their name, without prior written
 >    *    permission of the Apache Software Foundation.
 >    *
 >    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 >    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 >    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 >    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 >    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 >    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 >    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 >    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 >    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 >    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 >    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 >    * SUCH DAMAGE.
 >    * ====================================================================
 >    *
 >    * This software consists of voluntary contributions made by many
 >    * individuals on behalf of the Apache Software Foundation and was
 >    * originally based on software copyright (c) 1999, International
 >    * Business Machines, Inc., http://www.ibm.com.  For more
 >    * information on the Apache Software Foundation, please see
 >    * <http://www.apache.org/>.
 >    */
 >   
 >   package org.apache.axis;
 >   
 >   public class Constants {
 >     // Some common Constants that should be used in local handler options
 >     // (Not all implementations will have these concepts - for example
 >     //  not all Engines will have notion of registries but defining these
 >     //  here should allow people to ask if they exist)
 >     //////////////////////////////////////////////////////////////////////////
 >     public static String HANDLER_REGISTRY = "HandlerRegistry" ;
 >     public static String SERVICE_REGISTRY = "ServiceRegistry" ;
 >   
 >     // MessageContext Property Names
 >     // (A hierarchical namespace is strongly suggested 
 >     //  in order to lower the chance for conflicts)
 >     //////////////////////////////////////////////////////////////////////////
 >     public static String MC_SVC_HANDLER = "service.handler" ;   // Handler
 >   
 >     public static String MC_HTTP_STATUS_CODE    = "transport.http.statusCode" ;    
 >                                                                 // Integer
 >     public static String MC_HTTP_STATUS_MESSAGE = "transport.http.statusMessage" ; 
 >                                                                 // String
 >     public static String MC_TRANS_URL           = "transport.url" ;
 >                                                                 // String
 >     // this can be put into MC_TRANS_SOAPACTION if more transports have it
 >     public static String MC_HTTP_SOAPACTION     = "transport.soapAction" ;      
 >                                                                 // String
 >     
 >     public static String MC_USERID   = "user.id" ;              // String
 >     public static String MC_PASSWORD = "user.password" ;        // String
 >   
 >     // Envelope Stuff
 >     //////////////////////////////////////////////////////////////////////////
 >     public static String NSPREFIX_SOAP_ENV   = "SOAP-ENV" ;
 >     public static String NSPREFIX_SOAP_ENC   = "SOAP-ENC" ;
 >     public static String NSPREFIX_SCHEMA_XSI = "xsi" ;
 >     public static String NSPREFIX_SCHEMA_XSD = "xsd" ;
 >   
 >     public static String URI_SOAP_ENV =
 >                                  "http://schemas.xmlsoap.org/soap/envelope/" ;
 >     public static String URI_SOAP_ENC =
 >                                  "http://schemas.xmlsoap.org/soap/encoding/" ;
 >     public static String URI_SCHEMA_XSI =
 >                                  "http://www.w3.org/1999/XMLSchema/instance/" ;
 >     public static String URI_SCHEMA_XSD =
 >                                  "http://www.w3.org/1999/XMLSchema/" ;
 >     public static String URI_NEXT_ACTOR = 
 >                                  "http://schemas.xmlsoap.org/soap/actor/next" ;
 >   
 >     public static String ELEM_ENVELOPE = "Envelope" ;
 >     public static String ELEM_HEADER   = "Header" ;
 >     public static String ELEM_BODY     = "Body" ;
 >     public static String ELEM_FAULT    = "Fault" ;
 >   
 >     public static String ELEM_FAULT_CODE   = "faultcode" ;
 >     public static String ELEM_FAULT_STRING = "faultstring" ;
 >     public static String ELEM_FAULT_DETAIL = "detail" ;
 >     public static String ELEM_FAULT_ACTOR  = "faultactor" ;
 >   
 >     public static String ATTR_MUST_UNDERSTAND = "mustUnderstand" ;
 >     public static String ATTR_ENCODING_STYLE  = "encodingStyle" ;
 >     public static String ATTR_ACTOR           = "actor" ;
 >     public static String ATTR_ROOT            = "root" ;
 >     public static String ATTR_ID              = "id" ;
 >     public static String ATTR_HREF            = "href" ;
 >   
 >     // Misc Strings
 >     //////////////////////////////////////////////////////////////////////////
 >     public static String URI_DEBUG = "http://xml.apache.org/axis/debug" ;
 >   }
 >   
 >   
 >   
 >   1.7       +3 -2      xml-axis/java/src/org/apache/axis/client/HTTPCall.java
 >   
 >   Index: HTTPCall.java
 >   ===================================================================
 >   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/HTTPCall.java,v
 >   retrieving revision 1.6
 >   retrieving revision 1.7
 >   diff -u -r1.6 -r1.7
 >   --- HTTPCall.java	2001/02/05 22:30:10	1.6
 >   +++ HTTPCall.java	2001/02/07 13:52:05	1.7
 >   @@ -64,6 +64,7 @@
 >    import org.apache.axis.message.* ;
 >    import org.apache.axis.handlers.* ;
 >    import org.apache.axis.utils.* ;
 >   +import org.apache.axis.* ;
 >    
 >    /**
 >     *
 >   @@ -157,8 +158,8 @@
 >          reqEnv.addHeader( header );
 >        }
 >    
 >   -    msgContext.setProperty( Constants.MC_HTTP_URL, url );   // horrible name!
 >   -    msgContext.setProperty( Constants.MC_TARGET, action );   // horrible name!
 >   +    msgContext.setProperty( Constants.MC_TRANS_URL, url );
 >   +    msgContext.setProperty( Constants.MC_HTTP_SOAPACTION, action );
 >        if ( userID != null ) {
 >          msgContext.setProperty( Constants.MC_USERID, userID );
 >          if ( passwd != null )
 >   
 >   
 >   
 >   1.4       +3 -2      xml-axis/java/src/org/apache/axis/client/HTTPMessage.java
 >   
 >   Index: HTTPMessage.java
 >   ===================================================================
 >   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/HTTPMessage.java,v
 >   retrieving revision 1.3
 >   retrieving revision 1.4
 >   diff -u -r1.3 -r1.4
 >   --- HTTPMessage.java	2001/02/05 22:30:10	1.3
 >   +++ HTTPMessage.java	2001/02/07 13:52:05	1.4
 >   @@ -63,6 +63,7 @@
 >    import org.apache.axis.* ;
 >    import org.apache.axis.message.* ;
 >    import org.apache.axis.handlers.* ;
 >   +import org.apache.axis.* ;
 >    import org.apache.axis.utils.* ;
 >    
 >    /**
 >   @@ -126,8 +127,8 @@
 >          // Debug.Print( 1, (String) reqMsg.getAs("String") );
 >        // }
 >    
 >   -    msgContext.setProperty( Constants.MC_HTTP_URL, url );   // horrible name!
 >   -    msgContext.setProperty( Constants.MC_TARGET, action );   // horrible name!
 >   +    msgContext.setProperty( Constants.MC_TRANS_URL, url );
 >   +    msgContext.setProperty( Constants.MC_HTTP_SOAPACTION, action );
 >        try {
 >          client.init();
 >          client.invoke( msgContext );
 >   
 >   
 >   
 >   1.7       +8 -7      xml-axis/java/src/org/apache/axis/handlers/HTTPDispatchHandler.java
 >   
 >   Index: HTTPDispatchHandler.java
 >   ===================================================================
 >   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/HTTPDispatchHandler.java,v
 >   retrieving revision 1.6
 >   retrieving revision 1.7
 >   diff -u -r1.6 -r1.7
 >   --- HTTPDispatchHandler.java	2001/02/06 16:15:55	1.6
 >   +++ HTTPDispatchHandler.java	2001/02/07 13:52:05	1.7
 >   @@ -64,6 +64,7 @@
 >    import org.xml.sax.InputSource ;
 >    import org.apache.xerces.parsers.DOMParser ;
 >    import org.apache.axis.* ;
 >   +import org.apache.axis.transport.http.HTTPConstants ;
 >    import org.apache.axis.utils.* ;
 >    import org.apache.axis.message.* ;
 >    import org.apache.axis.encoding.Base64 ;
 >   @@ -93,7 +94,7 @@
 >        try {
 >          String   host ;
 >          int      port = 80 ;
 >   -      String   action = (String) msgContext.getProperty( Constants.MC_TARGET );
 >   +      String   action = (String) msgContext.getProperty( Constants.MC_HTTP_SOAPACTION
);
 >          URL      tmpURL        = new URL( targetURL );
 >          byte[]   buf           = new byte[4097];
 >          int      rc            = 0 ;
 >   @@ -116,18 +117,18 @@
 >          passwd = (String) msgContext.getProperty( Constants.MC_PASSWORD );
 >    
 >          if ( userID != null )
 >   -        otherHeaders = Constants.HEADER_AUTHORIZATION + ": Basic " + 
 >   +        otherHeaders = HTTPConstants.HEADER_AUTHORIZATION + ": Basic " + 
 >                           Base64.encode( (userID + ":" + 
 >                           ((passwd == null) ? "" : passwd) ).getBytes() ) + 
 >                           "\n" ;
 >    
 >   -      String  header = Constants.HEADER_POST + " " + 
 >   +      String  header = HTTPConstants.HEADER_POST + " " + 
 >                             tmpURL.getPath() + " HTTP/1.0\n" +
 >   -                       Constants.HEADER_CONTENT_LENGTH + ": " + 
 >   +                       HTTPConstants.HEADER_CONTENT_LENGTH + ": " + 
 >                                              + reqEnv.length() + "\n" +
 >   -                       Constants.HEADER_CONTENT_TYPE + ": text.xml\n" +
 >   +                       HTTPConstants.HEADER_CONTENT_TYPE + ": text.xml\n" +
 >                           (otherHeaders == null ? "" : otherHeaders) + 
 >   -                       Constants.HEADER_SOAP_ACTION + ":" + action + "\n\n" ;
 >   +                       HTTPConstants.HEADER_SOAP_ACTION + ":" + action + "\n\n" ;
 >    
 >          out.write( header.getBytes() );
 >          out.write( reqEnv.getBytes() );
 >   @@ -171,7 +172,7 @@
 >                rc = Integer.parseInt( name.substring(start, end) );
 >                msgContext.setProperty( Constants.MC_HTTP_STATUS_CODE, 
 >                                        new Integer(rc) );
 >   -            msgContext.setProperty( Constants.MC_HTTP_STATUS_LINE, 
 >   +            msgContext.setProperty( Constants.MC_HTTP_STATUS_MESSAGE, 
 >                                        name.substring(end+1));
 >              }
 >              else 
 >   
 >   
 >   
 >   1.2       +1 -1      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.1
 >   retrieving revision 1.2
 >   diff -u -r1.1 -r1.2
 >   --- SimpleAuthorizationHandler.java	2001/02/06 19:51:43	1.1
 >   +++ SimpleAuthorizationHandler.java	2001/02/07 13:52:05	1.2
 >   @@ -87,7 +87,7 @@
 >        Debug.Print( 1, "Enter: SimpleAuthenticationHandler::invoke" );
 >        try {
 >          String  userID = (String) msgContext.getProperty( Constants.MC_USERID );
 >   -      String  action = (String) msgContext.getProperty( Constants.MC_TARGET );
 >   +      String  action = (String) msgContext.getProperty( Constants.MC_HTTP_SOAPACTION
);
 >    
 >          Debug.Print( 1, "User: " + userID );
 >          Debug.Print( 1, "Action: " + action );
 >   
 >   
 >   
 >   1.9       +1 -1      xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
 >   
 >   Index: SOAPEnvelope.java
 >   ===================================================================
 >   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
 >   retrieving revision 1.8
 >   retrieving revision 1.9
 >   diff -u -r1.8 -r1.9
 >   --- SOAPEnvelope.java	2001/02/04 13:45:35	1.8
 >   +++ SOAPEnvelope.java	2001/02/07 13:52:05	1.9
 >   @@ -64,7 +64,7 @@
 >    import org.xml.sax.InputSource ;
 >    import org.apache.xerces.dom.DocumentImpl ;
 >    import org.apache.axis.message.* ;
 >   -import org.apache.axis.utils.* ;
 >   +import org.apache.axis.* ;
 >    
 >    
 >    /**
 >   
 >   
 >   
 >   1.8       +1 -1      xml-axis/java/src/org/apache/axis/message/SOAPHeader.java
 >   
 >   Index: SOAPHeader.java
 >   ===================================================================
 >   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeader.java,v
 >   retrieving revision 1.7
 >   retrieving revision 1.8
 >   diff -u -r1.7 -r1.8
 >   --- SOAPHeader.java	2001/02/04 13:45:35	1.7
 >   +++ SOAPHeader.java	2001/02/07 13:52:05	1.8
 >   @@ -63,7 +63,7 @@
 >    import org.w3c.dom.* ;
 >    import org.xml.sax.InputSource ;
 >    import org.apache.axis.message.* ;
 >   -import org.apache.axis.utils.* ;
 >   +import org.apache.axis.* ;
 >    
 >    /**
 >     *
 >   
 >   
 >   
 >   1.11      +4 -4      xml-axis/java/src/org/apache/axis/server/SimpleAxisEngine.java
 >   
 >   Index: SimpleAxisEngine.java
 >   ===================================================================
 >   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/SimpleAxisEngine.java,v
 >   retrieving revision 1.10
 >   retrieving revision 1.11
 >   diff -u -r1.10 -r1.11
 >   --- SimpleAxisEngine.java	2001/02/01 22:21:32	1.10
 >   +++ SimpleAxisEngine.java	2001/02/07 13:52:06	1.11
 >   @@ -103,11 +103,11 @@
 >        HandlerRegistry hr = (HandlerRegistry)getOption(Constants.HANDLER_REGISTRY);
 >        HandlerRegistry sr = (HandlerRegistry)getOption(Constants.SERVICE_REGISTRY);
 >    
 >   -    /* The target web-server should be place in the MC_TARGET entry in the */
 >   -    /* bag of the msgContext object.  If it's not there we need to scan    */
 >   -    /* the incoming message to find it.                                    */
 >   +    /* The target web-server should be place in the MC_HTTP_SOAPACTION     */
 >   +    /* entry in the bag of the msgContext object.  If it's not there we    */
 >   +    /* need to scan the incoming message to find it.                       */
 >        /***********************************************************************/
 >   -    String action = (String) msgContext.getProperty( Constants.MC_TARGET );
 >   +    String action = (String) msgContext.getProperty( Constants.MC_HTTP_SOAPACTION
);
 >        if ( action == null ) action = "EchoService" ; // Temporary - need 2 scan
 >    
 >        Handler h = sr.find( action );
 >   
 >   
 >   
 >   1.1                  xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
 >   
 >   Index: AxisServlet.java
 >   ===================================================================
 >   /*
 >    * The Apache Software License, Version 1.1
 >    *
 >    *
 >    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
 >    * reserved.
 >    *
 >    * Redistribution and use in source and binary forms, with or without
 >    * modification, are permitted provided that the following conditions
 >    * are met:
 >    *
 >    * 1. Redistributions of source code must retain the above copyright
 >    *    notice, this list of conditions and the following disclaimer. 
 >    *
 >    * 2. Redistributions in binary form must reproduce the above copyright
 >    *    notice, this list of conditions and the following disclaimer in
 >    *    the documentation and/or other materials provided with the
 >    *    distribution.
 >    *
 >    * 3. The end-user documentation included with the redistribution,
 >    *    if any, must include the following acknowledgment:  
 >    *       "This product includes software developed by the
 >    *        Apache Software Foundation (http://www.apache.org/)."
 >    *    Alternately, this acknowledgment may appear in the software itself,
 >    *    if and wherever such third-party acknowledgments normally appear.
 >    *
 >    * 4. The names "Axis" and "Apache Software Foundation" must
 >    *    not be used to endorse or promote products derived from this
 >    *    software without prior written permission. For written 
 >    *    permission, please contact apache@apache.org.
 >    *
 >    * 5. Products derived from this software may not be called "Apache",
 >    *    nor may "Apache" appear in their name, without prior written
 >    *    permission of the Apache Software Foundation.
 >    *
 >    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 >    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 >    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 >    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 >    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 >    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 >    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 >    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 >    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 >    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 >    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 >    * SUCH DAMAGE.
 >    * ====================================================================
 >    *
 >    * This software consists of voluntary contributions made by many
 >    * individuals on behalf of the Apache Software Foundation and was
 >    * originally based on software copyright (c) 1999, International
 >    * Business Machines, Inc., http://www.ibm.com.  For more
 >    * information on the Apache Software Foundation, please see
 >    * <http://www.apache.org/>.
 >    */
 >   
 >   package org.apache.axis.transport.http ;
 >   
 >   import java.io.*;
 >   import javax.servlet.* ;
 >   import javax.servlet.http.* ;
 >   import org.apache.axis.* ;
 >   import org.apache.axis.server.* ;
 >   import org.apache.axis.utils.* ;
 >   import org.apache.axis.encoding.Base64 ;
 >   
 >   /**
 >    *
 >    * @author Doug Davis (dug@us.ibm.com)
 >    */
 >   public class AxisServlet extends HttpServlet {
 >   
 >     private static final String AXIS_ENGINE = "AxisEngine" ;
 >   
 >     public void init() {
 >     }
 >   
 >     public void doGet(HttpServletRequest req, HttpServletResponse res)
 >                   throws ServletException, IOException {
 >       res.setContentType("text/html");
 >       res.getWriter().println( "In doGet" );
 >     }
 >   
 >     public void doPost(HttpServletRequest req, HttpServletResponse res)
 >                   throws ServletException, IOException {
 >       ServletConfig  config  = getServletConfig();
 >       ServletContext context = config.getServletContext();
 >       HttpSession    session = req.getSession();
 >   
 >       Handler  engine = null ;
 >   
 >       /* Get or 'new' the Axis engine object */
 >       /***************************************/
 >       synchronized(context) {
 >         engine = (Handler) context.getAttribute( AXIS_ENGINE );
 >         if ( engine == null ) {
 >           engine = new SimpleAxisEngine() ;   // Get name from config file
 >           context.setAttribute( AXIS_ENGINE, engine );
 >           engine.init();
 >         }
 >       }
 >   
 >       /* Place the incoming message in the MessagContext object - notice */
 >       /* that we just leave it as a 'ServletRequest' object and let the  */
 >       /* Message processing routine convert it - we don't do it since we */
 >       /* don't know how it's going to be used - perhaps it might not     */
 >       /* even need to be parsed.                                         */
 >       /*******************************************************************/
 >       MessageContext    msgContext = new MessageContext();
 >       Message           msg        = new Message( req, "ServletRequest" );
 >   
 >       msgContext.setIncomingMessage( msg );
 >   
 >       /* Save the SOAPAction header in the MessageContext bag - this will */
 >       /* be used to tell the Axis Engine which service is being invoked.  */
 >       /* This will save us the trouble of having to parse the incoming    */
 >       /* message - although we will need to double-check later on that    */
 >       /* the SOAPAction header does in fact match the URI in the body.    */
 >       /* (is this last stmt true???)                                      */
 >       /* if SOAPAction is "" then use the URL                             */
 >       /* if SOAPAction is null then we'll we be forced to scan the body   */
 >       /*   for it.                                                        */
 >       /********************************************************************/
 >       String  tmp ;
 >       tmp = (String) req.getHeader( HTTPConstants.HEADER_SOAP_ACTION );
 >       if ( tmp != null && "".equals(tmp) )
 >         tmp = req.getContextPath(); // Is this right?
 >       if ( tmp != null ) msgContext.setProperty( Constants.MC_HTTP_SOAPACTION, tmp );
 >   
 >       tmp = (String) req.getHeader( HTTPConstants.HEADER_AUTHORIZATION );
 >       if ( tmp != null ) tmp = tmp.trim();
 >       if ( tmp != null && tmp.startsWith("Basic ") ) {
 >         String user=null ;
 >         int  i ;
 >   
 >         tmp = new String( Base64.decode( tmp.substring(6) ) );
 >         i = tmp.indexOf( ':' );
 >         if ( i == -1 ) user = tmp ;
 >         else           user = tmp.substring( 0, i);
 >         msgContext.setProperty( Constants.MC_USERID, user );
 >         if ( i != -1 )  {
 >           String pwd = tmp.substring(i+1);
 >           if ( pwd != null && pwd.equals("") ) pwd = null ;
 >           if ( pwd != null )
 >             msgContext.setProperty( Constants.MC_PASSWORD, pwd );
 >         }
 >       }
 >   
 >       // Invoke the Axis engine...
 >       try {
 >         engine.invoke( msgContext );
 >       }
 >       catch( Exception e ) {
 >         if ( e instanceof AxisFault ) {
 >           AxisFault  af = (AxisFault) e ;
 >           if ( "Server.Unauthorized".equals( af.getFaultCode() ) )
 >             res.setStatus( HttpServletResponse.SC_UNAUTHORIZED );
 >           else
 >             res.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
 >         }
 >         else 
 >           res.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
 >         // msgContext.setOutgoingMessage( new Message(e.toString(), "String" ) );
 >         if ( !(e instanceof AxisFault) )
 >           e = new AxisFault( e );
 >         msgContext.setOutgoingMessage( new Message(e, "AxisFault") );
 >       }
 >   
 >       /* Send it back along the wire...  */
 >       /***********************************/
 >       msg = msgContext.getOutgoingMessage();
 >       res.setContentType( "text/xml" );
 >       res.getWriter().println( msg !=  null ? msg.getAs("String") : "No data" );
 >     }
 >   }
 >   
 >   
 >   
 >   1.1                  xml-axis/java/src/org/apache/axis/transport/http/HTTPConstants.java
 >   
 >   Index: HTTPConstants.java
 >   ===================================================================
 >   /*
 >    * The Apache Software License, Version 1.1
 >    *
 >    *
 >    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
 >    * reserved.
 >    *
 >    * Redistribution and use in source and binary forms, with or without
 >    * modification, are permitted provided that the following conditions
 >    * are met:
 >    *
 >    * 1. Redistributions of source code must retain the above copyright
 >    *    notice, this list of conditions and the following disclaimer. 
 >    *
 >    * 2. Redistributions in binary form must reproduce the above copyright
 >    *    notice, this list of conditions and the following disclaimer in
 >    *    the documentation and/or other materials provided with the
 >    *    distribution.
 >    *
 >    * 3. The end-user documentation included with the redistribution,
 >    *    if any, must include the following acknowledgment:  
 >    *       "This product includes software developed by the
 >    *        Apache Software Foundation (http://www.apache.org/)."
 >    *    Alternately, this acknowledgment may appear in the software itself,
 >    *    if and wherever such third-party acknowledgments normally appear.
 >    *
 >    * 4. The names "Axis" and "Apache Software Foundation" must
 >    *    not be used to endorse or promote products derived from this
 >    *    software without prior written permission. For written 
 >    *    permission, please contact apache@apache.org.
 >    *
 >    * 5. Products derived from this software may not be called "Apache",
 >    *    nor may "Apache" appear in their name, without prior written
 >    *    permission of the Apache Software Foundation.
 >    *
 >    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 >    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 >    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 >    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 >    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 >    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 >    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 >    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 >    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 >    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 >    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 >    * SUCH DAMAGE.
 >    * ====================================================================
 >    *
 >    * This software consists of voluntary contributions made by many
 >    * individuals on behalf of the Apache Software Foundation and was
 >    * originally based on software copyright (c) 1999, International
 >    * Business Machines, Inc., http://www.ibm.com.  For more
 >    * information on the Apache Software Foundation, please see
 >    * <http://www.apache.org/>.
 >    */
 >   
 >   package org.apache.axis.transport.http;
 >   
 >   public class HTTPConstants {
 >     // HTTP Stuff
 >     //////////////////////////////////////////////////////////////////////////
 >     public static final String HEADER_POST = "POST";
 >     public static final String HEADER_HOST = "Host";
 >     public static final String HEADER_CONTENT_TYPE = "Content-Type";
 >     public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
 >     public static final String HEADER_CONTENT_LENGTH = "Content-Length";
 >     public static final String HEADER_CONTENT_LOCATION = "Content-Location";
 >     public static final String HEADER_CONTENT_ID = "Content-ID";
 >     public static final String HEADER_SOAP_ACTION = "SOAPAction";
 >     public static final String HEADER_AUTHORIZATION = "Authorization";
 >   }
 >   
 >   
 >   
 >   
 > 


Mime
View raw message