use of org.eclipse.wst.server.core.ServerPort in project webtools.servertools by eclipse.
the class Tomcat80Configuration method getServerPorts.
/**
* Returns a list of ServerPorts that this configuration uses.
*
* @return java.util.List
*/
public List getServerPorts() {
List<ServerPort> ports = new ArrayList<ServerPort>();
// first add server port
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
} catch (Exception e) {
// ignore
}
// add connectors
try {
String instanceServiceName = serverInstance.getService().getName();
int size = server.getServiceCount();
for (int i = 0; i < size; i++) {
Service service = server.getService(i);
int size2 = service.getConnectorCount();
for (int j = 0; j < size2; j++) {
Connector connector = service.getConnector(j);
String name = "HTTP/1.1";
String protocol2 = "HTTP";
boolean advanced = true;
String[] contentTypes = null;
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
} catch (Exception e) {
// ignore
}
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
if (protocol.startsWith("HTTP")) {
name = protocol;
} else if (protocol.startsWith("AJP")) {
name = protocol;
protocol2 = "AJP";
} else {
// Get Tomcat equivalent name if protocol handler class specified
name = protocolHandlerMap.get(protocol);
if (name != null) {
// Prepare simple protocol string for ServerPort protocol
int index = name.indexOf('/');
if (index > 0)
protocol2 = name.substring(0, index);
else
protocol2 = name;
} else // Specified protocol is unknown, just use as is
{
name = protocol;
protocol2 = protocol;
}
}
}
if (protocol2.toLowerCase().equals("http"))
contentTypes = new String[] { "web", "webservices" };
String secure = connector.getSecure();
if (secure != null && secure.length() > 0) {
name = "SSL";
protocol2 = "SSL";
} else
advanced = false;
String portId;
if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
portId = Integer.toString(j);
else
portId = i + "/" + j;
ports.add(new ServerPort(portId, name, port, protocol2, contentTypes, advanced));
}
}
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error getting server ports", e);
}
return ports;
}
use of org.eclipse.wst.server.core.ServerPort in project webtools.servertools by eclipse.
the class Tomcat90Configuration method getServerPorts.
/**
* Returns a list of ServerPorts that this configuration uses.
*
* @return java.util.List
*/
public List getServerPorts() {
List<ServerPort> ports = new ArrayList<ServerPort>();
// first add server port
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
} catch (Exception e) {
// ignore
}
// add connectors
try {
String instanceServiceName = serverInstance.getService().getName();
int size = server.getServiceCount();
for (int i = 0; i < size; i++) {
Service service = server.getService(i);
int size2 = service.getConnectorCount();
for (int j = 0; j < size2; j++) {
Connector connector = service.getConnector(j);
String name = "HTTP/1.1";
String protocol2 = "HTTP";
boolean advanced = true;
String[] contentTypes = null;
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
} catch (Exception e) {
// ignore
}
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
if (protocol.startsWith("HTTP")) {
name = protocol;
} else if (protocol.startsWith("AJP")) {
name = protocol;
protocol2 = "AJP";
} else {
// Get Tomcat equivalent name if protocol handler class specified
name = protocolHandlerMap.get(protocol);
if (name != null) {
// Prepare simple protocol string for ServerPort protocol
int index = name.indexOf('/');
if (index > 0)
protocol2 = name.substring(0, index);
else
protocol2 = name;
} else // Specified protocol is unknown, just use as is
{
name = protocol;
protocol2 = protocol;
}
}
}
if (protocol2.toLowerCase().equals("http"))
contentTypes = new String[] { "web", "webservices" };
String secure = connector.getSecure();
if (secure != null && secure.length() > 0) {
name = "SSL";
protocol2 = "SSL";
} else
advanced = false;
String portId;
if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
portId = Integer.toString(j);
else
portId = i + "/" + j;
ports.add(new ServerPort(portId, name, port, protocol2, contentTypes, advanced));
}
}
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error getting server ports", e);
}
return ports;
}
use of org.eclipse.wst.server.core.ServerPort in project webtools.servertools by eclipse.
the class Tomcat40Configuration method getServerPorts.
/**
* Returns a list of ServerPorts that this configuration uses.
*
* @return java.util.List
*/
public List getServerPorts() {
List<ServerPort> ports = new ArrayList<ServerPort>();
// first add server port
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
} catch (Exception e) {
// ignore
}
// add connectors
try {
String instanceServiceName = serverInstance.getService().getName();
int size = server.getServiceCount();
for (int i = 0; i < size; i++) {
Service service = server.getService(i);
int size2 = service.getConnectorCount();
for (int j = 0; j < size2; j++) {
Connector connector = service.getConnector(j);
String className = connector.getClassName();
String name = Messages.portUnknown;
String protocol = "TCPIP";
boolean advanced = true;
String[] contentTypes = null;
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
} catch (Exception e) {
// ignore
}
if (HTTP_CONNECTOR.equals(className)) {
name = "HTTP Connector";
protocol = "HTTP";
contentTypes = new String[] { "web", "webservices" };
// check for SSL connector
try {
Element element = connector.getSubElement("Factory");
if (SSL_SOCKET_FACTORY.equals(element.getAttribute("className"))) {
name = "SSL Connector";
protocol = "SSL";
}
} catch (Exception e) {
// ignore
}
if ("HTTP".equals(protocol))
advanced = false;
} else if (AJP_CONNECTOR.equals(className))
name = "AJP Connector";
else if (WARP_CONNECTOR.equals(className))
name = "Warp Connector";
String portId;
if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
portId = Integer.toString(j);
else
portId = i + "/" + j;
if (className != null && className.length() > 0)
ports.add(new ServerPort(portId, name, port, protocol, contentTypes, advanced));
}
}
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error getting server ports", e);
}
return ports;
}
use of org.eclipse.wst.server.core.ServerPort in project webtools.servertools by eclipse.
the class PreviewServer method getServerPorts.
public ServerPort[] getServerPorts() {
int port = getPort();
ServerPort[] ports = { new ServerPort("http", Messages.httpPort, port, "http") };
return ports;
}
use of org.eclipse.wst.server.core.ServerPort in project webtools.servertools by eclipse.
the class HttpServer method getServerPorts.
public ServerPort[] getServerPorts() {
int port = getPort();
ServerPort[] ports = { new ServerPort("http", Messages.httpPort, port, "http") };
return ports;
}
Aggregations