You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ro...@apache.org on 2007/07/19 01:36:56 UTC
svn commit: r557426 - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/context/utils/ src/org/apache/axis2/jaxws/core/
src/org/apache/axis2/jaxws/core/controller/
src/org/apache/axis2/jaxws/handler/ src/org/apache/axis2/jaxws/...
Author: rott
Date: Wed Jul 18 16:36:55 2007
New Revision: 557426
URL: http://svn.apache.org/viewvc?view=rev&rev=557426
Log:
Followup to 551618, AXIS2-2854. JAXWS no longer needs to
delegate properties up to the axis2 message context Options
object, since axis2 message context also no longer delegates.
Added:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/core/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/core/MessageContextTests.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java Wed Jul 18 16:36:55 2007
@@ -53,14 +53,10 @@
*/
public static void addProperties(SOAPMessageContext soapMessageContext,
MessageContext jaxwsMessageContext) {
- org.apache.axis2.context.MessageContext axisMsgContext =
- jaxwsMessageContext.getAxisMessageContext();
- // Copy Axis2 MessageContext options. It's possible that some set of Axis2 handlers
- // have run and placed some properties in the context that need to be visible.
- // We don't, however, want to expose the Axis2 Operation/ServiceContext properties.
- Map props = axisMsgContext.getOptions().getProperties();
- soapMessageContext.putAll(props);
+ // Copy Axis2 MessageContext properties. It's possible that some set of Axis2 handlers
+ // have run and placed some properties in the context that need to be visible.
+ soapMessageContext.putAll(jaxwsMessageContext.getProperties());
EndpointDescription description = jaxwsMessageContext.getEndpointDescription();
if (description !=null) {
@@ -98,18 +94,19 @@
// If we are running within a servlet container, then JAX-WS requires that the
// servlet related properties be set on the MessageContext
soapMessageContext.put(javax.xml.ws.handler.MessageContext.SERVLET_CONTEXT,
- axisMsgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT));
+ jaxwsMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT));
soapMessageContext
.setScope(javax.xml.ws.handler.MessageContext.SERVLET_CONTEXT, Scope.APPLICATION);
+
if (log.isDebugEnabled()) {
- if (axisMsgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT) != null) {
+ if (jaxwsMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT) != null) {
log.debug("Servlet Context Set");
} else {
log.debug("Servlet Context not found");
}
}
- HttpServletRequest req = (HttpServletRequest)axisMsgContext
+ HttpServletRequest req = (HttpServletRequest)jaxwsMessageContext
.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
if (req == null) {
if (log.isDebugEnabled()) {
@@ -159,7 +156,7 @@
}
}
- HttpServletResponse res = (HttpServletResponse)axisMsgContext
+ HttpServletResponse res = (HttpServletResponse)jaxwsMessageContext
.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
if (res == null) {
if (log.isDebugEnabled()) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java Wed Jul 18 16:36:55 2007
@@ -61,8 +61,8 @@
private boolean isOutbound; // Outbound or inbound message context
// TODO: flag to set whether we delegate property setting up to the
- // axis2 options objecct or keep it local
- private boolean DELEGATE_TO_OPTIONS = true;
+ // axis2 message context object or keep it local
+ private boolean DELEGATE_TO_AXISMC = true;
/*
* JAXWS runtime uses a request and response mc, but we need to know the pair.
@@ -84,7 +84,7 @@
public MessageContext() {
axisMsgCtx = new org.apache.axis2.context.MessageContext();
isOutbound = true;
- if (!DELEGATE_TO_OPTIONS) {
+ if (!DELEGATE_TO_AXISMC) {
properties = new HashMap<String, Object>();
}
@@ -97,7 +97,7 @@
* @throws WebServiceException
*/
public MessageContext(org.apache.axis2.context.MessageContext mc) throws WebServiceException {
- if (!DELEGATE_TO_OPTIONS) {
+ if (!DELEGATE_TO_AXISMC) {
properties = new HashMap<String, Object>();
}
// Assume inbound (caller must setOutbound)
@@ -129,32 +129,61 @@
}
public Map<String, Object> getProperties() {
- if (DELEGATE_TO_OPTIONS) {
- return new ReadOnlyProperties(axisMsgCtx.getOptions().getProperties());
+ if (DELEGATE_TO_AXISMC) {
+ // only use properties that are local to the axis2 MC,
+ // not the options bag. See org.apache.axis2.context.AbstractContext
+ Iterator names = axisMsgCtx.getPropertyNames();
+ HashMap tempProps = new HashMap<String, Object>();
+ for (; names.hasNext();) {
+ String name = (String)names.next();
+ tempProps.put(name, axisMsgCtx.getProperty(name));
+ }
+ //return new ReadOnlyProperties(tempProps);
+ return tempProps;
}
return properties;
}
public void setProperties(Map<String, Object> _properties) {
- if (DELEGATE_TO_OPTIONS) {
- axisMsgCtx.getOptions().setProperties(_properties);
+ if (DELEGATE_TO_AXISMC) {
+ // make sure copy is made, not just reference:
+ _properties.put(org.apache.axis2.context.MessageContext.COPY_PROPERTIES, true);
+ axisMsgCtx.setProperties(_properties);
} else {
getProperties().putAll(_properties);
}
}
public Object getProperty(String key) {
- if (DELEGATE_TO_OPTIONS) {
- return axisMsgCtx.getProperty(key);
+ if (DELEGATE_TO_AXISMC) {
+ // only use properties that are local to the axis2 MC,
+ // not the options bag. See org.apache.axis2.context.AbstractContext
+ Iterator names = axisMsgCtx.getPropertyNames();
+ for (; names.hasNext();) {
+ String name = (String)names.next();
+ if (name.equals(key)) {
+ return axisMsgCtx.getProperty(key);
+ }
+ }
+ return null;
}
return getProperties().get(key);
}
// acts like Map.put(key, value)
public Object setProperty(String key, Object value) {
- if (DELEGATE_TO_OPTIONS) {
- Object retval = axisMsgCtx.getOptions().getProperty(key);
- axisMsgCtx.getOptions().setProperty(key, value);
+ if (DELEGATE_TO_AXISMC) {
+ // only use properties that are local to the axis2 MC,
+ // not the options bag. See org.apache.axis2.context.AbstractContext
+ Object retval = null;
+ Iterator names = axisMsgCtx.getPropertyNames();
+ for (; names.hasNext();) {
+ String name = (String)names.next();
+ if (name.equals(key)) {
+ retval = axisMsgCtx.getProperty(key);
+ }
+ }
+ axisMsgCtx.setProperty(key, value);
return retval;
} else {
return getProperties().put(key, value);
@@ -305,195 +334,5 @@
public void setOutbound(boolean isOutbound) {
this.isOutbound = isOutbound;
}
-
- private class ReadOnlyProperties extends AbstractMap<String, Object> {
-
- private Map<String, Object> containedProps;
-
- public ReadOnlyProperties(Map containedProps) {
- this.containedProps = containedProps;
- }
-
- @Override
- public Set<Entry<String, Object>> entrySet() {
- return new ReadOnlySet(containedProps.entrySet());
- }
-
- @Override
- public Set<String> keySet() {
- return new ReadOnlySet(containedProps.keySet());
- }
-
- @Override
- public Object put(String key, Object value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void putAll(Map<? extends String, ? extends Object> t) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object remove(Object key) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Collection<Object> values() {
- return new ReadOnlyCollection(containedProps.values());
- }
-
- /*
- * nested classes to be used to enforce read-only Collection, Set, and Iterator for MEPContext
- */
-
- class ReadOnlyCollection implements Collection {
-
- private Collection containedCollection;
-
- private ReadOnlyCollection(Collection containedCollection) {
- this.containedCollection = containedCollection;
- }
-
- public boolean add(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean addAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- public boolean contains(Object o) {
- return containedCollection.contains(o);
- }
-
- public boolean containsAll(Collection c) {
- return containedCollection.containsAll(c);
- }
-
- public boolean isEmpty() {
- return containedCollection.isEmpty();
- }
-
- public Iterator iterator() {
- return new ReadOnlyIterator(containedCollection.iterator());
- }
-
- public boolean remove(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean removeAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public int size() {
- return containedCollection.size();
- }
-
- public Object[] toArray() {
- return containedCollection.toArray();
- }
-
- public Object[] toArray(Object[] a) {
- return containedCollection.toArray(a);
- }
-
- }
-
- class ReadOnlyIterator implements Iterator {
-
- private Iterator containedIterator;
-
- private ReadOnlyIterator(Iterator containedIterator) {
- this.containedIterator = containedIterator;
- }
-
- // override remove() to make this Iterator class read-only
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasNext() {
- return containedIterator.hasNext();
- }
-
- public Object next() {
- return containedIterator.next();
- }
- }
-
- class ReadOnlySet implements Set {
-
- private Set containedSet;
-
- private ReadOnlySet(Set containedSet) {
- this.containedSet = containedSet;
- }
-
- public boolean add(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean addAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public void clear() {
- throw new UnsupportedOperationException();
- }
- public boolean contains(Object o) {
- return containedSet.contains(o);
- }
-
- public boolean containsAll(Collection c) {
- return containedSet.containsAll(c);
- }
-
- public boolean isEmpty() {
- return containedSet.isEmpty();
- }
-
- public Iterator iterator() {
- return new ReadOnlyIterator(containedSet.iterator());
- }
-
- public boolean remove(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean removeAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public int size() {
- return containedSet.size();
- }
-
- public Object[] toArray() {
- return containedSet.toArray();
- }
-
- public Object[] toArray(Object[] a) {
- return containedSet.toArray(a);
- }
-
- }
-
- }
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Wed Jul 18 16:36:55 2007
@@ -355,14 +355,6 @@
axisRequestMsgCtx // Axis 2 MessageContext
);
- // For now, just take all of the properties that were in the
- // JAX-WS MessageContext, and set them on the Axis2 MessageContext.
- axisRequestMsgCtx.setProperty(AbstractContext.COPY_PROPERTIES,
- Boolean.TRUE);
- Map props = axisRequestMsgCtx.getOptions().getProperties();
- props.putAll(requestMsgCtx.getProperties());
-
- axisRequestMsgCtx.getOptions().setProperties(props);
if (log.isDebugEnabled()) {
log.debug("Properties: " + axisRequestMsgCtx.getProperties().toString());
}
@@ -385,7 +377,7 @@
private void initOperationClient(OperationClient opClient, MessageContext requestMsgCtx) {
org.apache.axis2.context.MessageContext axisRequest = requestMsgCtx.getAxisMessageContext();
- setupProperties(requestMsgCtx, axisRequest.getOptions());
+ setupProperties(requestMsgCtx);//, axisRequest.getOptions());
Options options = opClient.getOptions();
if (opClient != null) {
@@ -484,23 +476,18 @@
* moved over to when the property is set. This should not be in the path
* of performance.
*/
- private void setupProperties(MessageContext mc, Options ops) {
+ private void setupProperties(MessageContext mc) {//, Options ops) {
Map<String, Object> properties = mc.getProperties();
- for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
- String key = it.next();
- Object value = properties.get(key);
- ops.setProperty(key, value);
- }
// Enable MTOM
Message msg = mc.getMessage();
if (msg.isMTOMEnabled()) {
- ops.setProperty(Configuration.ENABLE_MTOM, "true");
+ mc.setProperty(Configuration.ENABLE_MTOM, "true");
}
// Enable session management
if (mc.isMaintainSession()) {
- ops.setManageSession(true);
+ mc.getAxisMessageContext().getOptions().setManageSession(true);
}
// Check to see if BASIC_AUTH is enabled. If so, make sure
@@ -537,7 +524,7 @@
basicAuthentication.setPort(url.getPort());
basicAuthentication.setPreemptiveAuthentication(true);
- ops.setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
+ mc.setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
} else if ((!properties.containsKey(BindingProvider.USERNAME_PROPERTY) &&
properties.containsKey(BindingProvider.PASSWORD_PROPERTY)) ||
(properties.containsKey(BindingProvider.USERNAME_PROPERTY) &&
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java Wed Jul 18 16:36:55 2007
@@ -111,7 +111,10 @@
if (scopes.get(s) == null) {
// JAX-WS default 9.4.1. However, we try to set the scope for
// every incoming property to HANDLER. If a property is coming from
- // the axis2 Options bag, we want those to be APPLICATION scoped.
+ // the axis2 AbstractContext properties bag, we want those to be
+ // APPLICATION scoped. Those properties may have been set by an
+ // axis application handler, and may need to be accessible by
+ // a client app or endpoint.
return Scope.APPLICATION;
}
return scopes.get(s);
@@ -179,14 +182,14 @@
// TODO should check ApplicationAccessLocked flag
// and return only APPLICATION scoped properties if true
if (isApplicationAccessLocked()) {
- return new ReadOnlySet(getApplicationScopedProperties().entrySet());
+ return getApplicationScopedProperties().entrySet();
}
HashMap tempProps = new HashMap();
tempProps.putAll(requestMC.getProperties());
if (responseMC != null) {
tempProps.putAll(responseMC.getProperties());
}
- return new ReadOnlySet(tempProps.entrySet());
+ return tempProps.entrySet();
}
public Object get(Object keyObject) {
@@ -216,14 +219,14 @@
public Set keySet() {
if (isApplicationAccessLocked()) {
- return new ReadOnlySet(getApplicationScopedProperties().keySet());
+ return getApplicationScopedProperties().keySet();
}
HashMap tempProps = new HashMap();
tempProps.putAll(requestMC.getProperties());
if (responseMC != null) {
tempProps.putAll(responseMC.getProperties());
}
- return new ReadOnlySet(tempProps.keySet());
+ return tempProps.keySet();
}
public Object put(String key, Object value) {
@@ -295,16 +298,16 @@
return tempProps.size();
}
- public ReadOnlyCollection values() {
+ public Collection values() {
if (isApplicationAccessLocked()) {
- return new ReadOnlyCollection(getApplicationScopedProperties().values());
+ return getApplicationScopedProperties().values();
}
HashMap tempProps = new HashMap();
tempProps.putAll(requestMC.getProperties());
if (responseMC != null) {
tempProps.putAll(responseMC.getProperties());
}
- return new ReadOnlyCollection(tempProps.values());
+ return tempProps.values();
}
public Message getMessageObject() {
@@ -368,158 +371,6 @@
}
}
return tempMap;
- }
-
-
- /*
- * nested classes to be used to enforce read-only Collection, Set, and Iterator for MEPContext
- */
-
- class ReadOnlyCollection implements Collection {
-
- private Collection containedCollection;
-
- private ReadOnlyCollection(Collection containedCollection) {
- this.containedCollection = containedCollection;
- }
-
- public boolean add(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean addAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- public boolean contains(Object o) {
- return containedCollection.contains(o);
- }
-
- public boolean containsAll(Collection c) {
- return containedCollection.containsAll(c);
- }
-
- public boolean isEmpty() {
- return containedCollection.isEmpty();
- }
-
- public Iterator iterator() {
- return new ReadOnlyIterator(containedCollection.iterator());
- }
-
- public boolean remove(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean removeAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public int size() {
- return containedCollection.size();
- }
-
- public Object[] toArray() {
- return containedCollection.toArray();
- }
-
- public Object[] toArray(Object[] a) {
- return containedCollection.toArray(a);
- }
-
- }
-
- class ReadOnlyIterator implements Iterator {
-
- private Iterator containedIterator;
-
- private ReadOnlyIterator(Iterator containedIterator) {
- this.containedIterator = containedIterator;
- }
-
- // override remove() to make this Iterator class read-only
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasNext() {
- return containedIterator.hasNext();
- }
-
- public Object next() {
- return containedIterator.next();
- }
- }
-
- class ReadOnlySet implements Set {
-
- private Set containedSet;
-
- private ReadOnlySet(Set containedSet) {
- this.containedSet = containedSet;
- }
-
- public boolean add(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean addAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- public boolean contains(Object o) {
- return containedSet.contains(o);
- }
-
- public boolean containsAll(Collection c) {
- return containedSet.containsAll(c);
- }
-
- public boolean isEmpty() {
- return containedSet.isEmpty();
- }
-
- public Iterator iterator() {
- return new ReadOnlyIterator(containedSet.iterator());
- }
-
- public boolean remove(Object o) {
- throw new UnsupportedOperationException();
- }
-
- public boolean removeAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection c) {
- throw new UnsupportedOperationException();
- }
-
- public int size() {
- return containedSet.size();
- }
-
- public Object[] toArray() {
- return containedSet.toArray();
- }
-
- public Object[] toArray(Object[] a) {
- return containedSet.toArray(a);
- }
-
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java Wed Jul 18 16:36:55 2007
@@ -22,7 +22,6 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.Constants.Configuration;
-import org.apache.axis2.client.Options;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.i18n.Messages;
@@ -598,8 +597,7 @@
if (!isMTOMEnabled()) {
String[] cids = newMap.getAllContentIDs();
if (cids.length > 0) {
- Options opts = messageContext.getAxisMessageContext().getOptions();
- opts.setProperty(Configuration.ENABLE_SWA, "true");
+ messageContext.setProperty(Configuration.ENABLE_SWA, "true");
}
}
if (log.isDebugEnabled()) {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java Wed Jul 18 16:36:55 2007
@@ -34,7 +34,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.Constants.Configuration;
-import org.apache.axis2.client.Options;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.handler.AttachmentsAdapter;
@@ -211,15 +210,13 @@
if (message.isDoingSWA()) {
// Enable SWA on the Axis2 MessageContext
msgContext.setDoingSwA(true);
- Options opts = msgContext.getOptions();
- opts.setProperty(Configuration.ENABLE_SWA, "true");
+ msgContext.setProperty(Configuration.ENABLE_SWA, "true");
}
// Enable MTOM Attachments
if (message.isMTOMEnabled()) {
// Enable MTOM on the Axis2 MessageContext
- Options opts = msgContext.getOptions();
- opts.setProperty(Configuration.ENABLE_MTOM, "true");
+ msgContext.setProperty(Configuration.ENABLE_MTOM, "true");
if (false) {
makeBinaryNodes(message);
}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/core/MessageContextTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/core/MessageContextTests.java?view=auto&rev=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/core/MessageContextTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/core/MessageContextTests.java Wed Jul 18 16:36:55 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.core;
+
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/*
+ * Testing jaxws message context's interation with axis2 message context.
+ * JAXWS delegates all property setting/getting up to axis2, but we need to
+ * be careful how we use axis2's MC. We should not have access to the options
+ * bag in the axis2 MC, for example.
+ */
+
+public class MessageContextTests extends TestCase {
+
+ static final String key1 = "ONaxisMC";
+ static final String key2 = "ONaxisMCOptions";
+ static final String key3 = "ONjaxwsMC";
+
+ /* TODO:
+ * should also test to make sure service or operation context properties
+ * on the axis2 MC are not accessible. That's probably best left for another test.
+ */
+ public void testMessageContextPropertiesAccessibility() throws Exception {
+ org.apache.axis2.context.MessageContext axisMC = new org.apache.axis2.context.MessageContext();
+ MessageContext jaxwsMC = new MessageContext(axisMC);
+ axisMC.setProperty(key1, "value");
+ axisMC.getOptions().setProperty(key2, "value");
+ jaxwsMC.setProperty(key3, "value");
+
+ assertNotNull(jaxwsMC.getProperty(key1));
+ assertNull(jaxwsMC.getProperty(key2));
+ assertNotNull(jaxwsMC.getProperty(key3));
+
+ Map props = jaxwsMC.getProperties();
+
+ assertNotNull(props.get(key1));
+ assertNull(props.get(key2));
+ assertNotNull(props.get(key3));
+ }
+
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Wed Jul 18 16:36:55 2007
@@ -29,6 +29,7 @@
import org.apache.axis2.jaxws.client.DispatchSoapActionTests;
import org.apache.axis2.jaxws.client.PropertyValueTests;
import org.apache.axis2.jaxws.client.ProxySoapActionTests;
+import org.apache.axis2.jaxws.core.MessageContextTests;
import org.apache.axis2.jaxws.databinding.BindingToProtocolTests;
import org.apache.axis2.jaxws.description.AnnotationDescriptionTests;
import org.apache.axis2.jaxws.description.GetDescFromBindingProviderTests;
@@ -124,6 +125,7 @@
suite.addTestSuite(BlockTests.class);
suite.addTestSuite(MessageTests.class);
+ suite.addTestSuite(MessageContextTests.class);
suite.addTestSuite(FaultTests.class);
suite.addTestSuite(SAAJConverterTests.class);
suite.addTestSuite(SOAP12Tests.class);
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Wed Jul 18 16:36:55 2007
@@ -91,7 +91,7 @@
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
int total = proxy.addNumbersHandler(10,10);
-
+
assertEquals("With handler manipulation, total should be 3 less than a proper sumation.", 17, total);
TestLogger.logger.debug("Total (after handler manipulation) = " + total);
TestLogger.logger.debug("----------------------------------");
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java?view=diff&rev=557426&r1=557425&r2=557426
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java Wed Jul 18 16:36:55 2007
@@ -56,7 +56,14 @@
Boolean outbound =
(Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (!outbound) { // inbound response on the client
-
+
+ // make sure standard property is available
+
+ Object bob = messagecontext.get(LogicalMessageContext.HTTP_RESPONSE_CODE);
+ if (bob == null) {
+ throw new NullPointerException("bob is null");
+ }
+
// previously caused a NPE due to internal Properties.putAll(map);
// where 'map' had a key/value pair with null value. So, internally
// we now use HashMap instead of Properties.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org