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 he...@apache.org on 2005/06/20 06:06:31 UTC
svn commit: r191389 [1/2] - in /webservices/axis/trunk/java:
modules/core/src/org/apache/axis/ modules/core/src/org/apache/axis/clientapi/
modules/core/src/org/apache/axis/context/
modules/core/src/org/apache/axis/description/ modules/core/src/org/apac...
Author: hemapani
Date: Sun Jun 19 21:06:28 2005
New Revision: 191389
URL: http://svn.apache.org/viewcvs?rev=191389&view=rev
Log:
GET support for REST and Dispatcher refactoring
Added:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/DispatchPostConditionsEvaluater.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SOAPMessageBodyBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ListingAgent.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/HttpGetRESTBasedTest.java
webservices/axis/trunk/java/xdocs/images/userguide/http-get-ws.png (with props)
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisConfigurationImpl.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/RequestURIBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/local/LocalTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPServer.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPTransportSender.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/ContextHireachyTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java
webservices/axis/trunk/java/xdocs/userguide.html
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java Sun Jun 19 21:06:28 2005
@@ -180,7 +180,14 @@
public static final String RESPONSE_WRITTEN = "CONTENT_WRITTEN";
public static final String TESTING_REPOSITORY = "target/test-resources/samples";
- //public static final String TESTING_REPOSITORY = "modules/samples/target/test-resources/samples";
+ // public static final String TESTING_REPOSITORY = "modules/samples/target/test-resources/samples";
+
+
+ public static interface REST_WITH_GET{
+ public static final String GET_PARAMETER_OPERATION = "operation";
+ public static final String GET_PARAMETER_URL = "http://ws.apache.org/goGetWithREST";
+
+ }
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java Sun Jun 19 21:06:28 2005
@@ -61,7 +61,7 @@
AxisConfiguration registry = sysContext.getAxisConfiguration();
AxisEngine engine = new AxisEngine(sysContext);
- msgctx.setOperationContext(axisop.findOperationContext(msgctx,serviceContext,false));
+ msgctx.setOperationContext(axisop.findOperationContext(msgctx,serviceContext));
engine.send(msgctx);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java Sun Jun 19 21:06:28 2005
@@ -156,7 +156,7 @@
msgctx.setOperationContext(
OperationContextFactory.createMEPContext(
WSDLConstants.MEP_CONSTANT_IN_OUT,
- false,
+
axisop,
serviceContext));
MessageContext response = TwoChannelBasedSender.send(msgctx, listenerTransport);
@@ -194,7 +194,7 @@
+ "/"
+ axisop.getName().getLocalPart(),listenerTransport.getName().getLocalPart()));
msgctx.setOperationContext(
- axisop.findOperationContext(msgctx, serviceContext, false));
+ axisop.findOperationContext(msgctx, serviceContext));
msgctx.setServiceContext(serviceContext);
engine.send(msgctx);
} else {
@@ -204,7 +204,6 @@
msgctx.setOperationContext(
OperationContextFactory.createMEPContext(
WSDLConstants.MEP_CONSTANT_IN_OUT,
- false,
axisop,
serviceContext));
msgctx.setServiceContext(serviceContext);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java Sun Jun 19 21:06:28 2005
@@ -39,7 +39,7 @@
/**
* Field TRANSPORT_WRITER
*/
- public static final String TRANSPORT_WRITER = "TRANSPORT_WRITER";
+ public static final String TRANSPORT_OUT = "TRANSPORT_OUT";
/**
* Field TRANSPORT_READER
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContextFactory.java Sun Jun 19 21:06:28 2005
@@ -23,7 +23,7 @@
public class OperationContextFactory implements WSDLConstants {
- public static OperationContext createMEPContext(int mepURI, boolean serverSide,
+ public static OperationContext createMEPContext(int mepURI,
OperationDescription axisOp, ServiceContext serviceContext)
throws AxisFault {
if (MEP_CONSTANT_IN_OUT == mepURI || MEP_CONSTANT_IN_ONLY == mepURI
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java Sun Jun 19 21:06:28 2005
@@ -154,13 +154,13 @@
* @return
*/
public OperationContext findOperationContext(MessageContext msgContext,
- ServiceContext serviceContext, boolean serverside) throws AxisFault {
+ ServiceContext serviceContext) throws AxisFault {
OperationContext operationContext = null;
if (null == msgContext.getRelatesTo()) {
//Its a new incomming message so get the factory to create a new
// one
- operationContext = OperationContextFactory.createMEPContext(getAxisSpecifMEPConstant(), serverside, this,
+ operationContext = OperationContextFactory.createMEPContext(getAxisSpecifMEPConstant(), this,
serviceContext);
} else {
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AbstractDispatcher.java Sun Jun 19 21:06:28 2005
@@ -62,7 +62,7 @@
if (msgctx.getServiceContext() != null && msgctx.getOperationContext() == null) {
OperationDescription axisOperation = findOperation(msgctx.getServiceContext().getServiceConfig(),msgctx);
if(axisOperation != null){
- OperationContext operationContext = axisOperation.findOperationContext(msgctx,msgctx.getServiceContext(),msgctx.isServerSide());
+ OperationContext operationContext = axisOperation.findOperationContext(msgctx,msgctx.getServiceContext());
msgctx.setOperationContext(operationContext);
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AddressingBasedDispatcher.java Sun Jun 19 21:06:28 2005
@@ -37,24 +37,19 @@
init(new HandlerDescription(NAME));
}
-
- public OperationDescription findOperation(ServiceDescription service, MessageContext messageContext)
+ public OperationDescription findOperation(
+ ServiceDescription service,
+ MessageContext messageContext)
throws AxisFault {
String action = (String) messageContext.getWSAAction();
if (action != null) {
QName operationName = new QName(action);
OperationDescription op = service.getOperation(operationName);
- if (op != null) {
- return op;
- } else {
- throw new AxisFault("No Operation named " + operationName + " Not found");
- }
- //if no operation found let it go, this is for a handler may be. e.g. Create Sequance in RM
- } else {
- throw new AxisFault("Operation not found, WSA Action is Null");
- }
+ return op;
+ }
+ return null;
}
/* (non-Javadoc)
@@ -63,16 +58,12 @@
public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
EndpointReference toEPR = messageContext.getTo();
ServiceDescription service = null;
- if(toEPR != null){
+ if (toEPR != null) {
QName serviceName = new QName(toEPR.getAddress());
- service = messageContext.getSystemContext().getAxisConfiguration().getService(serviceName);
- }
-
- if (service != null) {
- return service;
- } else {
- throw new AxisFault("No service found under the Service " + ((toEPR!= null)?toEPR.getAddress():""));
+ service =
+ messageContext.getSystemContext().getAxisConfiguration().getService(serviceName);
}
+ return service;
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisConfigurationImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisConfigurationImpl.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisConfigurationImpl.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisConfigurationImpl.java Sun Jun 19 21:06:28 2005
@@ -98,11 +98,16 @@
inPhasesUptoAndIncludingPostDispatch = new ArrayList();
inPhasesUptoAndIncludingPostDispatch.add(new Phase(PhaseMetadata.PHASE_TRANSPORTIN));
inPhasesUptoAndIncludingPostDispatch.add(new Phase(PhaseMetadata.PHASE_PRE_DISPATCH));
+
Phase dispatch = new Phase(PhaseMetadata.PHASE_DISPATCH);
- dispatch.addHandler(new RequestURIBasedDispatcher(), 0);
- dispatch.addHandler(new AddressingBasedDispatcher(), 1);
+ dispatch.addHandler(new AddressingBasedDispatcher(), 0);
+ dispatch.addHandler(new RequestURIBasedDispatcher(), 1);
+ dispatch.addHandler(new SOAPMessageBodyBasedDispatcher(),2);
inPhasesUptoAndIncludingPostDispatch.add(dispatch);
- inPhasesUptoAndIncludingPostDispatch.add(new Phase(PhaseMetadata.PHASE_POST_DISPATCH));
+
+ Phase postDispatch = new Phase(PhaseMetadata.PHASE_POST_DISPATCH);
+ postDispatch.addHandler(new DispatchPostConditionsEvaluater());
+ inPhasesUptoAndIncludingPostDispatch.add(postDispatch);
}
/**
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java Sun Jun 19 21:06:28 2005
@@ -154,9 +154,9 @@
if (context.getFaultTo() != null) {
faultContext.setFaultTo(context.getFaultTo());
} else {
- Object writer = context.getProperty(MessageContext.TRANSPORT_WRITER);
+ Object writer = context.getProperty(MessageContext.TRANSPORT_OUT);
if (writer != null) {
- faultContext.setProperty(MessageContext.TRANSPORT_WRITER, writer);
+ faultContext.setProperty(MessageContext.TRANSPORT_OUT, writer);
} else {
//TODO Opps there are no place to send this, we will log and should we throw the exception?
log.error("Error in fault flow", e);
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/DispatchPostConditionsEvaluater.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/DispatchPostConditionsEvaluater.java?rev=191389&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/DispatchPostConditionsEvaluater.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/DispatchPostConditionsEvaluater.java Sun Jun 19 21:06:28 2005
@@ -0,0 +1,63 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis.engine;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.context.ConfigurationContext;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.description.HandlerDescription;
+import org.apache.axis.handlers.AbstractHandler;
+
+/**
+ * Class Dispatcher
+ */
+public class DispatchPostConditionsEvaluater extends AbstractHandler implements Handler {
+ /**
+ * Field NAME
+ */
+ public static final QName NAME =
+ new QName("http://axis.ws.apache.org", "DispatchPostConditionsEvaluater");
+
+ /**
+ * Constructor Dispatcher
+ */
+ private ConfigurationContext engineContext;
+
+ public DispatchPostConditionsEvaluater() {
+ init(new HandlerDescription(NAME));
+ }
+
+ /**
+ * Method invoke
+ *
+ * @param msgctx
+ * @throws AxisFault
+ */
+ public final void invoke(MessageContext msgctx) throws AxisFault {
+ EndpointReference toEPR = msgctx.getTo();
+ if (msgctx.getServiceContext() == null) {
+ throw new AxisFault("Service Not found EPR is " + ((toEPR!= null)?toEPR.getAddress():""));
+ }
+
+ if (msgctx.getServiceContext() != null && msgctx.getOperationContext() == null) {
+ throw new AxisFault("Operation Not found EPR is " + ((toEPR!= null)?toEPR.getAddress():"") + " and WSA Action = "+ msgctx.getWSAAction());
+ }
+
+ }
+
+}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/RequestURIBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/RequestURIBasedDispatcher.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/RequestURIBasedDispatcher.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/RequestURIBasedDispatcher.java Sun Jun 19 21:06:28 2005
@@ -61,8 +61,6 @@
public ServiceDescription findService(MessageContext messageContext)
throws AxisFault {
final String URI_ID_STRING = "/services";
- if (messageContext.isServerSide()) {
-
EndpointReference toEPR = messageContext.getTo();
if (toEPR != null) {
String filePart = toEPR.getAddress();
@@ -89,7 +87,6 @@
return registry.getService(serviceName);
}
}
- }
return null;
}
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SOAPMessageBodyBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SOAPMessageBodyBasedDispatcher.java?rev=191389&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SOAPMessageBodyBasedDispatcher.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SOAPMessageBodyBasedDispatcher.java Sun Jun 19 21:06:28 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.engine;
+
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.context.ConfigurationContext;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.description.HandlerDescription;
+import org.apache.axis.description.OperationDescription;
+import org.apache.axis.description.ServiceDescription;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class Dispatcher
+ */
+public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher {
+ /**
+ * Field NAME
+ */
+ public static final QName NAME =
+ new QName("http://axis.ws.apache.org", "SOAPMessageBodyBasedDispatcher");
+ QName serviceName = null;
+ QName operatoinName = null;
+
+ /**
+ * Constructor Dispatcher
+ */
+ public SOAPMessageBodyBasedDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
+
+ public OperationDescription findOperation(
+ ServiceDescription service,
+ MessageContext messageContext)
+ throws AxisFault {
+ OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+ operatoinName = new QName(bodyFirstChild.getLocalName());
+
+ OperationDescription axisOp = service.getOperation(operatoinName);
+ return axisOp;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.engine.AbstractDispatcher#findService(org.apache.axis.context.MessageContext)
+ */
+ public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
+ final String URI_ID_STRING = "/services";
+ OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+ OMNamespace ns = bodyFirstChild.getNamespace();
+ if (ns != null) {
+ String filePart = ns.getName();
+
+ int index = filePart.lastIndexOf(URI_ID_STRING);
+ String serviceStr = null;
+ if (-1 != index) {
+ serviceStr = filePart.substring(index + URI_ID_STRING.length() + 1);
+
+ ConfigurationContext engineContext = messageContext.getSystemContext();
+
+ if ((index = serviceStr.indexOf('/')) > 0) {
+ serviceName = new QName(serviceStr.substring(0, index));
+ operatoinName = new QName(serviceStr.substring(index + 1));
+ } else {
+ serviceName = new QName(serviceStr);
+ }
+
+ AxisConfiguration registry =
+ messageContext.getSystemContext().getAxisConfiguration();
+ return registry.getService(serviceName);
+ }
+ }
+ return null;
+
+ }
+}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java Sun Jun 19 21:06:28 2005
@@ -55,7 +55,7 @@
newmsgCtx.setMessageInformationHeaders(messageInformationHeaders);
newmsgCtx.setOperationContext(messgeCtx.getOperationContext());
newmsgCtx.setServiceContext(messgeCtx.getServiceContext());
- newmsgCtx.setProperty(MessageContext.TRANSPORT_WRITER,messgeCtx.getProperty(MessageContext.TRANSPORT_WRITER));
+ newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,messgeCtx.getProperty(MessageContext.TRANSPORT_OUT));
newmsgCtx.setProperty(Constants.Configuration.DO_REST,messgeCtx.getProperty((Constants.Configuration.DO_REST)));
newmsgCtx.setProperty(Constants.Configuration.DO_MTOM,messgeCtx.getProperty(Constants.Configuration.DO_MTOM));
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java Sun Jun 19 21:06:28 2005
@@ -15,7 +15,7 @@
*/
package org.apache.axis.transport;
-import java.io.Writer;
+import java.io.OutputStream;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;
@@ -71,7 +71,7 @@
this.doREST = true;
}
- Writer out = null;
+ OutputStream out = null;
EndpointReference epr = null;
@@ -84,13 +84,13 @@
out = openTheConnection(epr);
startSendWithToAddress(msgContext, out);
writeMessage(msgContext, out);
- finalizeSendWithToAddress(msgContext, out);
+ finalizeSendWithToAddress(msgContext);
} else {
- out = (Writer) msgContext.getProperty(MessageContext.TRANSPORT_WRITER);
+ out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
if (out != null) {
startSendWithOutputStreamFromIncomingConnection(msgContext, out);
writeMessage(msgContext, out);
- finalizeSendWithOutputStreamFromIncomingConnection(msgContext, out);
+ finalizeSendWithOutputStreamFromIncomingConnection(msgContext);
} else {
throw new AxisFault("Both the TO and Property MessageContext.TRANSPORT_WRITER is Null, No where to send");
}
@@ -98,7 +98,7 @@
msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,Constants.VALUE_TRUE);
}
- public void writeMessage(MessageContext msgContext, Writer out) throws AxisFault {
+ public void writeMessage(MessageContext msgContext, OutputStream out) throws AxisFault {
SOAPEnvelope envelope = msgContext.getEnvelope();
OMElement outputMessage = envelope;
@@ -122,19 +122,18 @@
}
}
- public abstract void startSendWithToAddress(MessageContext msgContext, Writer writer)
+ public abstract void startSendWithToAddress(MessageContext msgContext, OutputStream out)
throws AxisFault;
- public abstract void finalizeSendWithToAddress(MessageContext msgContext, Writer writer)
+ public abstract void finalizeSendWithToAddress(MessageContext msgContext)
throws AxisFault;
public abstract void startSendWithOutputStreamFromIncomingConnection(
MessageContext msgContext,
- Writer writer)
+ OutputStream out)
throws AxisFault;
public abstract void finalizeSendWithOutputStreamFromIncomingConnection(
- MessageContext msgContext,
- Writer writer)
+ MessageContext msgContext)
throws AxisFault;
- protected abstract Writer openTheConnection(EndpointReference epr) throws AxisFault;
+ protected abstract OutputStream openTheConnection(EndpointReference epr) throws AxisFault;
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java Sun Jun 19 21:06:28 2005
@@ -16,12 +16,9 @@
package org.apache.axis.transport.http;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
+import java.util.Enumeration;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -32,21 +29,23 @@
import javax.xml.namespace.QName;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
import org.apache.axis.Constants;
-import org.apache.axis.description.OperationDescription;
import org.apache.axis.addressing.AddressingConstants;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.ConfigurationContext;
import org.apache.axis.context.ConfigurationContextFactory;
import org.apache.axis.context.MessageContext;
import org.apache.axis.context.SessionContext;
-import org.apache.axis.deployment.util.DeploymentData;
-import org.apache.axis.engine.AxisConfigurationImpl;
import org.apache.axis.engine.AxisEngine;
import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNamespace;
import org.apache.axis.om.impl.llom.builder.StAXBuilder;
import org.apache.axis.om.impl.llom.builder.StAXOMBuilder;
import org.apache.axis.soap.SOAPEnvelope;
@@ -66,46 +65,6 @@
private ConfigurationContext engineContext;
/**
- * Field LIST_MULTIPLE_SERVICE_JSP_NAME
- */
- private static final String LIST_MULTIPLE_SERVICE_JSP_NAME = "listServices.jsp";
-
- private static final String LIST_SRVICES_JSP_NAME = "listService.jsp";
-
- private static final String SELECT_SERVICE_JSP_NAME = "SelectService.jsp";
-
- private static final String ADMIN_JSP_NAME = "admin.jsp";
-
- private static final String LIST_AVAILABLE_MODULES_JSP_NAME = "listModules.jsp";
-
- private static final String LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME = "globalModules.jsp";
-
- private static final String LIST_PHASES_JSP_NAME = "viewphases.jsp";
-
- private static final String ENGAGING_MODULE_GLOBALLY_JSP_NAME = "engagingglobally.jsp";
-
- private static final String ENGAGING_MODULE_TO_SERVICE_JSP_NAME = "engagingtoaservice.jsp";
-
- /**
- * Field LIST_SINGLE_SERVICE_JSP_NAME
- */
- private static final String LIST_SINGLE_SERVICE_JSP_NAME = "listSingleService.jsp";
- private static final String VIEW_GLOBAL_HANDLERS_JSP_NAME = "ViewGlobalHandlers.jsp";
- private static final String VIEW_SERVICE_HANDLERS_JSP_NAME = "ViewServiceHandlers.jsp";
-
- private static final String ENGAGE_TO_OPERATION_JSP_NAME = "enaggingtoanopeartion.jsp";
-
- /**
- * Field allowListServices
- */
- private final boolean allowListServices = true;
-
- /**
- * Field allowListSingleService
- */
- private final boolean allowListSingleService = true;
-
- /**
* Method init
*
* @param config
@@ -135,57 +94,78 @@
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse)
throws ServletException, IOException {
- String filePart = httpServletRequest.getRequestURL().toString();
- if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LISTSERVICES)) {
- listAdminServices(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.LIST_MODULES)) {
- listModules(httpServletRequest, httpServletResponse);
- return;
- } else if (
- (filePart != null) && filePart.endsWith(Constants.LIST_GLOABLLY_ENGAGED_MODULES)) {
- listGloballyModules(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.LIST_PHASES)) {
- listPhases(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_GLOBAL_MODULE)) {
- engageModulesGlobally(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE)) {
- engageModulesToService(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LOGGING)) {
- adminLogging(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_GLOBAL_HANDLERS)) {
- viewGlobalHandlers(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.SELECT_SERVICE)) {
- selectService(httpServletRequest, httpServletResponse);
- return;
- } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_SERVICE_HANDLERS)) {
- viewServiceHandlers(httpServletRequest, httpServletResponse);
- return;
- } else if (
- (filePart != null) && filePart.endsWith(Constants.LIST_SERVICE_FOR_MODULE_ENGAMNET)) {
- lsitServiceformodules(httpServletRequest, httpServletResponse);
- return;
- } else if (
- (filePart != null) && filePart.endsWith(Constants.LIST_OPERATIONS_FOR_THE_SERVICE)) {
- engageModulesToOpeartion(httpServletRequest, httpServletResponse);
- return;
- }
- if (allowListServices && (filePart != null) && filePart.endsWith(Constants.LISTSERVICES)) {
- listServices(httpServletRequest, httpServletResponse);
- return;
- } else {
- if (allowListSingleService) {
- listService(httpServletRequest, httpServletResponse, filePart);
- return;
+ try {
+ String operation =
+ httpServletRequest.getParameter(Constants.REST_WITH_GET.GET_PARAMETER_OPERATION);
+ if (operation != null) {
+ SOAPFactory soapFactory = new SOAP11Factory();
+ SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
+
+ OMNamespace omNs =
+ soapFactory.createOMNamespace(
+ Constants.REST_WITH_GET.GET_PARAMETER_URL,
+ "rest");
+ OMElement opElement =
+ soapFactory.createOMElement(
+ Constants.REST_WITH_GET.GET_PARAMETER_OPERATION,
+ omNs);
+
+ Enumeration enu = httpServletRequest.getParameterNames();
+ while (enu.hasMoreElements()) {
+ String name = (String) enu.nextElement();
+ if (!Constants.REST_WITH_GET.GET_PARAMETER_OPERATION.equals(name)) {
+ String value = httpServletRequest.getParameter(name);
+ OMElement omEle =
+ soapFactory.createOMElement(
+ Constants.REST_WITH_GET.GET_PARAMETER_OPERATION,
+ omNs);
+ omEle.setText(value);
+ opElement.addChild(omEle);
+ }
+ }
+
+ envelope.getBody().addChild(opElement);
+ XMLStreamWriter wrtier =
+ XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+ envelope.serialize(wrtier);
+ System.out.flush();
+ Object sessionContext =
+ httpServletRequest.getSession().getAttribute(
+ Constants.SESSION_CONTEXT_PROPERTY);
+ if (sessionContext == null) {
+ sessionContext = new SessionContext(null);
+ httpServletRequest.getSession().setAttribute(
+ Constants.SESSION_CONTEXT_PROPERTY,
+ sessionContext);
+ }
+ MessageContext msgContext =
+ new MessageContext(
+ engineContext,
+ (SessionContext) sessionContext,
+ engineContext.getAxisConfiguration().getTransportIn(
+ new QName(Constants.TRANSPORT_HTTP)),
+ engineContext.getAxisConfiguration().getTransportOut(
+ new QName(Constants.TRANSPORT_HTTP)));
+ msgContext.setProperty(Constants.Configuration.DO_REST,Constants.VALUE_TRUE);
+
+ msgContext.setEnvelope(envelope);
+ processSOAPMessage(msgContext, httpServletRequest, httpServletResponse);
+
+ } else {
+ ListingAgent lister = new ListingAgent(engineContext);
+ lister.handle(httpServletRequest, httpServletResponse);
}
+ } catch (OMException e) {
+ throw new AxisFault(e);
+ } catch (XMLStreamException e) {
+ throw new AxisFault(e);
+ } catch (FactoryConfigurationError e) {
+ throw new AxisFault(e);
+ } catch (IOException e) {
+ throw new AxisFault(e);
}
+
}
/*
@@ -204,8 +184,6 @@
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
try {
- res.setContentType("text/xml; charset=utf-8");
- AxisEngine engine = new AxisEngine(engineContext);
Object sessionContext =
req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
if (sessionContext == null) {
@@ -220,21 +198,10 @@
new QName(Constants.TRANSPORT_HTTP)),
engineContext.getAxisConfiguration().getTransportOut(
new QName(Constants.TRANSPORT_HTTP)));
- msgContext.setServerSide(true);
- String filePart = req.getRequestURL().toString();
- msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, filePart));
- String soapActionString = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
- if (soapActionString != null) {
- msgContext.setWSAAction(soapActionString);
- }
XMLStreamReader reader =
XMLInputFactory.newInstance().createXMLStreamReader(
new BufferedReader(new InputStreamReader(req.getInputStream())));
- Utils.configureMessageContextForHTTP(
- req.getContentType(),
- soapActionString,
- msgContext);
//Check for the REST behaviour, if you desire rest beahaviour
//put a <parameter name="doREST" value="true"/> at the server.xml/client.xml file
@@ -253,16 +220,7 @@
}
msgContext.setEnvelope(envelope);
-
- msgContext.setProperty(
- MessageContext.TRANSPORT_WRITER,
- new BufferedWriter(res.getWriter()));
- engine.receive(msgContext);
-
- Object contextWritten = msgContext.getProperty(Constants.RESPONSE_WRITTEN);
- if (contextWritten == null || !Constants.VALUE_TRUE.equals(contextWritten)) {
- res.setStatus(HttpServletResponse.SC_ACCEPTED);
- }
+ processSOAPMessage(msgContext, req, res);
} catch (AxisFault e) {
throw new ServletException(e);
} catch (XMLStreamException e) {
@@ -272,247 +230,38 @@
}
}
- /**
- * Method listServices
- *
- * @param req
- * @param res
- * @throws IOException
- */
- private void listServices(HttpServletRequest req, HttpServletResponse res) throws IOException {
- HashMap services = engineContext.getAxisConfiguration().getServices();
- req.getSession().setAttribute(Constants.SERVICE_MAP, services);
- req.getSession().setAttribute(
- Constants.ERROR_SERVICE_MAP,
- engineContext.getAxisConfiguration().getFaulytServices());
- res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
- }
-
- /**
- *
- * @param req
- * @param res
- * @throws IOException
- */
- private void listAdminServices(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- HashMap services = engineContext.getAxisConfiguration().getServices();
- req.getSession().setAttribute(Constants.SERVICE_MAP, services);
- req.getSession().setAttribute(
- Constants.ERROR_SERVICE_MAP,
- engineContext.getAxisConfiguration().getFaulytServices());
- res.sendRedirect(LIST_SRVICES_JSP_NAME);
- }
-
- private void selectService(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- HashMap services = engineContext.getAxisConfiguration().getServices();
- req.getSession().setAttribute(Constants.SERVICE_MAP, services);
- req.getSession().setAttribute(Constants.MODULE_ENGAMENT, null);
- res.sendRedirect(SELECT_SERVICE_JSP_NAME);
- }
- private void adminLogging(HttpServletRequest req, HttpServletResponse res) throws IOException {
- String username = req.getParameter("userName");
- String password = req.getParameter("password");
- if (username == null
- || password == null
- || username.trim().equals("")
- || password.trim().equals("")) {
- throw new AxisFault("invalid user name");
- }
- String adminUserName =
- (String) ((AxisConfigurationImpl) engineContext.getAxisConfiguration())
- .getParameter(Constants.USER_NAME)
- .getValue();
- String adminPassword =
- (String) ((AxisConfigurationImpl) engineContext.getAxisConfiguration())
- .getParameter(Constants.PASSWORD)
- .getValue();
- if (username != null
- && password != null
- && username.equals(adminUserName)
- && password.equals(adminPassword)) {
- req.getSession().setAttribute(Constants.LOGGED, "Yes");
- res.sendRedirect(ADMIN_JSP_NAME);
- } else {
- throw new AxisFault("invalid user name");
- }
- }
-
- private void listModules(HttpServletRequest req, HttpServletResponse res) throws IOException {
- HashMap modules =
- ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
- req.getSession().setAttribute(Constants.MODULE_MAP, modules);
- req.getSession().setAttribute(
- Constants.ERROR_MODULE_MAP,
- engineContext.getAxisConfiguration().getFaulytModules());
- res.sendRedirect(LIST_AVAILABLE_MODULES_JSP_NAME);
- }
+ public void processSOAPMessage(
+ MessageContext msgContext,
+ HttpServletRequest req,
+ HttpServletResponse res)
+ throws AxisFault {
+ try {
+ res.setContentType("text/xml; charset=utf-8");
+ AxisEngine engine = new AxisEngine(engineContext);
+ msgContext.setServerSide(true);
- private void engageModulesGlobally(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- HashMap modules =
- ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
- req.getSession().setAttribute(Constants.MODULE_MAP, modules);
- String moduleName = (String) req.getParameter("modules");
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
- if (moduleName != null) {
- try {
- engineContext.getAxisConfiguration().engageModule(new QName(moduleName));
- req.getSession().setAttribute(
- Constants.ENGAGE_STATUS,
- moduleName + " module engaged globally Successfully");
- } catch (AxisFault axisFault) {
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ String filePart = req.getRequestURL().toString();
+ msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, filePart));
+ String soapActionString = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
+ if (soapActionString != null) {
+ msgContext.setWSAAction(soapActionString);
}
- }
- req.getSession().setAttribute("modules", null);
- res.sendRedirect(ENGAGING_MODULE_GLOBALLY_JSP_NAME);
- }
+ Utils.configureMessageContextForHTTP(
+ req.getContentType(),
+ soapActionString,
+ msgContext);
+ msgContext.setProperty(
+ MessageContext.TRANSPORT_OUT,res.getOutputStream());
+ engine.receive(msgContext);
- private void engageModulesToOpeartion(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- HashMap modules =
- ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
- req.getSession().setAttribute(Constants.MODULE_MAP, modules);
- String moduleName = (String) req.getParameter("modules");
-
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
- req.getSession().setAttribute("modules", null);
-
- String serviceName = (String) req.getParameter("service");
- if (serviceName != null) {
- req.getSession().setAttribute("service", serviceName);
- } else {
- serviceName = (String) req.getSession().getAttribute("service");
- }
- req.getSession().setAttribute(
- Constants.OPEARTION_MAP,
- engineContext
- .getAxisConfiguration()
- .getService(new QName(serviceName))
- .getOperations());
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
- String operationName = (String) req.getParameter("operation");
- if (serviceName != null && moduleName != null && operationName != null) {
- try {
- OperationDescription od =
- engineContext.getAxisConfiguration().getService(
- new QName(serviceName)).getOperation(
- new QName(operationName));
- od.engageModule(
- engineContext.getAxisConfiguration().getModule(new QName(moduleName)));
- req.getSession().setAttribute(
- Constants.ENGAGE_STATUS,
- moduleName + " module engaged to the operation Successfully");
- } catch (AxisFault axisFault) {
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
- }
- }
- req.getSession().setAttribute("operation", null);
- res.sendRedirect(ENGAGE_TO_OPERATION_JSP_NAME);
- }
- private void engageModulesToService(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- HashMap modules =
- ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
- req.getSession().setAttribute(Constants.MODULE_MAP, modules);
- HashMap services = engineContext.getAxisConfiguration().getServices();
- req.getSession().setAttribute(Constants.SERVICE_MAP, services);
- String moduleName = (String) req.getParameter("modules");
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
- req.getSession().setAttribute("modules", null);
- String serviceName = (String) req.getParameter("service");
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
- if (serviceName != null && moduleName != null) {
- try {
-
- engineContext.getAxisConfiguration().getService(
- new QName(serviceName)).engageModule(
- engineContext.getAxisConfiguration().getModule(new QName(moduleName)));
- req.getSession().setAttribute(
- Constants.ENGAGE_STATUS,
- moduleName + " module engaged to the service Successfully");
- } catch (AxisFault axisFault) {
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ Object contextWritten = msgContext.getProperty(Constants.RESPONSE_WRITTEN);
+ if (contextWritten == null || !Constants.VALUE_TRUE.equals(contextWritten)) {
+ res.setStatus(HttpServletResponse.SC_ACCEPTED);
}
+ } catch (IOException e) {
+ throw new AxisFault(e);
}
- req.getSession().setAttribute("service", null);
- res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_JSP_NAME);
- }
-
- private void listGloballyModules(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- Collection modules =
- ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getEngadgedModules();
- req.getSession().setAttribute(Constants.MODULE_MAP, modules);
- res.sendRedirect(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME);
- }
- private void lsitServiceformodules(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- HashMap services = engineContext.getAxisConfiguration().getServices();
- req.getSession().setAttribute(Constants.SERVICE_MAP, services);
- req.getSession().setAttribute(Constants.MODULE_ENGAMENT, "Yes");
- res.sendRedirect(SELECT_SERVICE_JSP_NAME);
}
- private void viewGlobalHandlers(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- req.getSession().setAttribute(
- Constants.GLOBAL_HANDLERS,
- engineContext.getAxisConfiguration());
- res.sendRedirect(VIEW_GLOBAL_HANDLERS_JSP_NAME);
- }
-
- private void viewServiceHandlers(HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- String service = (String) req.getParameter("service");
- if (service != null) {
- req.getSession().setAttribute(
- Constants.SERVICE_HANDLERS,
- engineContext.getAxisConfiguration().getService(new QName(service)));
- }
- res.sendRedirect(VIEW_SERVICE_HANDLERS_JSP_NAME);
- }
-
- private void listPhases(HttpServletRequest req, HttpServletResponse res) throws IOException {
- ArrayList phaselist = new ArrayList();
- DeploymentData depdata = DeploymentData.getInstance();
- phaselist.add(depdata.getINPhases());
- phaselist.add(depdata.getIN_FaultPhases());
- phaselist.add(depdata.getOUTPhases());
- phaselist.add(depdata.getOUT_FaultPhases());
-
- phaselist.add(depdata.getOperationInPhases());
- phaselist.add(depdata.getOperationInFaultPhases());
- phaselist.add(depdata.getOperationOutPhases());
- phaselist.add(depdata.getOperationOutFaultPhases());
-
- req.getSession().setAttribute(Constants.PHASE_LIST, phaselist);
- res.sendRedirect(LIST_PHASES_JSP_NAME);
- }
-
- /**
- * Method listService
- *
- * @param req
- * @param res
- * @param filePart
- * @throws IOException
- */
- private void listService(HttpServletRequest req, HttpServletResponse res, String filePart)
- throws IOException {
- String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length());
- HashMap services = engineContext.getAxisConfiguration().getServices();
- if ((services != null) && !services.isEmpty()) {
- Object serviceObj = services.get(new QName(serviceName));
- if (serviceObj != null) {
- req.getSession().setAttribute(Constants.SINGLE_SERVICE, serviceObj);
- }
- }
- String URI = req.getRequestURI();
- URI = URI.substring(0, URI.indexOf("services"));
- res.sendRedirect(URI + LIST_SINGLE_SERVICE_JSP_NAME);
- }
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java Sun Jun 19 21:06:28 2005
@@ -38,36 +38,7 @@
*/
private Socket socket;
private ByteArrayOutputStream outputStream;
- // /**
- // * Method obtainOutputStream
- // *
- // * @param msgContext
- // * @return
- // * @throws AxisFault
- // */
- // protected Writer obtainWriter(MessageContext msgContext) throws AxisFault {
- // if (!msgContext.isServerSide()) {
- // //create a new byte buffer output stream
- // outputStream = new ByteArrayOutputStream();
- // out = new OutputStreamWriter(outputStream);
- // } else {
- // out = (Writer) msgContext.getProperty(MessageContext.TRANSPORT_WRITER);
- // }
- // if (out == null) {
- // throw new AxisFault("can not find the suffient information to find endpoint");
- // } else {
- // return out;
- // }
- // }
-
- /**
- * Method writeTransportHeaders
- *
- * @param out
- * @param url
- * @param msgContext
- * @throws IOException
- */
+
protected void writeTransportHeaders(
Writer out,
URL url,
@@ -92,11 +63,10 @@
}
public void finalizeSendWithOutputStreamFromIncomingConnection(
- MessageContext msgContext,
- Writer writer) {
+ MessageContext msgContext) {
}
- public void finalizeSendWithToAddress(MessageContext msgContext, Writer writer)
+ public void finalizeSendWithToAddress(MessageContext msgContext)
throws AxisFault {
EndpointReference toURL = msgContext.getTo();
if (toURL != null) {
@@ -134,28 +104,28 @@
}
}
- protected Writer openTheConnection(EndpointReference epr) {
+ protected OutputStream openTheConnection(EndpointReference epr) {
outputStream = new ByteArrayOutputStream();
- return new OutputStreamWriter(outputStream);
+ return outputStream;
}
public void startSendWithOutputStreamFromIncomingConnection(
MessageContext msgContext,
- Writer writer)
+ OutputStream out)
throws AxisFault {
Object contianerManaged = msgContext.getProperty(Constants.CONTAINER_MANAGED);
if (contianerManaged == null || !Constants.VALUE_TRUE.equals(contianerManaged)) {
try {
- writer.write(new String(HTTPConstants.HTTP).toCharArray());
- writer.write(new String(HTTPConstants.OK).toCharArray());
- writer.write("\n\n".toCharArray());
+ out.write(new String(HTTPConstants.HTTP).getBytes());
+ out.write(new String(HTTPConstants.OK).getBytes());
+ out.write("\n\n".getBytes());
} catch (IOException e) {
throw new AxisFault(e);
}
}
}
- public void startSendWithToAddress(MessageContext msgContext, Writer writer) {
+ public void startSendWithToAddress(MessageContext msgContext,OutputStream out) {
}
/* (non-Javadoc)
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ListingAgent.java?rev=191389&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ListingAgent.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ListingAgent.java Sun Jun 19 21:06:28 2005
@@ -0,0 +1,384 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Runtime state of the engine
+ */
+package org.apache.axis.transport.http;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
+import org.apache.axis.context.ConfigurationContext;
+import org.apache.axis.deployment.util.DeploymentData;
+import org.apache.axis.description.OperationDescription;
+import org.apache.axis.engine.AxisConfigurationImpl;
+import org.apache.axis.engine.AxisFault;
+
+public class ListingAgent {
+
+ /**
+ * Field LIST_MULTIPLE_SERVICE_JSP_NAME
+ */
+ private static final String LIST_MULTIPLE_SERVICE_JSP_NAME = "listServices.jsp";
+
+ private static final String LIST_SRVICES_JSP_NAME = "listService.jsp";
+
+ private static final String SELECT_SERVICE_JSP_NAME = "SelectService.jsp";
+
+ private static final String ADMIN_JSP_NAME = "admin.jsp";
+
+ private static final String LIST_AVAILABLE_MODULES_JSP_NAME = "listModules.jsp";
+
+ private static final String LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME = "globalModules.jsp";
+
+ private static final String LIST_PHASES_JSP_NAME = "viewphases.jsp";
+
+ private static final String ENGAGING_MODULE_GLOBALLY_JSP_NAME = "engagingglobally.jsp";
+
+ private static final String ENGAGING_MODULE_TO_SERVICE_JSP_NAME = "engagingtoaservice.jsp";
+
+ /**
+ * Field LIST_SINGLE_SERVICE_JSP_NAME
+ */
+ private static final String LIST_SINGLE_SERVICE_JSP_NAME = "listSingleService.jsp";
+ private static final String VIEW_GLOBAL_HANDLERS_JSP_NAME = "ViewGlobalHandlers.jsp";
+ private static final String VIEW_SERVICE_HANDLERS_JSP_NAME = "ViewServiceHandlers.jsp";
+
+ private static final String ENGAGE_TO_OPERATION_JSP_NAME = "enaggingtoanopeartion.jsp";
+
+ public ListingAgent(ConfigurationContext engineContext) {
+ this.engineContext = engineContext;
+ }
+
+ private ConfigurationContext engineContext;
+ /**
+ * Field allowListServices
+ */
+ private final boolean allowListServices = true;
+
+ /**
+ * Field allowListSingleService
+ */
+ private final boolean allowListSingleService = true;
+
+ public void handle(
+ HttpServletRequest httpServletRequest,
+ HttpServletResponse httpServletResponse)
+ throws IOException {
+ String filePart = httpServletRequest.getRequestURL().toString();
+ if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LISTSERVICES)) {
+ listAdminServices(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.LIST_MODULES)) {
+ listModules(httpServletRequest, httpServletResponse);
+ return;
+ } else if (
+ (filePart != null) && filePart.endsWith(Constants.LIST_GLOABLLY_ENGAGED_MODULES)) {
+ listGloballyModules(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.LIST_PHASES)) {
+ listPhases(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_GLOBAL_MODULE)) {
+ engageModulesGlobally(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE)) {
+ engageModulesToService(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LOGGING)) {
+ adminLogging(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_GLOBAL_HANDLERS)) {
+ viewGlobalHandlers(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.SELECT_SERVICE)) {
+ selectService(httpServletRequest, httpServletResponse);
+ return;
+ } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_SERVICE_HANDLERS)) {
+ viewServiceHandlers(httpServletRequest, httpServletResponse);
+ return;
+ } else if (
+ (filePart != null) && filePart.endsWith(Constants.LIST_SERVICE_FOR_MODULE_ENGAMNET)) {
+ lsitServiceformodules(httpServletRequest, httpServletResponse);
+ return;
+ } else if (
+ (filePart != null) && filePart.endsWith(Constants.LIST_OPERATIONS_FOR_THE_SERVICE)) {
+ engageModulesToOpeartion(httpServletRequest, httpServletResponse);
+ return;
+ }
+
+ if (allowListServices && (filePart != null) && filePart.endsWith(Constants.LISTSERVICES)) {
+ listServices(httpServletRequest, httpServletResponse);
+ return;
+ } else {
+ if (allowListSingleService) {
+ listService(httpServletRequest, httpServletResponse, filePart);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Method listServices
+ *
+ * @param req
+ * @param res
+ * @throws IOException
+ */
+ private void listServices(HttpServletRequest req, HttpServletResponse res) throws IOException {
+ HashMap services = engineContext.getAxisConfiguration().getServices();
+ req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+ req.getSession().setAttribute(
+ Constants.ERROR_SERVICE_MAP,
+ engineContext.getAxisConfiguration().getFaulytServices());
+ res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
+ }
+
+ /**
+ *
+ * @param req
+ * @param res
+ * @throws IOException
+ */
+ private void listAdminServices(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ HashMap services = engineContext.getAxisConfiguration().getServices();
+ req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+ req.getSession().setAttribute(
+ Constants.ERROR_SERVICE_MAP,
+ engineContext.getAxisConfiguration().getFaulytServices());
+ res.sendRedirect(LIST_SRVICES_JSP_NAME);
+ }
+
+ private void selectService(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ HashMap services = engineContext.getAxisConfiguration().getServices();
+ req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+ req.getSession().setAttribute(Constants.MODULE_ENGAMENT, null);
+ res.sendRedirect(SELECT_SERVICE_JSP_NAME);
+ }
+ private void adminLogging(HttpServletRequest req, HttpServletResponse res) throws IOException {
+ String username = req.getParameter("userName");
+ String password = req.getParameter("password");
+ if (username == null
+ || password == null
+ || username.trim().equals("")
+ || password.trim().equals("")) {
+ throw new AxisFault("invalid user name");
+ }
+ String adminUserName =
+ (String) ((AxisConfigurationImpl) engineContext.getAxisConfiguration())
+ .getParameter(Constants.USER_NAME)
+ .getValue();
+ String adminPassword =
+ (String) ((AxisConfigurationImpl) engineContext.getAxisConfiguration())
+ .getParameter(Constants.PASSWORD)
+ .getValue();
+ if (username != null
+ && password != null
+ && username.equals(adminUserName)
+ && password.equals(adminPassword)) {
+ req.getSession().setAttribute(Constants.LOGGED, "Yes");
+ res.sendRedirect(ADMIN_JSP_NAME);
+ } else {
+ throw new AxisFault("invalid user name");
+ }
+ }
+
+ private void listModules(HttpServletRequest req, HttpServletResponse res) throws IOException {
+ HashMap modules =
+ ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
+ req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+ req.getSession().setAttribute(
+ Constants.ERROR_MODULE_MAP,
+ engineContext.getAxisConfiguration().getFaulytModules());
+ res.sendRedirect(LIST_AVAILABLE_MODULES_JSP_NAME);
+ }
+
+ private void engageModulesGlobally(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ HashMap modules =
+ ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
+ req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+ String moduleName = (String) req.getParameter("modules");
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+ if (moduleName != null) {
+ try {
+ engineContext.getAxisConfiguration().engageModule(new QName(moduleName));
+ req.getSession().setAttribute(
+ Constants.ENGAGE_STATUS,
+ moduleName + " module engaged globally Successfully");
+ } catch (AxisFault axisFault) {
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ }
+ }
+ req.getSession().setAttribute("modules", null);
+ res.sendRedirect(ENGAGING_MODULE_GLOBALLY_JSP_NAME);
+ }
+
+ private void engageModulesToOpeartion(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ HashMap modules =
+ ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
+ req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+ String moduleName = (String) req.getParameter("modules");
+
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+ req.getSession().setAttribute("modules", null);
+
+ String serviceName = (String) req.getParameter("service");
+ if (serviceName != null) {
+ req.getSession().setAttribute("service", serviceName);
+ } else {
+ serviceName = (String) req.getSession().getAttribute("service");
+ }
+ req.getSession().setAttribute(
+ Constants.OPEARTION_MAP,
+ engineContext
+ .getAxisConfiguration()
+ .getService(new QName(serviceName))
+ .getOperations());
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+ String operationName = (String) req.getParameter("operation");
+ if (serviceName != null && moduleName != null && operationName != null) {
+ try {
+ OperationDescription od =
+ engineContext.getAxisConfiguration().getService(
+ new QName(serviceName)).getOperation(
+ new QName(operationName));
+ od.engageModule(
+ engineContext.getAxisConfiguration().getModule(new QName(moduleName)));
+ req.getSession().setAttribute(
+ Constants.ENGAGE_STATUS,
+ moduleName + " module engaged to the operation Successfully");
+ } catch (AxisFault axisFault) {
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ }
+ }
+ req.getSession().setAttribute("operation", null);
+ res.sendRedirect(ENGAGE_TO_OPERATION_JSP_NAME);
+ }
+ private void engageModulesToService(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ HashMap modules =
+ ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
+ req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+ HashMap services = engineContext.getAxisConfiguration().getServices();
+ req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+ String moduleName = (String) req.getParameter("modules");
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+ req.getSession().setAttribute("modules", null);
+ String serviceName = (String) req.getParameter("service");
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+ if (serviceName != null && moduleName != null) {
+ try {
+
+ engineContext.getAxisConfiguration().getService(
+ new QName(serviceName)).engageModule(
+ engineContext.getAxisConfiguration().getModule(new QName(moduleName)));
+ req.getSession().setAttribute(
+ Constants.ENGAGE_STATUS,
+ moduleName + " module engaged to the service Successfully");
+ } catch (AxisFault axisFault) {
+ req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ }
+ }
+ req.getSession().setAttribute("service", null);
+ res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_JSP_NAME);
+ }
+
+ private void listGloballyModules(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ Collection modules =
+ ((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getEngadgedModules();
+ req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+ res.sendRedirect(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME);
+ }
+
+ private void lsitServiceformodules(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ HashMap services = engineContext.getAxisConfiguration().getServices();
+ req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+ req.getSession().setAttribute(Constants.MODULE_ENGAMENT, "Yes");
+ res.sendRedirect(SELECT_SERVICE_JSP_NAME);
+ }
+
+ private void viewGlobalHandlers(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ req.getSession().setAttribute(
+ Constants.GLOBAL_HANDLERS,
+ engineContext.getAxisConfiguration());
+ res.sendRedirect(VIEW_GLOBAL_HANDLERS_JSP_NAME);
+ }
+
+ private void viewServiceHandlers(HttpServletRequest req, HttpServletResponse res)
+ throws IOException {
+ String service = (String) req.getParameter("service");
+ if (service != null) {
+ req.getSession().setAttribute(
+ Constants.SERVICE_HANDLERS,
+ engineContext.getAxisConfiguration().getService(new QName(service)));
+ }
+ res.sendRedirect(VIEW_SERVICE_HANDLERS_JSP_NAME);
+ }
+
+ private void listPhases(HttpServletRequest req, HttpServletResponse res) throws IOException {
+ ArrayList phaselist = new ArrayList();
+ DeploymentData depdata = DeploymentData.getInstance();
+ phaselist.add(depdata.getINPhases());
+ phaselist.add(depdata.getIN_FaultPhases());
+ phaselist.add(depdata.getOUTPhases());
+ phaselist.add(depdata.getOUT_FaultPhases());
+
+ phaselist.add(depdata.getOperationInPhases());
+ phaselist.add(depdata.getOperationInFaultPhases());
+ phaselist.add(depdata.getOperationOutPhases());
+ phaselist.add(depdata.getOperationOutFaultPhases());
+
+ req.getSession().setAttribute(Constants.PHASE_LIST, phaselist);
+ res.sendRedirect(LIST_PHASES_JSP_NAME);
+ }
+
+ /**
+ * Method listService
+ *
+ * @param req
+ * @param res
+ * @param filePart
+ * @throws IOException
+ */
+ private void listService(HttpServletRequest req, HttpServletResponse res, String filePart)
+ throws IOException {
+ String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length());
+ HashMap services = engineContext.getAxisConfiguration().getServices();
+ if ((services != null) && !services.isEmpty()) {
+ Object serviceObj = services.get(new QName(serviceName));
+ if (serviceObj != null) {
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE, serviceObj);
+ }
+ }
+ String URI = req.getRequestURI();
+ URI = URI.substring(0, URI.indexOf("services"));
+ res.sendRedirect(URI + LIST_SINGLE_SERVICE_JSP_NAME);
+ }
+
+}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java Sun Jun 19 21:06:28 2005
@@ -18,9 +18,8 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
+import java.io.OutputStream;
import java.io.Reader;
-import java.io.Writer;
import java.net.ServerSocket;
import java.net.Socket;
@@ -140,7 +139,6 @@
if (configurationContext == null) {
throw new AxisFault("Engine Must be null");
}
- Writer out = new OutputStreamWriter(socket.getOutputStream());
Reader in = new InputStreamReader(socket.getInputStream());
TransportOutDescription transportOut =
configurationContext.getAxisConfiguration().getTransportOut(
@@ -155,7 +153,8 @@
// We do not have any Addressing Headers to put
// let us put the information about incoming transport
- msgContext.setProperty(MessageContext.TRANSPORT_WRITER, out);
+ OutputStream out = socket.getOutputStream();
+ msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
msgContext.setProperty(MessageContext.TRANSPORT_READER, in);
HTTPTransportReceiver reciver = new HTTPTransportReceiver();
msgContext.setEnvelope(
@@ -168,7 +167,7 @@
msgContext.getProperty(Constants.RESPONSE_WRITTEN);
if (contextWritten == null
|| !Constants.VALUE_TRUE.equals(contextWritten)) {
- out.write(new String(HTTPConstants.NOCONTENT).toCharArray());
+ out.write(new String(HTTPConstants.NOCONTENT).getBytes());
out.close();
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/local/LocalTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/local/LocalTransportSender.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/local/LocalTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/local/LocalTransportSender.java Sun Jun 19 21:06:28 2005
@@ -21,8 +21,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
+import java.io.OutputStream;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
@@ -36,15 +35,17 @@
}
- public void startSendWithToAddress(MessageContext msgContext, Writer writer) throws AxisFault {
+ public void startSendWithToAddress(MessageContext msgContext, OutputStream out) throws AxisFault {
}
- public void finalizeSendWithToAddress(MessageContext msgContext, Writer writer)
+ public void finalizeSendWithToAddress(MessageContext msgContext)
throws AxisFault {
try {
InputStream in = new ByteArrayInputStream(out.toByteArray());
LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver();
localTransportReceiver.processMessage(in, msgContext.getTo());
+ in.close();
+ out.close();
} catch (IOException e) {
throw new AxisFault(e);
}
@@ -53,10 +54,10 @@
/* (non-Javadoc)
* @see org.apache.axis.transport.AbstractTransportSender#openTheConnection(org.apache.axis.addressing.EndpointReference)
*/
- protected Writer openTheConnection(EndpointReference epr) throws AxisFault {
+ protected OutputStream openTheConnection(EndpointReference epr) throws AxisFault {
//out = new PipedOutputStream();
out = new ByteArrayOutputStream();
- return new OutputStreamWriter(out);
+ return out;
}
/* (non-Javadoc)
@@ -64,15 +65,14 @@
*/
public void startSendWithOutputStreamFromIncomingConnection(
MessageContext msgContext,
- Writer writer)
+ OutputStream out)
throws AxisFault {
throw new UnsupportedOperationException();
}
public void finalizeSendWithOutputStreamFromIncomingConnection(
- MessageContext msgContext,
- Writer writer)
+ MessageContext msgContext)
throws AxisFault {
throw new UnsupportedOperationException();
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java Sun Jun 19 21:06:28 2005
@@ -16,12 +16,9 @@
package org.apache.axis.transport.mail;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.StringWriter;
-import java.io.Writer;
+import java.io.OutputStream;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
@@ -36,13 +33,13 @@
private String password;
private String smtpPort = "25";
- private StringWriter w;
+ private ByteArrayOutputStream byteArrayOutputStream;
public MailTransportSender() {
}
- public void finalizeSendWithToAddress(MessageContext msgContext, Writer writer)
+ public void finalizeSendWithToAddress(MessageContext msgContext)
throws AxisFault {
try {
TransportOutDescription transportOut = msgContext.getTransportOut();
@@ -73,7 +70,7 @@
System.out.println(subject);
System.out.println(email);
- sender.send(subject, email, w.getBuffer().toString());
+ sender.send(subject, email,new String(byteArrayOutputStream.toByteArray()));
} else {
throw new AxisFault(
"user, port, host or password not set, "
@@ -94,25 +91,24 @@
}
- public void startSendWithToAddress(MessageContext msgContext, Writer writer) throws AxisFault {
+ public void startSendWithToAddress(MessageContext msgContext, OutputStream out) throws AxisFault {
}
- protected Writer openTheConnection(EndpointReference epr) throws AxisFault {
- w = new StringWriter();
- return w;
+ protected OutputStream openTheConnection(EndpointReference epr) throws AxisFault {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ return byteArrayOutputStream;
}
//Output Stream based cases are not supported
public void startSendWithOutputStreamFromIncomingConnection(
MessageContext msgContext,
- Writer writer)
+ OutputStream out)
throws AxisFault {
throw new UnsupportedOperationException();
}
public void finalizeSendWithOutputStreamFromIncomingConnection(
- MessageContext msgContext,
- Writer writer)
+ MessageContext msgContext)
throws AxisFault {
}
/* (non-Javadoc)
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPServer.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPServer.java Sun Jun 19 21:06:28 2005
@@ -17,6 +17,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
@@ -95,7 +96,7 @@
break;
}
- Writer out = new OutputStreamWriter(socket.getOutputStream());
+
Reader in = new InputStreamReader(socket.getInputStream());
TransportOutDescription transportOut =
configContext.getAxisConfiguration().getTransportOut(
@@ -107,7 +108,8 @@
new QName(Constants.TRANSPORT_TCP)),
transportOut);
msgContext.setServerSide(true);
- msgContext.setProperty(MessageContext.TRANSPORT_WRITER, out);
+ OutputStream out = socket.getOutputStream();
+ msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
msgContext.setProperty(MessageContext.TRANSPORT_READER, in);
AxisEngine engine = new AxisEngine(configContext);