summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java6
-rw-r--r--sca-java-2.x/contrib/modules/binding-websocket/src/main/resources/binding-websocket.xsd2
2 files changed, 6 insertions, 2 deletions
diff --git a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
index 7f89a523c3..e5c729dd8c 100644
--- a/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
+++ b/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
@@ -31,6 +31,7 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class WebsocketServiceBindingProvider implements ServiceBindingProvider {
+ private static final int DEFAULT_PORT = 9000;
private static final String JAVASCRIPT_RESOURCE_PATH = "/org.apache.tuscany.sca.WebsocketComponentContext.js";
private static Map<Integer, WebSocketServer> servers = new HashMap<Integer, WebSocketServer>();
private RuntimeEndpoint endpoint;
@@ -43,7 +44,10 @@ public class WebsocketServiceBindingProvider implements ServiceBindingProvider {
public void start() {
WebsocketBinding binding = (WebsocketBinding) endpoint.getBinding();
- int port = Integer.parseInt(binding.getPort());
+ int port = DEFAULT_PORT;
+ if (binding.getPort() != null) {
+ port = Integer.parseInt(binding.getPort());
+ }
try {
WebSocketServer server = initServerForURI(port);
String component = endpoint.getComponent().getName();
diff --git a/sca-java-2.x/contrib/modules/binding-websocket/src/main/resources/binding-websocket.xsd b/sca-java-2.x/contrib/modules/binding-websocket/src/main/resources/binding-websocket.xsd
index 2617865c13..8ed0011361 100644
--- a/sca-java-2.x/contrib/modules/binding-websocket/src/main/resources/binding-websocket.xsd
+++ b/sca-java-2.x/contrib/modules/binding-websocket/src/main/resources/binding-websocket.xsd
@@ -30,7 +30,7 @@
<complexType name="WebsocketBinding">
<complexContent>
<extension base="sca:Binding">
- <attribute name="port" type="string" use="required"/>
+ <attribute name="port" type="string" use="optional"/>
</extension>
</complexContent>
</complexType>