Author: asoldano
Date: 2014-02-26 11:57:45 -0500 (Wed, 26 Feb 2014)
New Revision: 18440
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/resources/jaxws/endpoint/META-INF/permissions.xml
Log:
[JBWS-3702] Adding START_UNDERTOW_SERVER_ENGINE permission
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java 2014-02-26
12:18:09 UTC (rev 18439)
+++
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java 2014-02-26
16:57:45 UTC (rev 18440)
@@ -32,10 +32,9 @@
/**
- * Factory for HttpServerDestination
+ * Factory for UndertowServerDestination
*
* @author alessio.soldano(a)jboss.com
- * @since 22-Apr-2011
*
*/
@NoJSR250Annotations()
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java 2014-02-26
12:18:09 UTC (rev 18439)
+++
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java 2014-02-26
16:57:45 UTC (rev 18440)
@@ -21,7 +21,11 @@
*/
package org.jboss.wsf.stack.cxf.addons.transports.undertow;
+import io.undertow.server.HttpHandler;
+
import java.net.InetSocketAddress;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -29,18 +33,17 @@
import org.apache.cxf.common.logging.LogUtils;
import org.jboss.ws.undertow_httpspi.PathUtils;
import org.jboss.ws.undertow_httpspi.UndertowServer;
-import io.undertow.server.HttpHandler;
/**
- * A server engine that internally uses the JDK6 httpserver
+ * A server engine that internally uses Undertow
*
* @author alessio.soldano(a)jboss.com
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
- * @since 19-Aug-2010
*
*/
public class UndertowServerEngine
{
+ private static final RuntimePermission START_UNDERTOW_SERVER_ENGINE = new
RuntimePermission("org.jboss.ws.START_UNDERTOW_SERVER_ENGINE");
private static final Logger LOG = LogUtils.getL7dLogger(UndertowServerEngine.class);
private Bus bus;
private UndertowServerEngineFactory factory;
@@ -86,7 +89,18 @@
server = new UndertowServer(isa.getPort(), isa.getHostName());
server.getPathHandler().addExactPath(PathUtils.getContextPath(address) +
PathUtils.getPath(address), handler);
- server.start();
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ server.start();
+ } else {
+ sm.checkPermission(START_UNDERTOW_SERVER_ENGINE);
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ server.start();
+ return null;
+ }
+ });
+ }
}
server.getPathHandler().addExactPath(PathUtils.getContextPath(address) +
PathUtils.getPath(address), handler);
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/resources/jaxws/endpoint/META-INF/permissions.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/resources/jaxws/endpoint/META-INF/permissions.xml 2014-02-26
12:18:09 UTC (rev 18439)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/resources/jaxws/endpoint/META-INF/permissions.xml 2014-02-26
16:57:45 UTC (rev 18440)
@@ -13,6 +13,10 @@
<name>publishEndpoint</name>
</permission>
<permission>
+ <class-name>java.lang.RuntimePermission</class-name>
+ <name>org.jboss.ws.START_UNDERTOW_SERVER_ENGINE</name>
+ </permission>
+ <permission>
<class-name>java.net.SocketPermission</class-name>
<name>*</name>
<actions>accept,connect,listen,resolve</actions>