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 du...@apache.org on 2001/03/08 12:56:07 UTC
cvs commit: xml-axis/java/src/org/apache/axis/server AxisServer.java
dug 01/03/08 03:56:06
Modified: java/src/org/apache/axis MessageContext.java
java/src/org/apache/axis/client AxisClient.java
HTTPMessage.java
java/src/org/apache/axis/server AxisServer.java
Log:
Use ENGINE_HANDLER instead of TargetService field in the msgContext
Revision Changes Path
1.13 +2 -0 xml-axis/java/src/org/apache/axis/MessageContext.java
Index: MessageContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- MessageContext.java 2001/03/08 01:15:14 1.12
+++ MessageContext.java 2001/03/08 11:56:05 1.13
@@ -153,6 +153,8 @@
*/
public static String SVC_HANDLER = "service.handler";
+ public static String ENGINE_HANDLER = "engine.handler";
+
/** This String is the URL that the message came to
*/
public static String TRANS_URL = "transport.url";
1.2 +88 -62 xml-axis/java/src/org/apache/axis/client/AxisClient.java
Index: AxisClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AxisClient.java 2001/03/08 01:15:16 1.1
+++ AxisClient.java 2001/03/08 11:56:05 1.2
@@ -53,7 +53,7 @@
* <http://www.apache.org/>.
*/
-package org.apache.axis.server ;
+package org.apache.axis.client ;
import java.util.* ;
import org.apache.axis.* ;
@@ -122,75 +122,101 @@
HandlerRegistry sr =
(HandlerRegistry) getOption(Constants.SERVICE_REGISTRY);
- msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
- msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
+ if ( hr != null )
+ msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
+ if ( sr != null )
+ msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
try {
- // This really should be in a handler - but we need to discuss it
- // first - to make sure that's what we want.
+ hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
+ Debug.Print( 2, "EngineHandler: " + hName );
- /* Now we do the 'real' work. The flow is basically: */
- /* */
- /* Service Specific Request Chain */
- /* Global Request Chain */
- /* Transport Request Chain - must have a send at the end */
- /* Transport Response Chain */
- /* Global Response Chain */
- /* Service Specific Response Chain */
- /* Protocol Specific-Handler/Checker */
- /**************************************************************/
-
- // When do we call init/cleanup??
-
- SimpleTargetedChain service = null ;
-
- /* Process the Service Specific Request Chain */
- /**********************************************/
- hName = msgContext.getTargetService();
- if ( hName != null && (h = sr.find( hName )) != null ) {
- if ( h instanceof SimpleTargetedChain ) {
- service = (SimpleTargetedChain) h ;
- h = service.getInputChain();
+ if ( hName != null ) {
+ if ( hr == null || (h = hr.find(hName)) == null ) {
+ ClassLoader cl = new AxisClassLoader();
+ try {
+ Debug.Print( 2, "Trying to load class: " + hName );
+ Class cls = cl.loadClass( hName );
+ h = (Handler) cls.newInstance();
+ }
+ catch( Exception e ) {
+ h = null ;
+ }
}
- if ( h != null ) h.invoke( msgContext );
+ if ( h != null )
+ h.invoke(msgContext);
+ else
+ throw new AxisFault( "Client.error",
+ "Can't locate handler: " + hName,
+ null, null );
}
-
- /* Process the Global Input Chain */
- /**********************************/
- hName = Constants.GLOBAL_INPUT ;
- if ( hName != null && (h = hr.find( hName )) != null )
+ else {
+ // This really should be in a handler - but we need to discuss it
+ // first - to make sure that's what we want.
+
+ /* Now we do the 'real' work. The flow is basically: */
+ /* */
+ /* Service Specific Request Chain */
+ /* Global Request Chain */
+ /* Transport Request Chain - must have a send at the end */
+ /* Transport Response Chain */
+ /* Global Response Chain */
+ /* Service Specific Response Chain */
+ /* Protocol Specific-Handler/Checker */
+ /**************************************************************/
+
+ // When do we call init/cleanup??
+
+ SimpleTargetedChain service = null ;
+
+ /* Process the Service Specific Request Chain */
+ /**********************************************/
+ hName = msgContext.getTargetService();
+ if ( hName != null && (h = sr.find( hName )) != null ) {
+ if ( h instanceof SimpleTargetedChain ) {
+ service = (SimpleTargetedChain) h ;
+ h = service.getInputChain();
+ }
+ if ( h != null ) h.invoke( msgContext );
+ }
+
+ /* Process the Global Input Chain */
+ /**********************************/
+ hName = Constants.GLOBAL_INPUT ;
+ if ( hName != null && (h = hr.find( hName )) != null )
+ h.invoke(msgContext);
+
+ /* Process the Transport Specific Input Chain */
+ /**********************************************/
+ hName = msgContext.getStrProp(MessageContext.TRANS_INPUT);
+ if ( hName != null && (h = hr.find( hName )) != null )
h.invoke(msgContext);
-
- /* Process the Transport Specific Input Chain */
- /**********************************************/
- hName = msgContext.getStrProp(MessageContext.TRANS_INPUT);
- if ( hName != null && (h = hr.find( hName )) != null )
- h.invoke(msgContext);
-
- /* Note: at the end of the transport specific input chain should */
- /* have been a handler that called the server. */
- /*****************************************************************/
-
- /* Process the Transport Specific Output Chain */
- /***********************************************/
- hName = msgContext.getStrProp(MessageContext.TRANS_OUTPUT);
- if ( hName != null && (h = hr.find( hName )) != null )
- h.invoke(msgContext);
-
- /* Process the Global Output Chain */
- /***********************************/
- hName = Constants.GLOBAL_OUTPUT ;
- if ( hName != null && (h = hr.find( hName )) != null )
- h.invoke(msgContext);
-
- if ( service != null ) {
- h = service.getOutputChain();
- if ( h != null )
+
+ /* Note: at the end of the transport specific input chain should */
+ /* have been a handler that called the server. */
+ /*****************************************************************/
+
+ /* Process the Transport Specific Output Chain */
+ /***********************************************/
+ hName = msgContext.getStrProp(MessageContext.TRANS_OUTPUT);
+ if ( hName != null && (h = hr.find( hName )) != null )
+ h.invoke(msgContext);
+
+ /* Process the Global Output Chain */
+ /***********************************/
+ hName = Constants.GLOBAL_OUTPUT ;
+ if ( hName != null && (h = hr.find( hName )) != null )
h.invoke(msgContext);
+
+ if ( service != null ) {
+ h = service.getOutputChain();
+ if ( h != null )
+ h.invoke(msgContext);
+ }
+
+ // Do SOAP Semantics checks here - this needs to be a call to
+ // a pluggable object/handler/something
}
-
- // Do SOAP Semantics checks here - this needs to be a call to
- // a pluggable object/handler/something
}
catch( Exception e ) {
// Should we even bother catching it ?
1.14 +11 -3 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HTTPMessage.java 2001/03/08 01:15:16 1.13
+++ HTTPMessage.java 2001/03/08 11:56:05 1.14
@@ -146,16 +146,24 @@
reqEnv.addBody( body );
}
- Handler client = new HTTPDispatchHandler();
+ Handler client = null ;
Message reqMsg = new Message( reqEnv, "SOAPEnvelope" );
MessageContext msgContext = new MessageContext( reqMsg );
// For testing - skip HTTP layer
if ( doLocal ) {
client = new org.apache.axis.server.AxisServer();
- msgContext.setProperty(MessageContext.TRANS_INPUT , "HTTP.Input" );
- msgContext.setProperty(MessageContext.TRANS_OUTPUT, "HTTP.Output" );
+ msgContext.setProperty(MessageContext.TRANS_INPUT , "HTTP.input" );
+ msgContext.setProperty(MessageContext.TRANS_OUTPUT, "HTTP.output" );
msgContext.setTargetService( action );
+ }
+ else {
+ client = new AxisClient();
+ // msgContext.setProperty(
+ // MessageContext.ENGINE_HANDLER,
+ // "org.apache.axis.transport.http.HTTPDispatchHandler" );
+ msgContext.setProperty(MessageContext.TRANS_INPUT , "HTTP.input" );
+ msgContext.setProperty(MessageContext.TRANS_OUTPUT , "HTTP.output" );
}
if ( true ) { // Debug.getDebugLevel() > 0 ) {
1.2 +19 -4 xml-axis/java/src/org/apache/axis/server/AxisServer.java
Index: AxisServer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AxisServer.java 2001/03/08 01:15:20 1.1
+++ AxisServer.java 2001/03/08 11:56:06 1.2
@@ -126,10 +126,25 @@
msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
try {
- hName = msgContext.getTargetService();
- if ( hName != null && (h = hr.find(hName)) != null ) {
- Debug.Print(1, "Calling handler: " + hName );
- h.invoke( msgContext );
+ hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
+ if ( hName != null ) {
+ if ( hr == null || (h = hr.find(hName)) == null ) {
+ ClassLoader cl = new AxisClassLoader();
+ try {
+ Debug.Print( 2, "Trying to load class: " + hName );
+ Class cls = cl.loadClass( hName );
+ h = (Handler) cls.newInstance();
+ }
+ catch( Exception e ) {
+ h = null ;
+ }
+ }
+ if ( h != null )
+ h.invoke(msgContext);
+ else
+ throw new AxisFault( "Server.error",
+ "Can't locate handler: " + hName,
+ null, null );
}
else {
// This really should be in a handler - but we need to discuss it