Author: jim.ma
Date: 2011-08-10 01:17:41 -0400 (Wed, 10 Aug 2011)
New Revision: 14798
Modified:
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties
Log:
[JBWS-3332]:Get port value from WebServerInfo if it is failed from JMX
Modified:
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2011-08-09
22:56:55 UTC (rev 14797)
+++
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2011-08-10
05:17:41 UTC (rev 14798)
@@ -39,10 +39,13 @@
import org.jboss.ws.common.ObjectNameFactory;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.StackConfig;
import org.jboss.wsf.spi.management.StackConfigFactory;
+import org.jboss.wsf.spi.management.WebServerInfo;
+import org.jboss.wsf.spi.management.WebServerInfoFactory;
import org.jboss.wsf.spi.metadata.config.EndpointConfig;
/**
@@ -153,11 +156,25 @@
webServicePort = getConnectorPort("HTTP/1.1", false);
int localPort = webServicePort;
- if (localPort <= 0)
+ if (localPort <= 0)
{
- // Do not initialize webServicePort with the default, the connector port may
become available later
- log.debug("Unable to calculate 'WebServicePort', using default
'8080'");
- localPort = 8080;
+ ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ try
+ {
+ WebServerInfo webServerInfo = spiProvider.getSPI(WebServerInfoFactory.class,
cl).newWebServerInfo();
+ localPort = webServerInfo.getPort("HTTP/1.1", false);
+ }
+ catch (WSFException e)
+ {
+ log.warn(BundleUtils.getMessage(bundle,
"COULD_NOT_GET_WEBSERVERINFO"), e);
+ }
+ if (localPort <= 0)
+ {
+ // Do not initialize webServicePort with the default, the connector port may
become available later
+ log.debug("Unable to calculate 'WebServicePort', using default
'8080'");
+ localPort = 8080;
+ }
}
return localPort;
@@ -171,9 +188,25 @@
int localPort = webServiceSecurePort;
if (localPort <= 0)
{
- // Do not initialize webServiceSecurePort with the default, the connector port
may become available later
- log.debug("Unable to calculate 'WebServiceSecurePort', using
default '8443'");
- localPort = 8443;
+ ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ try
+ {
+ WebServerInfo webServerInfo = spiProvider.getSPI(WebServerInfoFactory.class,
cl).newWebServerInfo();
+
+ localPort = webServerInfo.getPort("HTTP/1.1", true);
+ }
+ catch (WSFException e)
+ {
+ log.warn(BundleUtils.getMessage(bundle,
"COULD_NOT_GET_WEBSERVERINFO"), e);
+ }
+
+ if (localPort <= 0)
+ {
+ // Do not initialize webServiceSecurePort with the default, the connector
port may become available later
+ log.debug("Unable to calculate 'WebServiceSecurePort', using
default '8443'");
+ localPort = 8443;
+ }
}
return localPort;
@@ -259,4 +292,4 @@
{
return this.endpointConfigs;
}
-}
+}
\ No newline at end of file
Modified: common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties 2011-08-09
22:56:55 UTC (rev 14797)
+++
common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties 2011-08-10
05:17:41 UTC (rev 14798)
@@ -12,3 +12,4 @@
ENDPOINT_NAME_CANNOT_BE_NULL_FOR=Endpoint name cannot be null for: {0}
ENDPOINT_ALREADY_REGISTERED=Endpoint already registered: {0}
ENDPOINT_NOT_REGISTERED=Endpoint not registered: {0}
+COULD_NOT_GET_WEBSERVERINFO=Can not get WebServerInfo from SPIProvider