public MonitorServerPortAction(Shell shell, IServer server, ServerPort port) { super(NLS.bind(Messages.actionMonitorPort, new String[] { port.getPort() + "", port.getName() })); this.shell = shell; this.server = server; this.port = port; IMonitoredServerPort[] msps = ServerMonitorManager.getInstance().getMonitoredPorts(server); if (msps != null) { int size = msps.length; for (int i = 0; i < size; i++) { if (port.equals(msps[i].getServerPort()) && // msps[i].isStarted() && (msps[i].getContentTypes() == null || msps[i].getContentTypes().length == 0 || (port.getContentTypes() != null && msps[i].getContentTypes().length == port.getContentTypes().length))) monitoredPort = msps[i]; } } checked = monitoredPort != null; // && monitoredPort.isStarted(); setChecked(checked); }
/** * Return the port number. * @return int */ public ServerPort getMainPort() { Iterator iterator = getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort port = (ServerPort) iterator.next(); // Return only an HTTP port from the selected Service if (port.getProtocol().toLowerCase().equals("http") && port.getId().indexOf('/') < 0) return port; } return null; }
/** * Return the port number. * @return int */ public ServerPort getMainPort() { Iterator iterator = getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort port = (ServerPort) iterator.next(); // Return only an HTTP port from the selected Service if (port.getName().equals("HTTP Connector") && port.getId().indexOf('/') < 0) return port; } return null; }
if ("HTTP".equals(port.getProtocol())) { httpPort = port.getPort(); if (httpPort==0) {
/** * Execute the command. */ public void execute() { // find old port number Iterator iterator = configuration.getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort temp = (ServerPort) iterator.next(); if (id.equals(temp.getId())) oldPort = temp.getPort(); } // make the change configuration.modifyServerPort(id, port); }
public void selectionChanged(SelectionChangedEvent event) { port = (ServerPort) getSelection(tableViewer.getSelection()); if (port == null) return; if (!portChanged) { portText.setText((port.getPort() + 1) + ""); portChanged = false; } portContentTypes = port.getContentTypes(); String[] s = null; String all = Messages.dialogMonitorContentTypeAll; if (portContentTypes == null || portContentTypes.length == 1) { s = new String[] { all }; } else { int size = portContentTypes.length; s = new String[size+1]; for (int i = 0; i < size; i++) { s[i] = MonitorLabelProvider.getContentTypeString(portContentTypes[i]); } s[size] = all; } combo.setItems(s); combo.setText(all); } });
private ServerPort getHttpPort(ServerPort[] ports) { for (int i = 0; i < ports.length; i++) { String protocol = ports[i].getProtocol(); if ( protocol != null && protocol.trim().toLowerCase().equals("http")) return ports[i]; } return null; } }
/** * Returns the main server port. * @return TomcatServerPort */ public ServerPort getMainPort() { Iterator iterator = getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort port = (ServerPort) iterator.next(); if (port.getName().equals("HTTP Connector")) return port; } return null; }
ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP")); } catch (Exception e) { portId = i +"/" + j; if (className != null && className.length() > 0) ports.add(new ServerPort(portId, name, port, protocol, contentTypes, advanced));
public int startMonitoring(IServer server, ServerPort port, int monitorPort) throws CoreException { try { IMonitor monitor = (IMonitor) monitors.get(port); int mport = -1; if (monitor == null) { mport = monitorPort; if (mport == -1) mport = SocketUtil.findUnusedPort(5000, 15000); // should search for a monitor first .. IMonitorWorkingCopy wc = MonitorCore.createMonitor(); wc.setLocalPort(mport); wc.setRemoteHost(server.getHost()); wc.setRemotePort(port.getPort()); if ("HTTP".equals(port.getProtocol())) wc.setProtocol("HTTP"); monitor = wc.save(); addListener(); } else mport = monitor.getLocalPort(); monitor.start(); monitors.put(port, monitor); return mport; } catch (Exception e) { Trace.trace(Trace.SEVERE, "Could not start monitoring", e); throw new CoreException(new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartingMonitor, e.getLocalizedMessage()), null)); } }
public int compare(Viewer viewer, Object e1, Object e2) { IMonitoredServerPort port1 = (IMonitoredServerPort) e1; IMonitoredServerPort port2 = (IMonitoredServerPort) e2; if (port1.getServerPort().getPort() == port2.getServerPort().getPort()) { if (port1.getMonitorPort() == port2.getMonitorPort()) { return 0; } else if (port1.getMonitorPort() > port2.getMonitorPort()) return 1; else return -1; } else if (port1.getServerPort().getPort() > port2.getServerPort().getPort()) return 1; else return -1; } });
public String getColumnText(Object element, int columnIndex) { IMonitoredServerPort port = (IMonitoredServerPort) element; if (columnIndex == 0) { if (port.isStarted()) return Messages.started; return Messages.stopped; } else if (columnIndex == 1) return notNull(port.getServerPort().getName()); else if (columnIndex == 2) return port.getServerPort().getPort() + ""; else if (columnIndex == 3) return port.getMonitorPort() + ""; else { String[] content = port.getContentTypes(); if (content == null || content.length == 0) return Messages.dialogMonitorContentTypeAll; StringBuffer sb = new StringBuffer(); int size = content.length; for (int i = 0; i < size; i++) { if (i > 0) sb.append(","); sb.append(getContentTypeString(content[i])); } return sb.toString(); } }
/** * Return the port number. * @return int */ public ServerPort getMainPort() { Iterator iterator = getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort port = (ServerPort) iterator.next(); // Return only an HTTP port from the selected Service if (port.getName().equals("HTTP Connector") && port.getId().indexOf('/') < 0) return port; } return null; }
ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP")); } catch (Exception e) { portId = i +"/" + j; if (className != null && className.length() > 0) ports.add(new ServerPort(portId, name, port, protocol, contentTypes, advanced));
while (iterator.hasNext()) { ServerPort sp = (ServerPort) iterator.next(); if (sp.getPort() < 0) throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorPortInvalid, null)); if (SocketUtil.isPortInUse(sp.getPort(), 5)) { usedPorts.add(sp); throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorPortInUse, new String[] {port.getPort() + "", getServer().getName()}), null)); } else if (usedPorts.size() > 1) { String portStr = ""; first = false; ServerPort sp = (ServerPort) iterator.next(); portStr += "" + sp.getPort(); int port = configuration.getMainPort().getPort(); if (port != 80) url += ":" + port;
/** * Return the port number. * @return int */ public ServerPort getMainPort() { Iterator iterator = getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort port = (ServerPort) iterator.next(); // Return only an HTTP port from the selected Service if (port.getProtocol().toLowerCase().equals("http") && port.getId().indexOf('/') < 0) return port; } return null; }
ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP")); } catch (Exception e) { else portId = i +"/" + j; ports.add(new ServerPort(portId, name, port, protocol2, contentTypes, advanced));
int port = config.getMainPort().getPort(); port = ServerUtil.getMonitoredPort(getServer(), port, "web"); if (port != 80)