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 gd...@apache.org on 2005/07/11 19:49:08 UTC
svn commit: r210165 [5/20] - in /webservices/axis/trunk/java/modules:
addressing/src/org/apache/axis2/handlers/addressing/
addressing/test/org/apache/axis2/handlers/addressing/
addressing/test/org/apache/axis2/handlers/util/
core/src/org/apache/axis2/a...
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java Mon Jul 11 10:48:55 2005
@@ -70,8 +70,12 @@
return totalread;
}
}
- bytesread = in.read(b, off + totalread, Math.min(len - totalread,
- (int) Math.min(chunkSize, Integer.MAX_VALUE)));
+ bytesread =
+ in.read(b,
+ off + totalread,
+ Math.min(len - totalread,
+ (int) Math.min(chunkSize,
+ Integer.MAX_VALUE)));
if (bytesread > 0) {
totalread += bytesread;
chunkSize -= bytesread;
@@ -129,7 +133,9 @@
if (bufsz > maxCharLong) {
closed = true;
- throw new IOException("Chunked input stream failed to receive valid chunk size:" + sbuf);
+ throw new IOException(
+ "Chunked input stream failed to receive valid chunk size:" +
+ sbuf);
}
try {
chunkSize = Long.parseLong(sbuf, 16);
@@ -140,11 +146,12 @@
if (chunkSize < 1L) closed = true;
if (chunkSize != 0L && c < 0) {
//If chunk size is zero try and be tolerant that there maybe no cr or lf at the end.
- throw new IOException("HTTP Chunked stream closed in middle of chunk.");
+ throw new IOException(
+ "HTTP Chunked stream closed in middle of chunk.");
}
if (chunkSize < 0L)
throw new IOException("HTTP Chunk size received " +
- chunkSize + " is less than zero.");
+ chunkSize + " is less than zero.");
return chunkSize;
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Mon Jul 11 10:48:55 2005
@@ -29,7 +29,12 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMOutput;
import org.apache.axis2.transport.TransportSender;
-import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
@@ -91,7 +96,8 @@
OMOutput output = new OMOutput(out, false);
dataOut.serialize(output);
}
- msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+ msgContext.getOperationContext().setProperty(
+ Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
} catch (XMLStreamException e) {
throw new AxisFault(e);
} catch (FactoryConfigurationError e) {
@@ -105,7 +111,8 @@
}
public void writeMessageWithCommons(MessageContext msgContext,
- EndpointReference toURL, OMElement dataout) throws AxisFault {
+ EndpointReference toURL,
+ OMElement dataout) throws AxisFault {
try {
URL url = new URL(toURL.getAddress());
//Configure the transport
@@ -117,8 +124,9 @@
PostMethod postMethod = new PostMethod();
postMethod.setPath(url.getFile());
msgContext.setProperty(HTTP_METHOD, postMethod);
- postMethod.setRequestEntity(new AxisRequestEntity(dataout,
- chuncked, msgContext.isDoingMTOM()));
+ postMethod.setRequestEntity(
+ new AxisRequestEntity(dataout,
+ chuncked, msgContext.isDoingMTOM()));
if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
&& chuncked) {
((PostMethod) postMethod).setContentChunked(true);
@@ -126,20 +134,20 @@
if (msgContext.isDoingMTOM()) {
postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
- OMOutput.getContentType(true));
+ OMOutput.getContentType(true));
} else {
postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
- "text/xml; charset=utf-8");
+ "text/xml; charset=utf-8");
}
postMethod.setRequestHeader(HTTPConstants.HEADER_ACCEPT,
- HTTPConstants.HEADER_ACCEPT_APPL_SOAP
- + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME
- + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED
- + HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
+ HTTPConstants.HEADER_ACCEPT_APPL_SOAP
+ + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME
+ + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED
+ + HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url
- .getHost());
+ .getHost());
postMethod.setRequestHeader(HTTPConstants.HEADER_CACHE_CONTROL,
- "no-cache");
+ "no-cache");
postMethod
.setRequestHeader(HTTPConstants.HEADER_PRAGMA, "no-cache");
//content length is not set yet
@@ -150,25 +158,28 @@
//postMethod.setHttp11(false); todo method to findout the
// transport version...
//allowing keep-alive for 1.0
- postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
- HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+ postMethod.setRequestHeader(
+ HTTPConstants.HEADER_CONNECTION,
+ HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
} else {
// allowing keep-alive for 1.1
- postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
- HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+ postMethod.setRequestHeader(
+ HTTPConstants.HEADER_CONNECTION,
+ HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
}
}
// othervise assumes HTTP 1.1 and keep-alive is default.
if (!msgContext.isDoingREST()) {
postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
- soapActionString);
+ soapActionString);
}
//execuite the HtttpMethodBase - a connection manager can be given
// for handle multiple
httpClient = new HttpClient();
//hostConfig handles the socket functions..
- HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
+ HostConfiguration hostConfig = getHostConfiguration(msgContext,
+ url);
//code that wirte the stream to the wire
@@ -178,19 +189,24 @@
if (in == null) {
throw new AxisFault("Input Stream can not be Null");
}
- msgContext.getOperationContext().setProperty(MessageContext.TRANSPORT_IN, in);
+ msgContext.getOperationContext().setProperty(
+ MessageContext.TRANSPORT_IN, in);
Header contentTypeHeader = postMethod
.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
if (contentTypeHeader != null) {
String contentType = contentTypeHeader.getValue();
if (contentType != null
- && contentType
- .indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
+ &&
+ contentType
+ .indexOf(
+ HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
+ 0) {
OperationContext opContext = msgContext
.getOperationContext();
if (opContext != null) {
- opContext.setProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
- contentType);
+ opContext.setProperty(
+ HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+ contentType);
}
}
}
@@ -199,8 +215,8 @@
return;
} else {
throw new AxisFault("Error " + postMethod.getStatusCode()
- + " Error Message is "
- + postMethod.getResponseBodyAsString());
+ + " Error Message is "
+ + postMethod.getResponseBodyAsString());
}
} catch (MalformedURLException e) {
throw new AxisFault(e);
@@ -217,7 +233,7 @@
//TODO cheaking wheather the host is a proxy
HostConfiguration config = new HostConfiguration();
config.setHost(targetURL.getHost(), targetURL.getPort() == -1 ? 80
- : targetURL.getPort());
+ : targetURL.getPort());
return config;
}
@@ -334,12 +350,13 @@
this.chuncked = true;
}
} else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
- .getValue())) {
+ .getValue())) {
//TODO HTTP1.0 specific parameters
} else {
- throw new AxisFault("Parameter "
- + HTTPConstants.PROTOCOL_VERSION
- + " Can have values only HTTP/1.0 or HTTP/1.1");
+ throw new AxisFault(
+ "Parameter "
+ + HTTPConstants.PROTOCOL_VERSION
+ + " Can have values only HTTP/1.0 or HTTP/1.1");
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Mon Jul 11 10:48:55 2005
@@ -22,7 +22,12 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
/**
* Class HTTPTransportReceiver
@@ -180,7 +185,8 @@
index = 4;
} else {
- throw new AxisFault("Unsupported HTTP request type: Only GET and POST is supported");
+ throw new AxisFault(
+ "Unsupported HTTP request type: Only GET and POST is supported");
}
value = readFirstLineArg(' ');
@@ -244,7 +250,8 @@
// case END:
// break;
default :
- throw new AxisFault("Error Occured Unknown state " + state);
+ throw new AxisFault(
+ "Error Occured Unknown state " + state);
}
}
state = BEFORE_SEPERATOR;
@@ -429,7 +436,8 @@
}
}
if (c == -1) {
- throw new AxisFault("Every line should ends with the \\n, unexpected End of stream");
+ throw new AxisFault(
+ "Every line should ends with the \\n, unexpected End of stream");
} else {
return (count > 0) ? count : -1;
}
@@ -443,7 +451,8 @@
*
* @return
*/
- public static String getServicesHTML(ConfigurationContext configurationContext) {
+ public static String getServicesHTML(
+ ConfigurationContext configurationContext) {
String temp = "";
Map services =
configurationContext.getAxisConfiguration().getServices();
@@ -462,7 +471,8 @@
operations = axisService.getOperations();
operationsList = operations.values();
- temp += "<h3>" + axisService.getName().getLocalPart() + "</h3>";
+ temp += "<h3>" + axisService.getName().getLocalPart() +
+ "</h3>";
if (operationsList.size() > 0) {
temp += "Available operations <ul>";
for (Iterator iterator1 = operationsList.iterator();
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java Mon Jul 11 10:48:55 2005
@@ -31,7 +31,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.net.*;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.URL;
import java.util.Map;
/**
@@ -61,25 +65,36 @@
boolean doMTOM = msgContext.isDoingMTOM();
StringBuffer buf = new StringBuffer();
buf.append(HTTPConstants.HEADER_POST).append(" ");
- buf.append(url.getFile()).append(" ").append(httpVersion).append("\n");
+ buf.append(url.getFile()).append(" ").append(httpVersion).append(
+ "\n");
if (doMTOM) {
- buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(OMOutput.getContentType(true)).append("\n");
+ buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ")
+ .append(OMOutput.getContentType(true))
+ .append("\n");
} else {
String nsURI = msgContext.getEnvelope().getNamespace().getName();
if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
- buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(SOAP12Constants.SOAP_12_CONTENT_TYPE);
+ buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ")
+ .append(SOAP12Constants.SOAP_12_CONTENT_TYPE);
buf.append("; charset=utf-8\n");
- } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
- buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": text/xml; charset=utf-8\n");
+ } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+ nsURI)) {
+ buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(
+ ": text/xml; charset=utf-8\n");
} else {
- throw new AxisFault("Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
+ throw new AxisFault(
+ "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
}
}
- buf.append(HTTPConstants.HEADER_ACCEPT).append(": application/soap+xml, application/dime, multipart/related, text/*\n");
- buf.append(HTTPConstants.HEADER_HOST).append(": ").append(url.getHost()).append("\n");
- buf.append(HTTPConstants.HEADER_CACHE_CONTROL).append(": no-cache\n");
+ buf.append(HTTPConstants.HEADER_ACCEPT).append(
+ ": application/soap+xml, application/dime, multipart/related, text/*\n");
+ buf.append(HTTPConstants.HEADER_HOST).append(": ").append(
+ url.getHost())
+ .append("\n");
+ buf.append(HTTPConstants.HEADER_CACHE_CONTROL).append(
+ ": no-cache\n");
buf.append(HTTPConstants.HEADER_PRAGMA).append(": no-cache\n");
if (chuncked) {
buf
@@ -89,7 +104,8 @@
.append("\n");
}
if (!chuncked && !msgContext.isDoingMTOM()) {
- buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(": " + contentLength + "\n");
+ buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(
+ ": " + contentLength + "\n");
}
if (!msgContext.isDoingREST()) {
buf.append("SOAPAction: \"" + soapActionString + "\"\n");
@@ -101,14 +117,16 @@
}
}
- public void finalizeSendWithOutputStreamFromIncomingConnection(MessageContext msgContext,
- OutputStream out) {
+ public void finalizeSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext,
+ OutputStream out) {
}
private OutputStream openSocket(MessageContext msgContext)
throws AxisFault {
TransportSenderInfo transportInfo =
- (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
+ (TransportSenderInfo) msgContext.getProperty(
+ TRANSPORT_SENDER_INFO);
EndpointReference toURL = msgContext.getTo();
if (toURL != null) {
@@ -116,7 +134,7 @@
URL url = new URL(toURL.getAddress());
SocketAddress add =
new InetSocketAddress(url.getHost(),
- url.getPort() == -1 ? 80 : url.getPort());
+ url.getPort() == -1 ? 80 : url.getPort());
Socket socket = new Socket();
socket.connect(add);
transportInfo.url = url;
@@ -139,7 +157,8 @@
throws AxisFault {
try {
TransportSenderInfo transportInfo =
- (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
+ (TransportSenderInfo) msgContext.getProperty(
+ TRANSPORT_SENDER_INFO);
InputStream in = null;
if (chuncked || msgContext.isDoingMTOM()) {
if (chuncked) {
@@ -155,9 +174,9 @@
//write header to the out put stream
writeTransportHeaders(outS,
- transportInfo.url,
- msgContext,
- bytes.length);
+ transportInfo.url,
+ msgContext,
+ bytes.length);
outS.flush();
//write the content to the real output stream
outS.write(bytes);
@@ -170,18 +189,27 @@
.RESPONSE_ACK_CODE_VAL
.equals(map.get(HTTPConstants.RESPONSE_CODE))) {
String transferEncoding =
- (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
+ (String) map.get(
+ HTTPConstants.HEADER_TRANSFER_ENCODING);
if (transferEncoding != null
- && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding)) {
+ &&
+ HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+ transferEncoding)) {
in = new ChunkedInputStream(transportInfo.in);
}
msgContext.setProperty(MessageContext.TRANSPORT_IN, in);
- String contentType = (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE);
- if (contentType != null && contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
+ String contentType = (String) map.get(
+ HTTPConstants.HEADER_CONTENT_TYPE);
+ if (contentType != null &&
+ contentType.indexOf(
+ HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
+ 0) {
OperationContext opContext = msgContext.getOperationContext();
if (opContext != null) {
- opContext.setProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE, contentType);
+ opContext.setProperty(
+ HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+ contentType);
}
}
}
@@ -200,21 +228,27 @@
return openSocket(msgctx);
} else {
TransportSenderInfo transportInfo =
- (TransportSenderInfo) msgctx.getProperty(TRANSPORT_SENDER_INFO);
+ (TransportSenderInfo) msgctx.getProperty(
+ TRANSPORT_SENDER_INFO);
transportInfo.outputStream = new ByteArrayOutputStream();
return transportInfo.outputStream;
}
}
- public OutputStream startSendWithOutputStreamFromIncomingConnection(MessageContext msgContext,
- OutputStream out)
+ public OutputStream startSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext,
+ OutputStream out)
throws AxisFault {
if (msgContext.isDoingMTOM()) {
- HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo) msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo);
+ HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo) msgContext.getProperty(
+ HTTPConstants.HTTPOutTransportInfo);
if (httpOutTransportInfo != null) {
- httpOutTransportInfo.setContentType(OMOutput.getContentType(true));
+ httpOutTransportInfo.setContentType(
+ OMOutput.getContentType(true));
} else {
- throw new AxisFault("Property " + HTTPConstants.HTTPOutTransportInfo + " not set by the Server");
+ throw new AxisFault(
+ "Property " + HTTPConstants.HTTPOutTransportInfo +
+ " not set by the Server");
}
}
@@ -227,7 +261,8 @@
try {
if (msgContext.isDoingMTOM() || chuncked) {
TransportSenderInfo transportInfo =
- (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
+ (TransportSenderInfo) msgContext.getProperty(
+ TRANSPORT_SENDER_INFO);
writeTransportHeaders(out, transportInfo.url, msgContext, -1);
out.flush();
if (chuncked) {
@@ -249,7 +284,8 @@
*/
public void cleanUp(MessageContext msgContext) throws AxisFault {
TransportSenderInfo transportInfo =
- (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
+ (TransportSenderInfo) msgContext.getProperty(
+ TRANSPORT_SENDER_INFO);
try {
if (transportInfo.socket != null) {
transportInfo.socket.close();
@@ -274,18 +310,22 @@
if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
Parameter transferEncoding =
- transportOut.getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
+ transportOut.getParameter(
+ HTTPConstants.HEADER_TRANSFER_ENCODING);
if (transferEncoding != null
- && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding.getValue())) {
+ &&
+ HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+ transferEncoding.getValue())) {
this.chuncked = true;
}
} else if (
HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
//TODO HTTP1.0 specific parameters
} else {
- throw new AxisFault("Parameter "
- + HTTPConstants.PROTOCOL_VERSION
- + " Can have values only HTTP/1.0 or HTTP/1.1");
+ throw new AxisFault(
+ "Parameter "
+ + HTTPConstants.PROTOCOL_VERSION
+ + " Can have values only HTTP/1.0 or HTTP/1.1");
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Mon Jul 11 10:48:55 2005
@@ -25,7 +25,11 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.om.*;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMText;
import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
@@ -42,24 +46,33 @@
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
import java.util.Iterator;
import java.util.Map;
public class HTTPTransportUtils {
public static void processHTTPPostRequest(MessageContext msgContext,
- InputStream in, OutputStream out, String contentType,
- String soapAction, String requestURI,
+ InputStream in,
+ OutputStream out,
+ String contentType,
+ String soapAction,
+ String requestURI,
ConfigurationContext configurationContext) throws AxisFault {
try {
- if (soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
+ if (soapAction != null && soapAction.startsWith("\"") &&
+ soapAction.endsWith("\"")) {
soapAction = soapAction.substring(1, soapAction.length() - 1);
}
msgContext.setWSAAction(soapAction);
msgContext.setSoapAction(soapAction);
msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
- requestURI));
+ requestURI));
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
msgContext.setServerSide(true);
@@ -67,14 +80,19 @@
StAXBuilder builder = null;
- if (contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
+ if (contentType.indexOf(
+ HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
+ 0) {
builder = selectBuilderForMIME(msgContext, in, contentType);
envelope = (SOAPEnvelope) builder.getDocumentElement();
} else if (contentType != null
- && contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
+ &&
+ contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >
+ -1) {
//If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
//the SOAP Action is absent it is rest !!
- Object enable = msgContext.getProperty(Constants.Configuration.ENABLE_REST);
+ Object enable = msgContext.getProperty(
+ Constants.Configuration.ENABLE_REST);
if ((soapAction == null || soapAction.length() == 0)
&& Constants.VALUE_TRUE.equals(enable)) {
msgContext.setDoingREST(true);
@@ -110,22 +128,28 @@
}
public static boolean processHTTPGetRequest(MessageContext msgContext,
- InputStream in, OutputStream out, String contentType,
- String soapAction, String requestURI,
- ConfigurationContext configurationContext, Map requestParameters)
+ InputStream in,
+ OutputStream out,
+ String contentType,
+ String soapAction,
+ String requestURI,
+ ConfigurationContext configurationContext,
+ Map requestParameters)
throws AxisFault {
- if (soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
+ if (soapAction != null && soapAction.startsWith("\"") &&
+ soapAction.endsWith("\"")) {
soapAction = soapAction.substring(1, soapAction.length() - 1);
}
msgContext.setWSAAction(soapAction);
msgContext.setSoapAction(soapAction);
msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
- requestURI));
+ requestURI));
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
msgContext.setServerSide(true);
try {
SOAPEnvelope envelope = HTTPTransportUtils
- .createEnvelopeFromGetRequest(requestURI, requestParameters);
+ .createEnvelopeFromGetRequest(requestURI,
+ requestParameters);
if (envelope == null) {
return false;
} else {
@@ -140,7 +164,8 @@
}
}
- public static final SOAPEnvelope createEnvelopeFromGetRequest(String requestUrl, Map map) {
+ public static final SOAPEnvelope createEnvelopeFromGetRequest(
+ String requestUrl, Map map) {
String[] values = Utils
.parseRequestURLForServiceAndOperation(requestUrl);
@@ -150,7 +175,7 @@
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
OMNamespace omNs = soapFactory.createOMNamespace(values[0],
- "services");
+ "services");
OMNamespace defualtNs = new OMNamespaceImpl("", null);
OMElement opElement = soapFactory.createOMElement(operation, omNs);
@@ -172,20 +197,31 @@
}
public static StAXBuilder selectBuilderForMIME(MessageContext msgContext,
- InputStream inStream, String contentTypeString) throws OMException,
+ InputStream inStream,
+ String contentTypeString) throws OMException,
XMLStreamException, FactoryConfigurationError {
StAXBuilder builder = null;
- boolean fileCacheForAttachments = (Constants.VALUE_TRUE.equals(msgContext.getProperty(Constants.Configuration.CACHE_ATTACHMENTS)));
+ boolean fileCacheForAttachments = (Constants.VALUE_TRUE.equals(
+ msgContext.getProperty(
+ Constants.Configuration.CACHE_ATTACHMENTS)));
String attachmentRepoDir = null;
if (fileCacheForAttachments) {
- attachmentRepoDir = (String) msgContext.getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
+ attachmentRepoDir =
+ (String) msgContext.getProperty(
+ Constants.Configuration.ATTACHMENT_TEMP_DIR);
}
- MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString, fileCacheForAttachments, attachmentRepoDir);
+ MIMEHelper mimeHelper = new MIMEHelper(inStream,
+ contentTypeString,
+ fileCacheForAttachments,
+ attachmentRepoDir);
XMLStreamReader reader = XMLInputFactory.newInstance()
- .createXMLStreamReader(new BufferedReader(new InputStreamReader(mimeHelper
- .getSOAPPartInputStream())));
+ .createXMLStreamReader(
+ new BufferedReader(
+ new InputStreamReader(
+ mimeHelper
+ .getSOAPPartInputStream())));
/*
* put a reference to Attachments in to the message context
*/
@@ -195,7 +231,8 @@
* Creates the MTOM specific MTOMStAXSOAPModelBuilder
*/
builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
- } else if (mimeHelper.getAttachmentSpecType().equals(MIMEHelper.SWA_TYPE)) {
+ } else if (mimeHelper.getAttachmentSpecType().equals(
+ MIMEHelper.SWA_TYPE)) {
builder = new StAXSOAPModelBuilder(reader);
}
return builder;
@@ -222,9 +259,12 @@
public static boolean doWriteMTOM(MessageContext msgContext) {
boolean enableMTOM = false;
- if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) != null) {
- enableMTOM = Constants.VALUE_TRUE.equals(msgContext
- .getProperty(Constants.Configuration.ENABLE_MTOM));
+ if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) !=
+ null) {
+ enableMTOM =
+ Constants.VALUE_TRUE.equals(
+ msgContext
+ .getProperty(Constants.Configuration.ENABLE_MTOM));
}
boolean envelopeContainsOptimise = HTTPTransportUtils
.checkEnvelopeForOptimise(msgContext.getEnvelope());
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Mon Jul 11 10:48:55 2005
@@ -38,7 +38,8 @@
private ConfigurationContext configurationContext;
private Socket socket;
- public HTTPWorker(ConfigurationContext configurationContext, Socket socket) {
+ public HTTPWorker(ConfigurationContext configurationContext,
+ Socket socket) {
this.configurationContext = configurationContext;
this.socket = socket;
}
@@ -55,11 +56,13 @@
InputStream inStream = socket.getInputStream();
TransportOutDescription transportOut =
- configurationContext.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_HTTP));
+ configurationContext.getAxisConfiguration()
+ .getTransportOut(new QName(Constants.TRANSPORT_HTTP));
msgContext =
new MessageContext(configurationContext,
- configurationContext.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
- transportOut);
+ configurationContext.getAxisConfiguration()
+ .getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
+ transportOut);
msgContext.setServerSide(true);
//parse the Transport Headers
@@ -68,45 +71,61 @@
//build a way to write the respone if the Axis choose to do so
- String transferEncoding = (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
+ String transferEncoding = (String) map.get(
+ HTTPConstants.HEADER_TRANSFER_ENCODING);
if (transferEncoding != null
- && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding)) {
+ &&
+ HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+ transferEncoding)) {
inStream = new ChunkedInputStream(inStream);
- out = new SimpleHTTPOutputStream(socket.getOutputStream(), true);
+ out =
+ new SimpleHTTPOutputStream(
+ socket.getOutputStream(), true);
} else {
- out = new SimpleHTTPOutputStream(socket.getOutputStream(), false);
+ out =
+ new SimpleHTTPOutputStream(
+ socket.getOutputStream(), false);
}
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
//This is way to provide Accsess to the transport information to the transport Sender
msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
- new SimpleHTTPOutTransportInfo(out));
+ new SimpleHTTPOutTransportInfo(out));
- if (HTTPConstants.HEADER_GET.equals(map.get(HTTPConstants.HTTP_REQ_TYPE))) {
+ if (HTTPConstants.HEADER_GET.equals(
+ map.get(HTTPConstants.HTTP_REQ_TYPE))) {
//It is GET handle the Get request
boolean processed =
- HTTPTransportUtils.processHTTPGetRequest(msgContext,
- inStream,
- out,
- (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
- (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
- (String) map.get(HTTPConstants.REQUEST_URI),
- configurationContext,
- HTTPTransportReceiver.getGetRequestParameters((String) map.get(HTTPConstants.REQUEST_URI)));
+ HTTPTransportUtils.processHTTPGetRequest(
+ msgContext,
+ inStream,
+ out,
+ (String) map.get(
+ HTTPConstants.HEADER_CONTENT_TYPE),
+ (String) map.get(
+ HTTPConstants.HEADER_SOAP_ACTION),
+ (String) map.get(HTTPConstants.REQUEST_URI),
+ configurationContext,
+ HTTPTransportReceiver.getGetRequestParameters(
+ (String) map.get(
+ HTTPConstants.REQUEST_URI)));
if (!processed) {
- out.write(HTTPTransportReceiver.getServicesHTML(configurationContext).getBytes());
+ out.write(
+ HTTPTransportReceiver.getServicesHTML(
+ configurationContext)
+ .getBytes());
out.flush();
}
} else {
//It is POST, handle it
HTTPTransportUtils.processHTTPPostRequest(msgContext,
- inStream,
- out,
- (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
- (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
- (String) map.get(HTTPConstants.REQUEST_URI),
- configurationContext);
+ inStream,
+ out,
+ (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
+ (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
+ (String) map.get(HTTPConstants.REQUEST_URI),
+ configurationContext);
}
out.finalize();
@@ -116,7 +135,9 @@
AxisEngine engine = new AxisEngine(configurationContext);
if (msgContext != null) {
if (out == null) {
- out = new SimpleHTTPOutputStream(socket.getOutputStream(), false);
+ out =
+ new SimpleHTTPOutputStream(
+ socket.getOutputStream(), false);
}
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
engine.handleFault(msgContext, e);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java Mon Jul 11 10:48:55 2005
@@ -84,52 +84,66 @@
private OutputStream out = null;
public void handle(HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse, OutputStream out)
+ HttpServletResponse httpServletResponse,
+ OutputStream out)
throws IOException {
this.out = out;
String filePart = httpServletRequest.getRequestURL().toString();
- if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LISTSERVICES)) {
+ if ((filePart != null) &&
+ filePart.endsWith(Constants.ADMIN_LISTSERVICES)) {
listAdminServices(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.LIST_MODULES)) {
+ } else if ((filePart != null) &&
+ filePart.endsWith(Constants.LIST_MODULES)) {
listModules(httpServletRequest, httpServletResponse);
return;
} else if (
- (filePart != null) && filePart.endsWith(Constants.LIST_GLOABLLY_ENGAGED_MODULES)) {
+ (filePart != null) &&
+ filePart.endsWith(Constants.LIST_GLOABLLY_ENGAGED_MODULES)) {
listGloballyModules(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.LIST_PHASES)) {
+ } else if ((filePart != null) &&
+ filePart.endsWith(Constants.LIST_PHASES)) {
listPhases(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_GLOBAL_MODULE)) {
+ } 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)) {
+ } else if ((filePart != null) &&
+ filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE)) {
engageModulesToService(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LOGGING)) {
+ } else if ((filePart != null) &&
+ filePart.endsWith(Constants.ADMIN_LOGGING)) {
adminLogging(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_GLOBAL_HANDLERS)) {
+ } else if ((filePart != null) &&
+ filePart.endsWith(Constants.VIEW_GLOBAL_HANDLERS)) {
viewGlobalHandlers(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.SELECT_SERVICE)) {
+ } else if ((filePart != null) &&
+ filePart.endsWith(Constants.SELECT_SERVICE)) {
selectService(httpServletRequest, httpServletResponse);
return;
- } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_SERVICE_HANDLERS)) {
+ } 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)) {
+ (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)) {
+ (filePart != null) &&
+ filePart.endsWith(Constants.LIST_OPERATIONS_FOR_THE_SERVICE)) {
engageModulesToOpeartion(httpServletRequest, httpServletResponse);
return;
}
- if (allowListServices && (filePart != null) && filePart.endsWith(Constants.LISTSERVICES)) {
+ if (allowListServices && (filePart != null) &&
+ filePart.endsWith(Constants.LISTSERVICES)) {
listServices(httpServletRequest, httpServletResponse);
return;
} else {
@@ -151,7 +165,7 @@
HashMap services = configContext.getAxisConfiguration().getServices();
req.getSession().setAttribute(Constants.SERVICE_MAP, services);
req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
- configContext.getAxisConfiguration().getFaulytServices());
+ configContext.getAxisConfiguration().getFaulytServices());
res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
}
@@ -160,16 +174,18 @@
* @param res
* @throws IOException
*/
- private void listAdminServices(HttpServletRequest req, HttpServletResponse res)
+ private void listAdminServices(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
HashMap services = configContext.getAxisConfiguration().getServices();
req.getSession().setAttribute(Constants.SERVICE_MAP, services);
req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
- configContext.getAxisConfiguration().getFaulytServices());
+ configContext.getAxisConfiguration().getFaulytServices());
res.sendRedirect(LIST_SRVICES_JSP_NAME);
}
- private void selectService(HttpServletRequest req, HttpServletResponse res)
+ private void selectService(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
HashMap services = configContext.getAxisConfiguration().getServices();
req.getSession().setAttribute(Constants.SERVICE_MAP, services);
@@ -210,11 +226,12 @@
((AxisConfigurationImpl) configContext.getAxisConfiguration()).getModules();
req.getSession().setAttribute(Constants.MODULE_MAP, modules);
req.getSession().setAttribute(Constants.ERROR_MODULE_MAP,
- configContext.getAxisConfiguration().getFaulytModules());
+ configContext.getAxisConfiguration().getFaulytModules());
res.sendRedirect(LIST_AVAILABLE_MODULES_JSP_NAME);
}
- private void engageModulesGlobally(HttpServletRequest req, HttpServletResponse res)
+ private void engageModulesGlobally(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
HashMap modules =
((AxisConfigurationImpl) configContext.getAxisConfiguration()).getModules();
@@ -223,18 +240,21 @@
req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
if (moduleName != null) {
try {
- configContext.getAxisConfiguration().engageModule(new QName(moduleName));
+ configContext.getAxisConfiguration().engageModule(
+ new QName(moduleName));
req.getSession().setAttribute(Constants.ENGAGE_STATUS,
- moduleName + " module engaged globally Successfully");
+ moduleName + " module engaged globally Successfully");
} catch (AxisFault axisFault) {
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ 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)
+ private void engageModulesToOpeartion(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
HashMap modules =
((AxisConfigurationImpl) configContext.getAxisConfiguration()).getModules();
@@ -251,28 +271,35 @@
serviceName = (String) req.getSession().getAttribute("service");
}
req.getSession().setAttribute(Constants.OPEARTION_MAP,
- configContext
- .getAxisConfiguration()
- .getService(new QName(serviceName))
- .getOperations());
+ configContext
+ .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 =
- configContext.getAxisConfiguration().getService(new QName(serviceName)).getOperation(new QName(operationName));
- od.engageModule(configContext.getAxisConfiguration().getModule(new QName(moduleName)));
+ configContext.getAxisConfiguration().getService(
+ new QName(serviceName))
+ .getOperation(new QName(operationName));
+ od.engageModule(
+ configContext.getAxisConfiguration().getModule(
+ new QName(moduleName)));
req.getSession().setAttribute(Constants.ENGAGE_STATUS,
- moduleName + " module engaged to the operation Successfully");
+ moduleName +
+ " module engaged to the operation Successfully");
} catch (AxisFault axisFault) {
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ 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)
+ private void engageModulesToService(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
HashMap modules =
((AxisConfigurationImpl) configContext.getAxisConfiguration()).getModules();
@@ -287,18 +314,25 @@
if (serviceName != null && moduleName != null) {
try {
- configContext.getAxisConfiguration().getService(new QName(serviceName)).engageModule(configContext.getAxisConfiguration().getModule(new QName(moduleName)));
+ configContext.getAxisConfiguration().getService(
+ new QName(serviceName))
+ .engageModule(
+ configContext.getAxisConfiguration().getModule(
+ new QName(moduleName)));
req.getSession().setAttribute(Constants.ENGAGE_STATUS,
- moduleName + " module engaged to the service Successfully");
+ moduleName +
+ " module engaged to the service Successfully");
} catch (AxisFault axisFault) {
- req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+ 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)
+ private void listGloballyModules(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
Collection modules =
((AxisConfigurationImpl) configContext.getAxisConfiguration()).getEngadgedModules();
@@ -306,7 +340,8 @@
res.sendRedirect(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME);
}
- private void lsitServiceformodules(HttpServletRequest req, HttpServletResponse res)
+ private void lsitServiceformodules(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
HashMap services = configContext.getAxisConfiguration().getServices();
req.getSession().setAttribute(Constants.SERVICE_MAP, services);
@@ -314,19 +349,22 @@
res.sendRedirect(SELECT_SERVICE_JSP_NAME);
}
- private void viewGlobalHandlers(HttpServletRequest req, HttpServletResponse res)
+ private void viewGlobalHandlers(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
req.getSession().setAttribute(Constants.GLOBAL_HANDLERS,
- configContext.getAxisConfiguration());
+ configContext.getAxisConfiguration());
res.sendRedirect(VIEW_GLOBAL_HANDLERS_JSP_NAME);
}
- private void viewServiceHandlers(HttpServletRequest req, HttpServletResponse res)
+ private void viewServiceHandlers(HttpServletRequest req,
+ HttpServletResponse res)
throws IOException {
String service = (String) req.getParameter("service");
if (service != null) {
req.getSession().setAttribute(Constants.SERVICE_HANDLERS,
- configContext.getAxisConfiguration().getService(new QName(service)));
+ configContext.getAxisConfiguration().getService(
+ new QName(service)));
}
res.sendRedirect(VIEW_SERVICE_HANDLERS_JSP_NAME);
}
@@ -355,9 +393,12 @@
* @param filePart
* @throws IOException
*/
- private void listService(HttpServletRequest req, HttpServletResponse res, String filePart)
+ private void listService(HttpServletRequest req,
+ HttpServletResponse res,
+ String filePart)
throws IOException {
- String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length());
+ String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1,
+ filePart.length());
HashMap services = configContext.getAxisConfiguration().getServices();
String wsdl = req.getParameter("wsdl");
if ((services != null) && !services.isEmpty()) {
@@ -367,7 +408,8 @@
// StringWriter writer = new StringWriter();
res.setContentType("text/xml");
PrintWriter out_writer = new PrintWriter(out);
- ((ServiceDescription) serviceObj).printWSDL(out_writer, filePart);
+ ((ServiceDescription) serviceObj).printWSDL(out_writer,
+ filePart);
// String wsdl_value = writer.toString().trim() ;
// if(wsdl_value == null || wsdl_value.trim().equals("")){
// wsdl_value = "WSDL is not available!!!";
@@ -382,7 +424,8 @@
wsdl = null;
return;
} else {
- req.getSession().setAttribute(Constants.SINGLE_SERVICE, serviceObj);
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE,
+ serviceObj);
}
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java Mon Jul 11 10:48:55 2005
@@ -68,10 +68,12 @@
public void writeHeader() throws IOException {
StringBuffer buf = new StringBuffer();
if (chuncked) {
- buf.append(new String(HTTPConstants.HEADER_PROTOCOL_11)).append(" ");
+ buf.append(new String(HTTPConstants.HEADER_PROTOCOL_11)).append(
+ " ");
buf.append(new String(HTTPConstants.OK)).append("\n");
buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING).append(": ");
- buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED).append("\n");
+ buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED).append(
+ "\n");
if (contentType != null) {
buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ");
buf.append(contentType).append("\n");
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Mon Jul 11 10:48:55 2005
@@ -74,7 +74,8 @@
*
* @param systemContext
*/
- public SimpleHTTPServer(ConfigurationContext systemContext, ServerSocket serverSoc) {
+ public SimpleHTTPServer(ConfigurationContext systemContext,
+ ServerSocket serverSoc) {
this.configurationContext = systemContext;
this.serverSocket = serverSoc;
}
@@ -124,7 +125,8 @@
break;
}
if (socket != null) {
- configurationContext.getThreadPool().addWorker(new HTTPWorker(configurationContext, socket));
+ configurationContext.getThreadPool().addWorker(
+ new HTTPWorker(configurationContext, socket));
}
}
} catch (IOException e) {
@@ -231,15 +233,18 @@
serverSoc = new ServerSocket(Integer.parseInt(args[1]));
SimpleHTTPServer receiver = new SimpleHTTPServer(args[0], serverSoc);
System.out.println("starting SimpleHTTPServer in port "
- + args[1]
- + " using the repository "
- + new File(args[0]).getAbsolutePath());
+ + args[1]
+ + " using the repository "
+ + new File(args[0]).getAbsolutePath());
receiver.setServerSocket(serverSoc);
Thread thread = new Thread(receiver);
thread.setDaemon(true);
try {
- System.out.println("[Axis2] Using the Repository " + new File(args[0]).getAbsolutePath());
- System.out.println("[Axis2] Starting the SimpleHTTPServer on port " + args[1]);
+ System.out.println(
+ "[Axis2] Using the Repository " +
+ new File(args[0]).getAbsolutePath());
+ System.out.println(
+ "[Axis2] Starting the SimpleHTTPServer on port " + args[1]);
thread.start();
System.out.println("[Axis2] SimpleHTTPServer started");
System.in.read();
@@ -253,10 +258,13 @@
*/
public EndpointReference replyToEPR(String serviceName) {
return new EndpointReference(AddressingConstants.WSA_REPLY_TO,
- "http://127.0.0.1:" + (serverSocket.getLocalPort()) + "/axis/services/" + serviceName);
+ "http://127.0.0.1:" + (serverSocket.getLocalPort()) +
+ "/axis/services/" +
+ serviceName);
}
- public void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
+ public void init(ConfigurationContext axisConf,
+ TransportInDescription transprtIn)
throws AxisFault {
this.configurationContext = axisConf;
Parameter param = transprtIn.getParameter(PARAM_PORT);
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java Mon Jul 11 10:48:55 2005
@@ -54,15 +54,18 @@
public void processMessage(InputStream in, EndpointReference to) throws AxisFault {
try {
TransportInDescription tIn =
- confContext.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_LOCAL));
+ confContext.getAxisConfiguration().getTransportIn(
+ new QName(Constants.TRANSPORT_LOCAL));
TransportOutDescription tOut =
- confContext.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_LOCAL));
+ confContext.getAxisConfiguration().getTransportOut(
+ new QName(Constants.TRANSPORT_LOCAL));
MessageContext msgCtx = new MessageContext(confContext, tIn, tOut);
msgCtx.setTo(to);
msgCtx.setServerSide(true);
XMLStreamReader reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new BufferedReader(new InputStreamReader(in)));
+ XMLInputFactory.newInstance().createXMLStreamReader(
+ new BufferedReader(new InputStreamReader(in)));
StAXBuilder builder = new StAXSOAPModelBuilder(reader);
msgCtx.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportSender.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportSender.java Mon Jul 11 10:48:55 2005
@@ -22,7 +22,11 @@
import org.apache.axis2.engine.AxisFault;
import org.apache.axis2.transport.AbstractTransportSender;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
public class LocalTransportSender extends AbstractTransportSender {
@@ -32,11 +36,13 @@
}
- public OutputStream startSendWithToAddress(MessageContext msgContext, OutputStream out) throws AxisFault {
+ public OutputStream startSendWithToAddress(MessageContext msgContext,
+ OutputStream out) throws AxisFault {
return out;
}
- public void finalizeSendWithToAddress(MessageContext msgContext, OutputStream out)
+ public void finalizeSendWithToAddress(MessageContext msgContext,
+ OutputStream out)
throws AxisFault {
try {
InputStream in = new ByteArrayInputStream(this.out.toByteArray());
@@ -52,7 +58,8 @@
/* (non-Javadoc)
* @see org.apache.axis2.transport.AbstractTransportSender#openTheConnection(org.apache.axis2.addressing.EndpointReference)
*/
- protected OutputStream openTheConnection(EndpointReference epr, MessageContext msgContext) throws AxisFault {
+ protected OutputStream openTheConnection(EndpointReference epr,
+ MessageContext msgContext) throws AxisFault {
//out = new PipedOutputStream();
out = new ByteArrayOutputStream();
return out;
@@ -61,14 +68,16 @@
/* (non-Javadoc)
* @see org.apache.axis2.transport.AbstractTransportSender#startSendWithOutputStreamFromIncomingConnection(org.apache.axis2.context.MessageContext, java.io.Writer)
*/
- public OutputStream startSendWithOutputStreamFromIncomingConnection(MessageContext msgContext,
- OutputStream out)
+ public OutputStream startSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext,
+ OutputStream out)
throws AxisFault {
throw new UnsupportedOperationException();
}
- public void finalizeSendWithOutputStreamFromIncomingConnection(MessageContext msgContext, OutputStream out)
+ public void finalizeSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext, OutputStream out)
throws AxisFault {
throw new UnsupportedOperationException();
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/EMailSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/EMailSender.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/EMailSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/EMailSender.java Mon Jul 11 10:48:55 2005
@@ -20,7 +20,13 @@
import org.apache.axis2.engine.AxisFault;
import org.apache.axis2.transport.EmailReceiver;
-import javax.mail.*;
+import javax.mail.Authenticator;
+import javax.mail.Flags;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
@@ -38,7 +44,10 @@
private String smtpPort;
private String password;
- public EMailSender(String user, String host, String smtpPort, String password) {
+ public EMailSender(String user,
+ String host,
+ String smtpPort,
+ String password) {
this.user = user;
this.host = host;
this.smtpPort = smtpPort;
@@ -63,7 +72,8 @@
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress((user)));
- msg.addRecipient(Message.RecipientType.TO, new InternetAddress(targetEmail));
+ msg.addRecipient(Message.RecipientType.TO,
+ new InternetAddress(targetEmail));
msg.setSubject(subject);
msg.addHeaderLine("Content-Type: text/plain; charset=us-ascii");
@@ -86,9 +96,14 @@
String password = "hemapani";
EMailSender sender = new EMailSender(user, host, smtpPort, password);
- sender.send("Testing mail sending", "hemapani@127.0.0.1", "Hellp, testing");
-
- EmailReceiver receiver = new EmailReceiver(user, host, "110", password);
+ sender.send("Testing mail sending",
+ "hemapani@127.0.0.1",
+ "Hellp, testing");
+
+ EmailReceiver receiver = new EmailReceiver(user,
+ host,
+ "110",
+ password);
receiver.connect();
Message[] msgs = receiver.receive();
if (msgs != null) {
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailClient.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailClient.java Mon Jul 11 10:48:55 2005
@@ -1,6 +1,14 @@
package org.apache.axis2.transport.mail;
-import javax.mail.*;
+import javax.mail.Authenticator;
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.Transport;
import javax.mail.internet.MimeMessage;
import java.io.IOException;
import java.util.Properties;
@@ -24,7 +32,10 @@
this(user, host, password, false);
}
- public MailClient(String user, String host, String password, boolean debug) {
+ public MailClient(String user,
+ String host,
+ String password,
+ boolean debug) {
from = user + '@' + host;
authentication = new PasswordAuthentication(user, password);
Properties props = new Properties();
@@ -40,7 +51,10 @@
return authentication;
}
- public void sendMessage(String to, String subject, String content, String soapAction)
+ public void sendMessage(String to,
+ String subject,
+ String content,
+ String soapAction)
throws MessagingException {
System.out.println("SENDING message from " + from + " to " + to);
System.out.println();
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java Mon Jul 11 10:48:55 2005
@@ -39,17 +39,30 @@
}
- public void finalizeSendWithToAddress(MessageContext msgContext, OutputStream out)
+ public void finalizeSendWithToAddress(MessageContext msgContext,
+ OutputStream out)
throws AxisFault {
try {
TransportOutDescription transportOut = msgContext.getTransportOut();
- user = Utils.getParameterValue(transportOut.getParameter(MailConstants.SMTP_USER));
- host = Utils.getParameterValue(transportOut.getParameter(MailConstants.SMTP_HOST));
+ user =
+ Utils.getParameterValue(
+ transportOut.getParameter(MailConstants.SMTP_USER));
+ host =
+ Utils.getParameterValue(
+ transportOut.getParameter(MailConstants.SMTP_HOST));
password =
- Utils.getParameterValue(transportOut.getParameter(MailConstants.SMTP_PASSWORD));
- smtpPort = Utils.getParameterValue(transportOut.getParameter(MailConstants.SMTP_PORT));
- if (user != null && host != null && password != null && smtpPort != null) {
- EMailSender sender = new EMailSender(user, host, smtpPort, password);
+ Utils.getParameterValue(
+ transportOut.getParameter(
+ MailConstants.SMTP_PASSWORD));
+ smtpPort =
+ Utils.getParameterValue(
+ transportOut.getParameter(MailConstants.SMTP_PORT));
+ if (user != null && host != null && password != null &&
+ smtpPort != null) {
+ EMailSender sender = new EMailSender(user,
+ host,
+ smtpPort,
+ password);
//TODO this is just a temporary hack, fix this to use input streams
@@ -70,17 +83,19 @@
System.out.println(subject);
System.out.println(email);
- sender.send(subject, email, new String(byteArrayOutputStream.toByteArray()));
+ sender.send(subject,
+ email,
+ new String(byteArrayOutputStream.toByteArray()));
} else {
throw new AxisFault("user, port, host or password not set, "
- + " [user null = "
- + (user == null)
- + ", password null= "
- + (password == null)
- + ", host null "
- + (host == null)
- + ",port null "
- + (smtpPort == null));
+ + " [user null = "
+ + (user == null)
+ + ", password null= "
+ + (password == null)
+ + ", host null "
+ + (host == null)
+ + ",port null "
+ + (smtpPort == null));
}
} catch (IOException e) {
@@ -90,24 +105,28 @@
}
- public OutputStream startSendWithToAddress(MessageContext msgContext, OutputStream out) throws AxisFault {
+ public OutputStream startSendWithToAddress(MessageContext msgContext,
+ OutputStream out) throws AxisFault {
return out;
}
- protected OutputStream openTheConnection(EndpointReference epr, MessageContext msgContext) throws AxisFault {
+ protected OutputStream openTheConnection(EndpointReference epr,
+ MessageContext msgContext) throws AxisFault {
byteArrayOutputStream = new ByteArrayOutputStream();
return byteArrayOutputStream;
}
//Output Stream based cases are not supported
- public OutputStream startSendWithOutputStreamFromIncomingConnection(MessageContext msgContext,
- OutputStream out)
+ public OutputStream startSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext,
+ OutputStream out)
throws AxisFault {
throw new UnsupportedOperationException();
}
- public void finalizeSendWithOutputStreamFromIncomingConnection(MessageContext msgContext, OutputStream out)
+ public void finalizeSendWithOutputStreamFromIncomingConnection(
+ MessageContext msgContext, OutputStream out)
throws AxisFault {
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java?rev=210165&r1=210164&r2=210165&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java Mon Jul 11 10:48:55 2005
@@ -76,12 +76,15 @@
MessageContext msgContext = null;
// create and initialize a message context
try {
- TransportInDescription transportIn = reg.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_MAIL));
- TransportOutDescription transportOut = reg.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_MAIL));
+ TransportInDescription transportIn = reg.getAxisConfiguration()
+ .getTransportIn(new QName(Constants.TRANSPORT_MAIL));
+ TransportOutDescription transportOut = reg.getAxisConfiguration()
+ .getTransportOut(new QName(Constants.TRANSPORT_MAIL));
msgContext = new MessageContext(reg, transportIn, transportOut);
msgContext.setServerSide(true);
- msgContext.setProperty(MailConstants.CONTENT_TYPE, mimeMessage.getContentType());
+ msgContext.setProperty(MailConstants.CONTENT_TYPE,
+ mimeMessage.getContentType());
String soapAction = getMailHeader(MailConstants.HEADER_SOAP_ACTION);
msgContext.setWSAAction(soapAction);
msgContext.setSoapAction(soapAction);
@@ -93,12 +96,16 @@
String replyTo = ((InternetAddress) mimeMessage.getReplyTo()[0]).getAddress();
if (replyTo != null) {
- msgContext.setReplyTo(new EndpointReference(AddressingConstants.WSA_REPLY_TO, replyTo));
+ msgContext.setReplyTo(
+ new EndpointReference(AddressingConstants.WSA_REPLY_TO,
+ replyTo));
}
String recepainets = ((InternetAddress) mimeMessage.getAllRecipients()[0]).getAddress();
if (recepainets != null) {
- msgContext.setTo(new EndpointReference(AddressingConstants.WSA_FROM, recepainets + "/" + serviceURL));
+ msgContext.setTo(
+ new EndpointReference(AddressingConstants.WSA_FROM,
+ recepainets + "/" + serviceURL));
} else {
throw new AxisFault("No receptineist found in the Email");
}
@@ -108,7 +115,8 @@
System.out.println("message[" + message + "]");
ByteArrayInputStream bais =
new ByteArrayInputStream(message.getBytes());
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
+ XMLStreamReader reader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(bais);
StAXBuilder builder = new StAXSOAPModelBuilder(reader);
msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());