You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ba...@apache.org on 2011/04/25 20:45:30 UTC
svn commit: r1096557 - in
/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws:
Constants.java server/endpoint/EndpointImpl.java
Author: barrettj
Date: Mon Apr 25 18:45:30 2011
New Revision: 1096557
URL: http://svn.apache.org/viewvc?rev=1096557&view=rev
Log:
Two changes in JAX-WS Endpoint implementation (1) Override setEndpointContext method, (2) Add logic to throw an exception if endpoint publishing is disabled by a property (publishing is enabled by default); per JSR-109 5.3.3 dynamically publishing endpoints in a server environment is non portable and should be disabled. A server runtime can use the property to disabled dynamically publishing JAX-WS endpoints via Endpoint.publish methods.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java?rev=1096557&r1=1096556&r2=1096557&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/Constants.java Mon Apr 25 18:45:30 2011
@@ -250,4 +250,21 @@ public interface Constants {
* called with that empty message. Setting this property to "true" will revert to this behavior.
*/
public static final String DISABLE_SOAPFAULT_FOR_LOCAL_EXCEPTION = "jaxws.soapfault.local.exceptions.disable";
+
+ /**
+ * Context Property:
+ * Name: jaxws.endpoint.publish.disable
+ * Value: String "false" or "true"
+ * Default: null, which is interpreted as "false"
+ * Can be set on:
+ * - Axis Configuration, which affects all jax-ws endpoints
+ *
+ * Indicates if the javax.xml.ws.Endpoint.publish methods should be disabled, throwing an exception if
+ * they are called. This may be necessary in a managed environment, since as noted in JSR-109 section
+ * 5.3.3 "Publishing Endpoints" using publish is non-portable in managed environments, and managed
+ * environments may disallow publishing of endpoints dynamciall.
+ *
+ * If this property is set, the Endpoint.publish methods will throw an UnsupportedOperationException.
+ */
+ public static final String DISABLE_ENDPOINT_PUBLISH_METHODS = "jaxws.endpoint.publish.disable";
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java?rev=1096557&r1=1096556&r2=1096557&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java Mon Apr 25 18:45:30 2011
@@ -22,6 +22,8 @@ package org.apache.axis2.jaxws.server.en
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.addressing.util.EndpointReferenceUtils;
import org.apache.axis2.jaxws.binding.BindingUtils;
@@ -38,6 +40,7 @@ import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.ws.Binding;
import javax.xml.ws.EndpointReference;
+import javax.xml.ws.EndpointContext;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import java.io.IOException;
@@ -57,6 +60,7 @@ public class EndpointImpl extends javax.
private List<Source> metadata;
private Map<String, Object> properties;
private Executor executor;
+ private EndpointContext endpointCntx;
public EndpointImpl(Object o) {
implementor = o;
@@ -147,6 +151,14 @@ public class EndpointImpl extends javax.
/*
* (non-Javadoc)
+ * @see javax.xml.ws.Endpoint#setEndpointContext(javax.xml.ws.EndpointContext)
+ */
+ public void setEndpointContext(EndpointContext ctxt) {
+ this.endpointCntx = ctxt;
+ }
+
+ /*
+ * (non-Javadoc)
* @see javax.xml.ws.Endpoint#isPublished()
*/
public boolean isPublished() {
@@ -158,7 +170,39 @@ public class EndpointImpl extends javax.
* @see javax.xml.ws.Endpoint#publish(java.lang.Object)
*/
public void publish(Object obj) {
+ if (isPublishDisabled()) {
+ throw new UnsupportedOperationException("Endpoint publish not allowed in managed environment");
+ }
+
+ }
+ /**
+ * Answer if the Endpoint.publish methods have been disabled. Per JSR-109 Section 5.3.3, the use of
+ * Endpoint.publish in a managed environment is non portable, and a managed environment may choose
+ * to disable dynamic publishing of endpoints. The default is that publishing is NOT disabled, unless
+ * the property is set to true.
+ * @return true if publishing of enpdoints is disabled, false otherwise. False is the default.
+ */
+ private boolean isPublishDisabled() {
+ boolean publishDisabled = false;
+ if (endpointDesc != null) {
+ ConfigurationContext cfgCtx = endpointDesc.getServiceDescription().getAxisConfigContext();
+ AxisConfiguration axisConfig = cfgCtx.getAxisConfiguration();
+ Parameter parameter = axisConfig.getParameter(org.apache.axis2.jaxws.Constants.DISABLE_ENDPOINT_PUBLISH_METHODS);
+ String flagValue = null;
+ if (parameter != null) {
+ flagValue = (String) parameter.getValue();
+ }
+
+ if (flagValue != null) {
+ if ("false".equalsIgnoreCase(flagValue)) {
+ publishDisabled = false;
+ } else if ("true".equalsIgnoreCase(flagValue)) {
+ publishDisabled = true;
+ }
+ }
+ }
+ return publishDisabled;
}
/*
@@ -166,6 +210,9 @@ public class EndpointImpl extends javax.
* @see javax.xml.ws.Endpoint#publish(java.lang.String)
*/
public void publish(String s) {
+ if (isPublishDisabled()) {
+ throw new UnsupportedOperationException("Endpoint publish not allowed in managed environment");
+ }
int port = -1;
String address = s;
try {