use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class GrizzlyConfig method setupNetwork.
public void setupNetwork() throws IOException {
validateConfig(config);
synchronized (listeners) {
for (final NetworkListener listener : config.getNetworkListeners().getNetworkListener()) {
final GenericGrizzlyListener grizzlyListener = new GenericGrizzlyListener();
grizzlyListener.configure(serviceLocator, listener);
listeners.add(grizzlyListener);
try {
grizzlyListener.start();
} catch (IOException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
}
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class SSLConfigurator method logEmptyWarning.
protected void logEmptyWarning(Ssl ssl, final String msg) {
final StringBuilder name = new StringBuilder();
for (NetworkListener listener : ((Protocol) ssl.getParent()).findNetworkListeners()) {
if (name.length() != 0) {
name.append(", ");
}
name.append(listener.getName());
}
LOGGER.log(Level.FINE, msg, name.toString());
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class SecureAdminConfigUpgrade method prepareDASConfig.
private void prepareDASConfig() throws TransactionFailure, PropertyVetoException {
final Config dasConfig = writableConfig(configs.getConfigByName(DAS_CONFIG_NAME));
final NetworkConfig nc = dasConfig.getNetworkConfig();
final NetworkListener nl_w = transaction().enroll(nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME));
nl_w.setProtocol(SecureAdminCommand.ADMIN_LISTENER_NAME);
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class GrizzlyConfigTest method references.
@Test
public void references() throws IOException {
GrizzlyConfig grizzlyConfig = null;
try {
grizzlyConfig = new GrizzlyConfig("grizzly-config.xml");
final List<NetworkListener> list = grizzlyConfig.getConfig().getNetworkListeners().getNetworkListener();
final NetworkListener listener = list.get(0);
boolean found = false;
for (NetworkListener ref : listener.findProtocol().findNetworkListeners()) {
found |= ref.getName().equals(listener.getName());
}
assertTrue("Should find the NetworkListener in the list of references from Protocol", found);
found = false;
for (NetworkListener ref : listener.findTransport().findNetworkListeners()) {
found |= ref.getName().equals(listener.getName());
}
assertTrue("Should find the NetworkListener in the list of references from Transport", found);
found = false;
for (NetworkListener ref : listener.findThreadPool().findNetworkListeners()) {
found |= ref.getName().equals(listener.getName());
}
assertTrue("Should find the NetworkListener in the list of references from ThreadPool", found);
} finally {
if (grizzlyConfig != null) {
grizzlyConfig.shutdown();
}
}
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class MetroContainer method getHttpPort.
/**
* Get the http/https port number for the default virtual server of this server instance.
* <p/>
* If the 'secure' parameter is true, then return the secure http listener port, otherwise
* return the non-secure http listener port.
*
* @param secure true if you want the secure port, false if you want the non-secure port
* @return the port or null if there was an error retrieving it.
*/
private String getHttpPort(boolean secure, String serverName, Config config) {
try {
final String networkListeners = config.getHttpService().getVirtualServerByName(serverName).getNetworkListeners();
if (networkListeners == null || networkListeners.isEmpty()) {
return null;
}
final String[] networkListenerNames = networkListeners.split(",");
for (String listenerName : networkListenerNames) {
if (listenerName == null || listenerName.isEmpty()) {
continue;
}
NetworkListener listener = config.getNetworkConfig().getNetworkListener(listenerName.trim());
if (secure == Boolean.valueOf(listener.findHttpProtocol().getSecurityEnabled())) {
return listener.getPort();
}
}
} catch (Throwable t) {
// error condition handled in wsit code
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, LogUtils.WSTX_SERVICE_PORT_CONFIGURATION_EXCEPTION, t);
}
}
return null;
}
Aggregations