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 pr...@apache.org on 2007/12/01 15:43:54 UTC
svn commit: r600141 [9/10] - in
/webservices/axis2/branches/java/jaxws21/modules: adb-codegen/
adb-codegen/src/org/apache/axis2/schema/
adb-codegen/src/org/apache/axis2/schema/template/
adb-codegen/src/org/apache/axis2/schema/util/ adb-codegen/src/org/...
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java Sat Dec 1 06:43:28 2007
@@ -19,20 +19,20 @@
package org.apache.axis2.transport.http.server;
+import java.io.IOException;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.ConnectionClosedException;
import org.apache.http.HttpException;
+import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
-import java.io.IOException;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-
/**
* I/O processor intended to process requests and fill in responses.
*
@@ -79,7 +79,7 @@
public void run() {
LOG.debug("New connection thread");
- HttpContext context = new HttpExecutionContext(null);
+ HttpContext context = new BasicHttpContext(null);
try {
while (! Thread.interrupted() && ! isDestroyed() && this.conn.isOpen()) {
this.httpservice.handleRequest(this.conn, context);
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java Sat Dec 1 06:43:28 2007
@@ -72,8 +72,13 @@
} catch (IOException e) {
throw AxisFault.makeFault(e);
} finally {
- msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
- HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+ String messageType =
+ (String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
+ if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) ||
+ HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) {
+ msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
+ HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+ }
}
return invokeAxisEngine(msgContext);
}
@@ -113,8 +118,13 @@
catch (IOException e) {
throw AxisFault.makeFault(e);
} finally {
- msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
- HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+ String messageType =
+ (String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
+ if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) ||
+ HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) {
+ msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
+ HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+ }
}
return invokeAxisEngine(msgContext);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientHandler.java Sat Dec 1 06:43:28 2007
@@ -55,8 +55,8 @@
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpParamsLinker;
import org.apache.http.protocol.BasicHttpProcessor;
+import org.apache.http.protocol.ExecutionContext;
import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
import org.apache.http.protocol.HttpProcessor;
import org.apache.http.protocol.RequestConnControl;
import org.apache.http.protocol.RequestContent;
@@ -132,8 +132,8 @@
try {
HttpContext context = conn.getContext();
- context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
- context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
+ context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+ context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
context.setAttribute(OUTGOING_MESSAGE_CONTEXT, axis2Req.getMsgContext());
context.setAttribute(REQUEST_SOURCE_CHANNEL, axis2Req.getSourceChannel());
@@ -143,7 +143,7 @@
this.httpProcessor.process(request, context);
conn.submitRequest(request);
- context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
+ context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
} catch (IOException e) {
handleException("I/O Error : " + e.getMessage(), e, conn);
@@ -162,8 +162,8 @@
HttpContext context = conn.getContext();
Axis2HttpRequest axis2Req = (Axis2HttpRequest) attachment;
- context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
- context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
+ context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+ context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
// allocate temporary buffers to process this request
context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
@@ -177,7 +177,7 @@
this.httpProcessor.process(request, context);
conn.submitRequest(request);
- context.setAttribute(HttpExecutionContext.HTTP_REQUEST, request);
+ context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
} catch (IOException e) {
handleException("I/O Error : " + e.getMessage(), e, conn);
@@ -368,11 +368,11 @@
context.setAttribute(RESPONSE_SINK_CHANNEL, responsePipe.sink());
BasicHttpEntity entity = new BasicHttpEntity();
- if (response.getStatusLine().getHttpVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
+ if (response.getStatusLine().getProtocolVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
entity.setChunked(true);
}
response.setEntity(entity);
- context.setAttribute(HttpContext.HTTP_RESPONSE, response);
+ context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
workerPool.execute(
new ClientWorker(cfgCtx, Channels.newInputStream(responsePipe.source()), response,
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ClientWorker.java Sat Dec 1 06:43:28 2007
@@ -48,14 +48,10 @@
private static final Log log = LogFactory.getLog(ClientWorker.class);
- /** the Axis2 configuration context */
- private ConfigurationContext cfgCtx = null;
/** the response message context that would be created */
private MessageContext responseMsgCtx = null;
/** the InputStream out of which the response body should be read */
private InputStream in = null;
- /** the original request message context */
- private MessageContext outMsgCtx = null;
/** the HttpResponse received */
private HttpResponse response = null;
@@ -69,9 +65,7 @@
public ClientWorker(ConfigurationContext cfgCtx, InputStream in,
HttpResponse response, MessageContext outMsgCtx) {
- this.cfgCtx = cfgCtx;
this.in = in;
- this.outMsgCtx = outMsgCtx;
this.response = response;
try {
@@ -165,13 +159,10 @@
return;
} catch (XMLStreamException e) {
log.error("Error creating response SOAP envelope", e);
- } catch (IOException e) {
- log.error("Error closing input stream from which message was read", e);
}
- AxisEngine engine = new AxisEngine(cfgCtx);
try {
- engine.receive(responseMsgCtx);
+ AxisEngine.receive(responseMsgCtx);
} catch (AxisFault af) {
log.error("Fault processing response message through Axis2", af);
}
@@ -183,9 +174,4 @@
} catch (IOException ignore) {}
}
- // -------------- utility methods -------------
- private void handleException(String msg, Exception e) throws AxisFault {
- log.error(msg, e);
- throw new AxisFault(msg, e);
- }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ConnectionPool.java Sat Dec 1 06:43:28 2007
@@ -19,7 +19,7 @@
package org.apache.axis2.transport.nhttp;
import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.protocol.HttpExecutionContext;
+import org.apache.http.protocol.ExecutionContext;
import org.apache.http.HttpHost;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -78,7 +78,7 @@
public static void release(NHttpClientConnection conn) {
HttpHost host = (HttpHost) conn.getContext().getAttribute(
- HttpExecutionContext.HTTP_TARGET_HOST);
+ ExecutionContext.HTTP_TARGET_HOST);
String key = host.getHostName() + ":" + Integer.toString(host.getPort());
List connections = (List) connMap.get(key);
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java Sat Dec 1 06:43:28 2007
@@ -44,7 +44,6 @@
import org.apache.axis2.transport.TransportSender;
import org.apache.axis2.transport.TransportUtils;
import org.apache.axis2.util.MessageContextBuilder;
-import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
@@ -238,8 +237,8 @@
if (headers != null && !headers.isEmpty()) {
headers.remove(HTTP.CONN_DIRECTIVE);
headers.remove(HTTP.TRANSFER_ENCODING);
- headers.remove(HTTP.DATE_DIRECTIVE);
- headers.remove(HTTP.SERVER_DIRECTIVE);
+ headers.remove(HTTP.DATE_HEADER);
+ headers.remove(HTTP.SERVER_HEADER);
headers.remove(HTTP.CONTENT_TYPE);
headers.remove(HTTP.CONTENT_LEN);
headers.remove(HTTP.USER_AGENT);
@@ -314,7 +313,7 @@
// if this is a dummy message to handle http 202 case with non-blocking IO
// set the status code to 202 and the message body to an empty byte array (see below)
- if (Utils.isExplicitlyTrue(msgContext, NhttpConstants.SC_ACCEPTED) &&
+ if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED) &&
msgContext.getProperty(
//org.apache.sandesha2.Sandesha2Constants.MessageContextProperties.SEQUENCE_ID
"WSRMSequenceId") == null) {
@@ -337,7 +336,7 @@
OutputStream out = worker.getOutputStream();
try {
- if (Utils.isExplicitlyTrue(msgContext, NhttpConstants.SC_ACCEPTED) &&
+ if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED) &&
msgContext.getProperty(
//Sandesha2Constants.MessageContextProperties.SEQUENCE_ID
"WSRMSequenceId") == null) {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/HttpCoreRequestResponseTransport.java Sat Dec 1 06:43:28 2007
@@ -25,7 +25,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axis2.transport.RequestResponseTransport.RequestResponseTransportStatus;
/**
* This interface is a point of control for Axis2 (and Sandesha2 in particular) to control
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/LoggingIOSession.java Sat Dec 1 06:43:28 2007
@@ -53,6 +53,10 @@
this.log = LogFactory.getLog(session.getClass());
}
+ public int getStatus() {
+ return this.session.getStatus();
+ }
+
public ByteChannel channel() {
return this.channel;
}
@@ -205,4 +209,4 @@
}
-}
\ No newline at end of file
+}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java Sat Dec 1 06:43:28 2007
@@ -19,13 +19,10 @@
package org.apache.axis2.transport.nhttp;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-import org.apache.http.params.HttpConnectionParams;
-
import java.util.Properties;
-import java.io.IOException;
-import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Store and manage properties that tune the nhttp transport
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerHandler.java Sat Dec 1 06:43:28 2007
@@ -103,7 +103,7 @@
HttpContext context = conn.getContext();
HttpRequest request = conn.getHttpRequest();
- context.setAttribute(HttpContext.HTTP_REQUEST, request);
+ context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
// allocate temporary buffers to process this request
context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
@@ -116,7 +116,7 @@
context.setAttribute(RESPONSE_SOURCE_CHANNEL, responsePipe.source());
// create the default response to this request
- HttpVersion httpVersion = request.getRequestLine().getHttpVersion();
+ ProtocolVersion httpVersion = request.getRequestLine().getProtocolVersion();
HttpResponse response = responseFactory.newHttpResponse(
httpVersion, HttpStatus.SC_OK, context);
response.setParams(this.params);
@@ -232,7 +232,8 @@
* @param conn the connection being processed
*/
public void timeout(final NHttpServerConnection conn) {
- HttpRequest req = (HttpRequest) conn.getContext().getAttribute(HttpContext.HTTP_REQUEST);
+ HttpRequest req = (HttpRequest) conn.getContext().getAttribute(
+ ExecutionContext.HTTP_REQUEST);
if (req != null) {
log.debug("Connection Timeout for request to : " + req.getRequestLine().getUri() +
" Probably the keepalive connection was closed");
@@ -258,7 +259,7 @@
public void exception(final NHttpServerConnection conn, final HttpException e) {
HttpContext context = conn.getContext();
HttpRequest request = conn.getHttpRequest();
- HttpVersion ver = request.getRequestLine().getHttpVersion();
+ ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
HttpResponse response = responseFactory.newHttpResponse(
ver, HttpStatus.SC_BAD_REQUEST, context);
byte[] msg = EncodingUtils.getAsciiBytes("Malformed HTTP request: " + e.getMessage());
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java Sat Dec 1 06:43:28 2007
@@ -18,34 +18,38 @@
*/
package org.apache.axis2.transport.nhttp;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.description.AxisService;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.transport.http.HTTPTransportUtils;
-import org.apache.axis2.transport.http.HTTPTransportReceiver;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.axis2.transport.http.HTTPTransportReceiver;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.http.*;
+import org.apache.http.Header;
+import org.apache.http.HttpInetConnection;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
import org.apache.http.nio.NHttpServerConnection;
import org.apache.http.protocol.HTTP;
import org.apache.ws.commons.schema.XmlSchema;
-import javax.xml.namespace.QName;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.*;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.InetAddress;
-
/**
* Processes an incoming request through Axis2. An instance of this class would be created to
* process each unique request
@@ -318,9 +322,6 @@
} catch (AxisFault axisFault) {
handleException("Error writing ?xsd output to client", axisFault);
- return;
- } catch (IOException e) {
- handleException("Error writing ?xsd output to client", e);
return;
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Util.java Sat Dec 1 06:43:28 2007
@@ -21,7 +21,6 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
import org.apache.axis2.Constants;
import org.apache.axis2.transport.http.HTTPTransportUtils;
import org.apache.axis2.transport.http.HTTPConstants;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/util/PipeImpl.java Sat Dec 1 06:43:28 2007
@@ -26,8 +26,6 @@
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
-import java.nio.channels.spi.SelectorProvider;
-import java.nio.ByteBuffer;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.IOException;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java Sat Dec 1 06:43:28 2007
@@ -284,7 +284,7 @@
// there are some information that the fault thrower wants to pass to the fault path.
// Means that the fault is a ws-addressing one hence use the ws-addressing fault action.
Object faultInfoForHeaders =
- processingContext.getProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
+ processingContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
if (faultInfoForHeaders != null) {
faultContext.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS, faultInfoForHeaders);
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/Utils.java Sat Dec 1 06:43:28 2007
@@ -33,7 +33,6 @@
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.Flow;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.InOnlyAxisOperation;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java Sat Dec 1 06:43:28 2007
@@ -18,28 +18,27 @@
*/
package org.apache.axis2.util;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.namespace.Constants;
+import org.apache.axis2.wsdl.HTTPHeaderMessage;
import org.apache.axis2.wsdl.SOAPHeaderMessage;
import org.apache.axis2.wsdl.SOAPModuleMessage;
-import org.apache.axis2.wsdl.HTTPHeaderMessage;
-import org.apache.axis2.namespace.Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import java.util.Map;
-import java.util.Iterator;
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
/**
@@ -434,7 +433,7 @@
public static void addWSAWActionAttribute(OMElement element,
String action ,
OMNamespace wsaw) {
- if (action == null || action.length() == 0) {
+ if (action == null || action.length() == 0 || "\\\"\\\"".equals(action)) {
return;
}
element.addAttribute("Action", action, wsaw);
@@ -468,19 +467,11 @@
}
public static void addWSDLDocumentationElement(AxisDescription axisDescription, OMElement omElement, OMFactory omFactory, OMNamespace wsdl) {
- String documentationString = axisDescription.getDocumentation();
+ OMNode documentationNode = axisDescription.getDocumentationNode();
OMElement documentation;
- if (documentationString != null && !"".equals(documentationString)) {
+ if (documentationNode != null) {
documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
- OMText omText;
- if (documentationString.indexOf(CDATA_START) > -1) {
- documentationString = documentationString.replaceFirst(CDATA_START_REGEX, "");
- documentationString = documentationString.replaceFirst(CDATA_END_REGEX, "");
- omText = omFactory.createOMText(documentationString, XMLStreamConstants.CDATA);
- } else {
- omText = omFactory.createOMText(documentationString);
- }
- documentation.addChild(omText);
+ documentation.addChild(documentationNode);
omElement.addChild(documentation);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java Sat Dec 1 06:43:28 2007
@@ -23,12 +23,17 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.util.Constants;
import org.apache.axis2.metadata.registry.MetadataFactoryRegistry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/** This class serves as a factory for ConfigurationContexts suitable in the client environment. */
public class ClientConfigurationFactory {
+
+ private static final Log log = LogFactory.getLog(ClientConfigurationFactory.class);
/** Returns a ClientConfigurationFactory object. */
public static ClientConfigurationFactory newInstance() {
@@ -42,15 +47,17 @@
*/
public synchronized ConfigurationContext getClientConfigurationContext() {
ConfigurationContext configContext = null;
- //TODO: Add logging
String repoPath = System.getProperty(Constants.AXIS2_REPO_PATH);
String axisConfigPath = System.getProperty(Constants.AXIS2_CONFIG_PATH);
+ if(log.isDebugEnabled()){
+ log.debug("Axis2 repository path : "+repoPath);
+ log.debug("Axis2 Config path : "+axisConfigPath);
+ }
try {
configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(repoPath, axisConfigPath);
} catch (AxisFault e) {
- // TODO: Add RAS logging and processing
- e.printStackTrace();
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("clientConfigCtxtErr",e.getMessage()));
}
return configContext;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Sat Dec 1 06:43:28 2007
@@ -22,12 +22,15 @@
*/
package org.apache.axis2.jaxws.description.builder;
+import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.wsdl.Definition;
+
+import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
@@ -98,6 +101,14 @@
private WsdlGenerator wsdlGenerator;
private ClassLoader classLoader;
+
+ // represents a stream to the XML handler chain configuration
+ // either this or the HandlerChainAnnot may be present, but
+ // not both, they may both be null
+ private InputStream handlerChainSource;
+
+ // JAXB object used to represent handler chain configuration info
+ private HandlerChainsType handlerChainsType = null;
// Methods
public WebServiceAnnot getWebServiceAnnot() {
@@ -454,6 +465,22 @@
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
+ }
+
+ public void setHandlerChainSource(InputStream handlerChainSource) {
+ this.handlerChainSource = handlerChainSource;
+ }
+
+ public InputStream getHandlerChainSource() {
+ return handlerChainSource;
+ }
+
+ public HandlerChainsType getHandlerChainsType() {
+ return handlerChainsType;
+ }
+
+ public void setHandlerChainsType(HandlerChainsType handlerChainsType) {
+ this.handlerChainsType = handlerChainsType;
}
/**
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/ConverterUtils.java Sat Dec 1 06:43:28 2007
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.description.builder.converter;
+import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.FieldDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.HandlerChainAnnot;
@@ -39,6 +40,7 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
+import java.security.PrivilegedAction;
import java.util.List;
public class ConverterUtils {
@@ -51,9 +53,13 @@
* the annotation (i.e. Class, Method, Field)
* @return - <code>Annotation</code> annotation represented by the given <code>Class</code>
*/
- public static Annotation getAnnotation(Class annotationClass, AnnotatedElement element) {
- return element.getAnnotation(annotationClass);
- }
+ public static Annotation getAnnotation(final Class annotationClass, final AnnotatedElement element) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return element.getAnnotation(annotationClass);
+ }
+ });
+ }
/**
* This is a helper method to create a <code>HandlerChainAnnot</code> since the
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java Sat Dec 1 06:43:28 2007
@@ -37,6 +37,7 @@
import org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter;
import org.apache.axis2.jaxws.description.validator.ServiceDescriptionValidator;
import org.apache.axis2.jaxws.description.validator.EndpointDescriptionValidator;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -198,9 +199,7 @@
if (log.isDebugEnabled()) {
log.debug("ServiceDesciption was not created for class: " + serviceImplClass);
}
- // TODO: NLS & RAS
- throw ExceptionFactory.makeWebServiceException(
- "A ServiceDescription was not created for " + serviceImplClass);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createServiceDescrErr", serviceImplClass.getName()));
}
}
return serviceDesc;
@@ -230,18 +229,10 @@
}
} else {
- String msg =
- "The ServiceDescription failed to validate due to the following errors: \n" +
- validator.toString();
-
- if (log.isDebugEnabled()) {
- log.debug("Validation Phase 2 failure: " + msg);
- log.debug("Failing composite: " + serviceImplComposite.toString());
- log.debug("Failing Service Description: " + serviceDescription.toString());
- }
-
- // TODO: Validate all service descriptions before failing
- // TODO: Get more detailed failure information from the Validator
+ String msg = Messages.getMessage("createSrvcDescrDBCMapErr",
+ validator.toString(),
+ serviceImplComposite.toString(),
+ serviceDescription.toString());
throw ExceptionFactory.makeWebServiceException(msg);
}
} else {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Sat Dec 1 06:43:28 2007
@@ -364,12 +364,11 @@
}
}
- public static HandlerChainsType loadHandlerChains(InputStream is) {
+ public static HandlerChainsType loadHandlerChains(InputStream is, ClassLoader classLoader) {
try {
// All the classes we need should be part of this package
JAXBContext jc = JAXBContext
- .newInstance("org.apache.axis2.jaxws.description.xml.handler",
- EndpointDescriptionImpl.class.getClassLoader());
+ .newInstance("org.apache.axis2.jaxws.description.xml.handler", classLoader);
Unmarshaller u = jc.createUnmarshaller();
@@ -379,7 +378,7 @@
} catch (Exception e) {
throw ExceptionFactory
.makeWebServiceException(
- "EndpointDescriptionImpl: loadHandlerList: thrown when attempting to unmarshall JAXB content");
+ "DescriptionUtils: loadHandlerList: thrown when attempting to unmarshall JAXB content");
}
}
@@ -531,8 +530,7 @@
try {
axisService.addParameter(headerQNParameter);
} catch (AxisFault e) {
- // TODO: RAS
- log.warn("Unable to add Parameter for header QNames to AxisService " + axisService, e);
+ log.warn(Messages.getMessage("regHandlerHeadersErr",axisService.getName(),e.getMessage()));
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Sat Dec 1 06:43:28 2007
@@ -161,6 +161,7 @@
//ANNOTATION: @HandlerChain
private HandlerChain handlerChainAnnotation;
private HandlerChainsType handlerChainsType;
+ private InputStream handlerChainSource;
// Information common to both WebService and WebServiceProvider annotations
private String annotation_WsdlLocation;
@@ -220,9 +221,9 @@
// REVIEW: setting these should probably be done in the getters! It needs to be done before we try to select a
// port to use if one wasn't specified because we'll try to get to the annotations to get the PortType
if (this.implOrSEIClass != null) {
- webServiceAnnotation = (WebService)implOrSEIClass.getAnnotation(WebService.class);
+ webServiceAnnotation = (WebService)getAnnotation(implOrSEIClass,WebService.class);
webServiceProviderAnnotation =
- (WebServiceProvider)implOrSEIClass.getAnnotation(WebServiceProvider.class);
+ (WebServiceProvider)getAnnotation(implOrSEIClass,WebServiceProvider.class);
}
this.isDynamicPort = dynamicPort;
if (DescriptionUtils.isEmpty(portName)) {
@@ -234,12 +235,8 @@
// At this point, there must be a port QName set, either as passed in, or determined from the WSDL and/or annotations.
// If not, that is an error.
if (this.portQName == null) {
- if (log.isDebugEnabled()) {
- log.debug("PortQName was null and could not be determined by runtime. Class: " +
- theClass + "; ServiceDescription: " + parent);
- }
- throw ExceptionFactory.makeWebServiceException(
- "EndpointDescription: portQName could not be determined for class " + theClass);
+ String msg = Messages.getMessage("endpointDescriptionErr1",theClass.getName(),parent.getClass().getName());
+ throw ExceptionFactory.makeWebServiceException(msg);
}
// TODO: Refactor this with the consideration of no WSDL/Generic Service/Annotated SEI
@@ -255,23 +252,9 @@
try {
getServiceDescriptionImpl().getClientConfigurationFactory()
.completeAxis2Configuration(axisService);
- } catch (DeploymentException e) {
- // TODO RAS & NLS
- if (log.isDebugEnabled()) {
- log.debug(
- "Caught DeploymentException attempting to complete configuration on AxisService: "
- + axisService + " for ServiceDesription: " + parent, e);
- }
- throw ExceptionFactory.makeWebServiceException(
- "Unable to complete configuration due to exception " + e, e);
} catch (Exception e) {
- // TODO RAS & NLS
- if (log.isDebugEnabled()) {
- log.debug("Caught Exception attempting to complete configuration on AxisService: "
- + axisService + " for ServiceDesription: " + parent, e);
- }
- throw ExceptionFactory.makeWebServiceException(
- "Unable to complete configuration due to exception " + e, e);
+ String msg = Messages.getMessage("endpointDescriptionErr2",e.getClass().getName(),parent.getClass().getName());
+ throw ExceptionFactory.makeWebServiceException(msg, e);
}
}
@@ -295,12 +278,21 @@
this.parentServiceDescription = parent;
this.serviceImplName = serviceImplName;
this.implOrSEIClass = null;
+
composite = getServiceDescriptionImpl().getDescriptionBuilderComposite();
if (composite == null) {
- throw ExceptionFactory.makeWebServiceException(
- "EndpointDescription.EndpointDescription: parents DBC is null");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr3"));
+ }
+
+ if(composite.getHandlerChainAnnot() != null && composite.getHandlerChainSource() != null) {
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("handlerSourceFail", composite.getClassName()));
}
+
+ handlerChainSource = composite.getHandlerChainSource();
+
+ handlerChainsType = composite.getHandlerChainsType();
//Set the base level of annotation that we are processing...currently
// a 'WebService' or a 'WebServiceProvider'
@@ -441,8 +433,7 @@
axisService.addParameter(wsdlDefParameter);
axisService.addParameter(wsdlLocationParameter);
} catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(
- "EndpointDescription: Unable to add parameters to AxisService");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr4"));
}
}
else {
@@ -475,7 +466,7 @@
} catch (Exception e) {
throw ExceptionFactory
- .makeWebServiceException("EndpointDescription: Unable to add parameters to AxisService");
+ .makeWebServiceException(Messages.getMessage("endpointDescriptionErr4"),e);
}
}
@@ -535,9 +526,7 @@
try {
axisService.addParameter(parameter);
} catch (AxisFault e) {
- // TODO: Throwing wrong exception
- e.printStackTrace();
- throw new UnsupportedOperationException("Can't add AxisService param: " + e);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr5"),e);
}
}
}
@@ -566,20 +555,14 @@
if (!getServiceDescriptionImpl().isDBCMap()) {
- webServiceAnnotation = (WebService)implOrSEIClass.getAnnotation(WebService.class);
+ webServiceAnnotation = (WebService)getAnnotation(implOrSEIClass,WebService.class);
webServiceProviderAnnotation =
- (WebServiceProvider)implOrSEIClass.getAnnotation(WebServiceProvider.class);
+ (WebServiceProvider)getAnnotation(implOrSEIClass,WebServiceProvider.class);
if (webServiceAnnotation == null && webServiceProviderAnnotation == null)
- // TODO: NLS
- throw ExceptionFactory.makeWebServiceException(
- "Either WebService or WebServiceProvider annotation must be present on " +
- implOrSEIClass);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr6",implOrSEIClass.getName()));
else if (webServiceAnnotation != null && webServiceProviderAnnotation != null)
- // TODO: NLS
- throw ExceptionFactory.makeWebServiceException(
- "Both WebService or WebServiceProvider annotations cannot be presenton " +
- implOrSEIClass);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr7",implOrSEIClass.getName()));
}
// If portName was specified, set it. Otherwise, we will get it from the appropriate
// annotation when the getter is called.
@@ -613,9 +596,8 @@
// does not extend Exception, so lets catch everything that extends Throwable
// rather than just Exception.
} catch (Throwable e) {
- // TODO: Throwing wrong exception
- e.printStackTrace();
- throw new UnsupportedOperationException("Can't create SEI class: " + e);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr8"),e);
+
}
}
endpointInterfaceDescription = new EndpointInterfaceDescriptionImpl(seiClass, this);
@@ -704,15 +686,10 @@
void updateWithSEI(Class sei) {
// Updating with an SEI is only valid for declared ports; it is not valid for dynamic ports.
if (isDynamicPort()) {
- // TODO: RAS and NLS
- throw ExceptionFactory.makeWebServiceException(
- "Can not update an SEI on a dynamic port. PortQName:" + portQName);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("updateWithSEIErr1",portQName.toString()));
}
if (sei == null) {
- // TODO: RAS and NLS
- throw ExceptionFactory.makeWebServiceException(
- "EndpointDescription.updateWithSEI was passed a null SEI. PortQName:" +
- portQName);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("updateWithSEIErr2",portQName.toString()));
}
if (endpointInterfaceDescription != null) {
@@ -742,9 +719,7 @@
}
if (axisService == null) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("Unable to create AxisService for "
- + createAxisServiceName());
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("setupAxisServiceErr1",createAxisServiceName()));
}
// Save the Service QName as a parameter.
@@ -762,8 +737,7 @@
axisService.addParameter(portParameter);
}
catch (AxisFault e) {
- // TODO RAS
- e.printStackTrace();
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("setupAxisServiceErr2"),e);
}
}
@@ -793,9 +767,7 @@
}
if (axisService == null) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("Unable to create AxisService for "
- + createAxisServiceName());
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("setupAxisServiceErr1",createAxisServiceName()));
}
//Save the Port Type name
@@ -827,8 +799,7 @@
axisService.addParameter(serviceClassNameParameter);
}
catch (AxisFault e) {
- // TODO RAS
- e.printStackTrace();
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("setupAxisServiceErr2"),e);
}
}
@@ -882,8 +853,6 @@
} catch (AxisFault e) {
// REVIEW: If we couldn't use the WSDL, should we fail instead of continuing to process using annotations?
// Note that if we choose to fail, we need to distinguish the partial WSDL case (which can not fail)
- // TODO: RAS/NLS Need to update the message with the appropriate inserts
-// log.warn(Messages.getMessage("warnAxisFault", e.toString()), e);
String wsdlLocation = (getServiceDescriptionImpl().getWSDLLocation() != null) ?
getServiceDescriptionImpl().getWSDLLocation().toString() : null;
String implClassName = null;
@@ -892,10 +861,7 @@
} else {
implClassName = (implOrSEIClass != null) ? implOrSEIClass.getName() : null;
}
- log.warn("The WSDL file could not be used due to an exception. The WSDL will be ignored and annotations will be used. Implementation class: "
- + implClassName
- + "; WSDL Location: "
- + wsdlLocation);
+ log.warn(Messages.getMessage("bldAxisSrvcFromWSDLErr",implClassName,wsdlLocation),e);
isBuiltFromWSDL = false;
return isBuiltFromWSDL;
@@ -997,9 +963,7 @@
}
if (!wsdlPortFound) {
- // TODO: NLS and RAS
- throw ExceptionFactory.makeWebServiceException(
- "WSDL Port not found for port " + portQName.getLocalPart());
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDescErr3",portQName.getLocalPart()));
}
}
@@ -1263,7 +1227,7 @@
} else {
if (implOrSEIClass != null) {
serviceModeAnnotation =
- (ServiceMode)implOrSEIClass.getAnnotation(ServiceMode.class);
+ (ServiceMode)getAnnotation(implOrSEIClass,ServiceMode.class);
}
}
}
@@ -1298,7 +1262,7 @@
} else {
if (implOrSEIClass != null) {
bindingTypeAnnotation =
- (BindingType)implOrSEIClass.getAnnotation(BindingType.class);
+ (BindingType)getAnnotation(implOrSEIClass,BindingType.class);
}
}
}
@@ -1343,12 +1307,8 @@
if (handlerChainAnnotation != null) {
String handlerFileName = handlerChainAnnotation.file();
- // TODO RAS & NLS
if (log.isDebugEnabled()) {
- log.debug("EndpointDescriptionImpl.getHandlerChain: fileName: "
- + handlerFileName
- + " className: "
- + composite.getClassName());
+ log.debug(Messages.getMessage("handlerChainsTypeErr",handlerFileName,composite.getClassName()));
}
String className = getServiceDescriptionImpl().isDBCMap() ?
@@ -1365,9 +1325,18 @@
if(is == null) {
log.warn("Unable to load handlers from file: " + handlerFileName);
} else {
- handlerChainsType = DescriptionUtils.loadHandlerChains(is);
+ handlerChainsType =
+ DescriptionUtils.loadHandlerChains(is, this.getClass().getClassLoader());
}
}
+ else if(handlerChainSource != null) {
+
+ if(log.isDebugEnabled()) {
+ log.debug("Loading handlers from provided source");
+ }
+ handlerChainsType = DescriptionUtils.loadHandlerChains(handlerChainSource,
+ this.getClass().getClassLoader());
+ }
}
return handlerChainsType;
}
@@ -1397,13 +1366,13 @@
if (seic != null) {
handlerChainAnnotation = seic.getHandlerChainAnnot();
}
- // TODO else clause for if to throw exception when seic == null
+ //TODO else clause for if to throw exception when seic == null
}
}
} else {
if (implOrSEIClass != null) {
handlerChainAnnotation =
- (HandlerChain)implOrSEIClass.getAnnotation(HandlerChain.class);
+ (HandlerChain)getAnnotation(implOrSEIClass,HandlerChain.class);
}
}
}
@@ -1750,8 +1719,7 @@
WSDL4JWrapper wsdl4jWrapper = new WSDL4JWrapper(dbc.getWsdlURL(), wsdlDef);
getServiceDescriptionImpl().setGeneratedWsdlWrapper(wsdl4jWrapper);
} catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(
- "EndpointDescriptionImpl: WSDLException thrown when attempting to instantiate WSDL4JWrapper ");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("generateWSDLErr"),e);
}
} else {
// REVIEW:Determine if we should always throw an exception on this, or at this point
@@ -1834,6 +1802,20 @@
return string.toString();
}
return string.toString();
+ }
+
+ /**
+ * Get an annotation. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotation(final Class cls, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return cls.getAnnotation(annotation);
+ }
+ });
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Sat Dec 1 06:43:28 2007
@@ -24,6 +24,7 @@
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisOperationFactory;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
@@ -34,6 +35,7 @@
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -43,8 +45,11 @@
import javax.wsdl.Definition;
import javax.wsdl.PortType;
import javax.xml.namespace.QName;
+
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -163,12 +168,7 @@
genericProviderAxisOp =
AxisOperationFactory.getOperationDescription(WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT);
} catch (AxisFault e) {
- if (log.isDebugEnabled()) {
- log.debug("Unable to build AxisOperation for generic Provider; caught exception.", e);
- }
- // TODO: NLS & RAS
- throw ExceptionFactory.makeWebServiceException("Caught exception trying to create AxisOperation",
- e);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("eiDescrImplErr"),e);
}
genericProviderAxisOp.setName(new QName(JAXWS_NOWSDL_PROVIDER_OPERATION_NAME));
@@ -282,8 +282,7 @@
methodList.add(method);
if (!Modifier.isPublic(method.getModifiers())) {
// JSR-181 says methods must be public (p14)
- // TODO NLS
- throw ExceptionFactory.makeWebServiceException("SEI methods must be public");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("seiMethodsErr"));
}
// TODO: other validation per JSR-181
}
@@ -302,9 +301,7 @@
*/
void updateWithSEI(Class sei) {
if (seiClass != null && seiClass != sei)
- // TODO: It probably is invalid to try reset the SEI; but this isn't the right error processing
- throw new UnsupportedOperationException(
- "The seiClass is already set; reseting it is not supported");
+ throw ExceptionFactory.makeWebServiceException(new UnsupportedOperationException(Messages.getMessage("seiProcessingErr")));
else if (seiClass != null && seiClass == sei)
// We've already done the necessary updates for this SEI
return;
@@ -555,7 +552,8 @@
soapBindingAnnotation = dbc.getSoapBindingAnnot();
} else {
if (seiClass != null) {
- soapBindingAnnotation = (SOAPBinding)seiClass.getAnnotation(SOAPBinding.class);
+ soapBindingAnnotation =
+ (SOAPBinding)getAnnotation(seiClass,SOAPBinding.class);
}
}
}
@@ -664,8 +662,7 @@
//Verify that we can find the SEI in the composite list
if (superDBC == null) {
- throw ExceptionFactory.makeWebServiceException(
- "EndpointInterfaceDescriptionImpl: cannot find super class that was specified for this class");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("seiNotFoundErr"));
}
//If the superclass contains a WebService annotation then retrieve its methods
@@ -927,7 +924,7 @@
webServiceAnnotation = dbc.getWebServiceAnnot();
} else {
if (seiClass != null) {
- webServiceAnnotation = (WebService)seiClass.getAnnotation(WebService.class);
+ webServiceAnnotation = (WebService)getAnnotation(seiClass,WebService.class);
}
}
}
@@ -1020,5 +1017,17 @@
}
return string.toString();
}
-
+ /**
+ * Get an annotation. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotation(final Class cls, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return cls.getAnnotation(annotation);
+ }
+ });
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Sat Dec 1 06:43:28 2007
@@ -28,6 +28,7 @@
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.AttachmentDescription;
import org.apache.axis2.jaxws.description.AttachmentType;
@@ -45,6 +46,7 @@
import org.apache.axis2.jaxws.description.builder.OneWayAnnot;
import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.converter.ConverterUtils;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
@@ -72,10 +74,12 @@
import java.io.File;
import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URL;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -264,13 +268,7 @@
// ROBUST_IN_ONLY
// Determine how these MEP's should be handled, if at all
} catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("Unable to build AxisOperation for OperationDescrition; caught exception.",
- e);
- }
- // TODO: NLS & RAS
- throw ExceptionFactory.makeWebServiceException("Caught exception trying to create AxisOperation",
- e);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("clientAxisOprErr"),e);
}
newAxisOperation.setName(determineOperationQName(seiMethod));
@@ -379,14 +377,7 @@
// ROBUST_IN_ONLY
// Determine how these MEP's should be handled, if at all
} catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug(
- "Unable to build AxisOperation for OperationDescrition; caught exception.",
- e);
- }
- // TODO: NLS & RAS
- throw ExceptionFactory
- .makeWebServiceException("Caught exception trying to create AxisOperation", e);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("clientAxisOprErr"), e);
}
newAxisOperation.setName(determineOperationQName(this.methodComposite));
@@ -499,17 +490,11 @@
+ elementName + "; partTNS: " + partNamespace);
}
if (axisMessage == null) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException(
- "Could not setup Doc/Lit/Bare operation because input message is null");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createAxisOprErr1"));
} else if (DescriptionUtils.isEmpty(partNamespace)) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException(
- "Could not setup Doc/Lit/Bare operation because part namespace is empty");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createAxisOprErr2"));
} else if (DescriptionUtils.isEmpty(elementName)) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException(
- "Could not setup Doc/Lit/Bare operation because name is empty");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("createAxisOprErr3"));
} else {
QName partQName = new QName(partNamespace, elementName);
if(log.isDebugEnabled()) {
@@ -565,12 +550,12 @@
void setSEIMethod(Method method) {
if (seiMethod != null) {
- // TODO: This is probably an error, but error processing logic is incorrect
- throw new UnsupportedOperationException(
- "Can not set an SEI method once it has been set.");
+ throw ExceptionFactory.makeWebServiceException(
+ new UnsupportedOperationException(Messages.getMessage("seiMethodErr")));
} else {
seiMethod = method;
- webMethodAnnotation = seiMethod.getAnnotation(WebMethod.class);
+ webMethodAnnotation = (WebMethod)
+ getAnnotation(seiMethod, WebMethod.class);
parameterDescriptions = createParameterDescriptions();
faultDescriptions = createFaultDescriptions();
}
@@ -792,7 +777,7 @@
return null;
}
- WebMethod wmAnnotation = javaMethod.getAnnotation(WebMethod.class);
+ WebMethod wmAnnotation = (WebMethod) getAnnotation(javaMethod,WebMethod.class);
// Per JSR-181 MR Sec 4.2 "Annotation: javax.jws.WebMethod" pg 17,
// if @WebMethod specifies and operation name, use that. Otherwise
// default is the Java method name
@@ -925,7 +910,8 @@
public RequestWrapper getAnnoRequestWrapper() {
if (requestWrapperAnnotation == null) {
if (!isDBC() && seiMethod != null) {
- requestWrapperAnnotation = seiMethod.getAnnotation(RequestWrapper.class);
+ requestWrapperAnnotation = (RequestWrapper)
+ getAnnotation(seiMethod,RequestWrapper.class);
} else if (isDBC() && methodComposite != null) {
requestWrapperAnnotation = methodComposite.getRequestWrapperAnnot();
} else {
@@ -1031,7 +1017,8 @@
public ResponseWrapper getAnnoResponseWrapper() {
if (responseWrapperAnnotation == null) {
if (!isDBC() && seiMethod != null) {
- responseWrapperAnnotation = seiMethod.getAnnotation(ResponseWrapper.class);
+ responseWrapperAnnotation = (ResponseWrapper)
+ getAnnotation(seiMethod,ResponseWrapper.class);
} else if (isDBC() && methodComposite != null) {
responseWrapperAnnotation = methodComposite.getResponseWrapperAnnot();
} else {
@@ -1257,7 +1244,8 @@
public WebResult getAnnoWebResult() {
if (webResultAnnotation == null) {
if (!isDBC() && seiMethod != null) {
- webResultAnnotation = seiMethod.getAnnotation(WebResult.class);
+ webResultAnnotation = (WebResult)
+ getAnnotation(seiMethod,WebResult.class);
} else if (methodComposite != null) {
webResultAnnotation = methodComposite.getWebResultAnnot();
} else {
@@ -1399,7 +1387,8 @@
// JSR-181 Sec 4.7 p. 28
if (soapBindingAnnotation == null) {
if (!isDBC() && seiMethod != null) {
- soapBindingAnnotation = seiMethod.getAnnotation(SOAPBinding.class);
+ soapBindingAnnotation = (SOAPBinding)
+ getAnnotation(seiMethod,SOAPBinding.class);
} else if (isDBC() && methodComposite != null) {
soapBindingAnnotation = methodComposite.getSoapBindingAnnot();
} else {
@@ -1477,7 +1466,7 @@
onewayAnnotation = OneWayAnnot.createOneWayAnnotImpl();
}
} else if (!isDBC() && seiMethod != null) {
- onewayAnnotation = seiMethod.getAnnotation(Oneway.class);
+ onewayAnnotation = (Oneway) getAnnotation(seiMethod,Oneway.class);
} else {
if (log.isDebugEnabled()) {
log.debug("Unable to get OneWay annotation");
@@ -1593,8 +1582,7 @@
// And this method is only used to parse out the JAX-WS Async parameter types to find
// AsyncHandler<T>. The problem with the code that was removed is that a Type can not be
// instantiated, so we can't new up a Type inside the PDC.
- throw new UnsupportedOperationException(
- "OperationDescriptionImpl.getParameterActualGenericType not supported for DBC");
+ throw ExceptionFactory.makeWebServiceException(new UnsupportedOperationException(Messages.getMessage("genParamTypesErr")));
// Type [] type = new Type[parameterDescriptions.length];
// for (int i=0; i < parameterDescriptions.length; i++){
// type[i] = ((ParameterDescriptionImpl) parameterDescriptions[i]).getParameterActualGenericType();
@@ -2129,10 +2117,21 @@
try {
theAxisOperation.addParameter(headerQNParameter);
} catch (AxisFault e) {
- // TODO: RAS
- log.warn("Unable to add Parameter for header QNames to AxisOperation " + theAxisOperation, e);
+ log.warn(Messages.getMessage("regMUHeadersErr",theAxisOperation.getClass().getName()), e);
}
}
}
-
+ /**
+ * Get an annotation. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotation(final AnnotatedElement element, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return element.getAnnotation(annotation);
+ }
+ });
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org