/** Initialize the fields in this editor. */ protected void initialize() { if (ports == null) return; ports.removeAll(); CarbonServer31Utils.isServerStartBrowserPopup(server.getOriginal()); ServerPort[] serverPorts = ServerController.getInstance().getServerManager().getServerPorts(server.getOriginal()); for (ServerPort serverPort : serverPorts) { ServerPort port = serverPort; TableItem item = new TableItem(ports, SWT.NONE); String portStr = "-"; if (port.getPort() >= 0) portStr = port.getPort() + ""; String[] s = new String[] {port.getName(), portStr}; item.setText(s); int i = CarbonServerConstants.PORT_CAPTIONS.indexOf(port.getName()); if (i != -1) { port = new ServerPort( CarbonServerConstants.PORT_IDS.get(i), port.getName(), port.getPort(), port.getProtocol()); } item.setData(port); } if (readOnly) { viewer.setCellEditors(new CellEditor[] {null, null}); viewer.setCellModifier(null); } else { setupPortEditors(); } }
protected String[] getPingURLList() { try { setServerisStillStarting(true); String url = "http://" + getServer().getHost(); List<String> urls = new ArrayList<String>(); ServerPort[] ports = getServerPorts(getServer()); ServerPort sp = null; int port = 0; int offSet = 0; for (int i = 0; i < ports.length; i++) { int j = CarbonServerConstants.PORT_CAPTIONS.indexOf(ports[i].getName()); if (j != -1 && CarbonServerConstants.PORT_IDS.get(j).equals("carbon.http")) { sp = ports[i]; port = sp.getPort(); } else if (j != -1 && CarbonServerConstants.PORT_IDS.get(j).equals("carbon.offset")) { sp = ports[i]; offSet = sp.getPort(); } } String newUrl = url; if (port != 80) { newUrl = newUrl + ":" + (port + offSet); // $NON-NLS-1$ } newUrl = newUrl + CarbonServer32Utils.getWebContextRoot(getServer()) + "/carbon"; urls.add(newUrl); return urls.toArray(new String[] {}); } catch (Exception e) { Trace.trace(Trace.SEVERE, "Can't ping for server startup."); } return null; }
// TODO fire gwt sdm start/stop event private void addServerUrlsToDevModeView(ILaunch launch) { IServer server = getServerFromLaunchConfig(launch); if (server == null) { logMessage("posiblyLaunchGwtSuperDevModeCodeServer: No WTP server found."); return; } IModule[] modules = server.getModules(); if (modules == null || modules.length == 0) { return; } IModule rootMod = modules[0]; if (rootMod == null) { return; } // First clear the previous urls, before adding new ones launchUrls.clear(); String host = server.getHost(); ServerPort[] ports = null; try { ports = server.getServerPorts(new NullProgressMonitor()); } catch (Exception e1) { } // Add server urls to DevModeViewer if (ports != null) { for (ServerPort port : ports) { String baseUrl = String.format(LOCAL_URL, host, port.getPort()); String path = getPath(server, rootMod); String fullUrl = baseUrl + path; launchUrls.add(fullUrl); } } // TODO extract, consider a plugin that does this, that adds the appengine dashboard url // TODO or possibly do a extension query // Add App Engine url to DevModeView // See OpenLocalAdminConsoleHandler if (server.getName().contains("Google")) { GaeServer gaeServer = GaeServer.getGaeServer(server); String gaeHost = server.getHost(); ServerPort gaePort = gaeServer.getMainPort(); String gaeUrl = String.format("http://%s:%s/_ah/admin", gaeHost, gaePort.getPort()); launchUrls.add(gaeUrl); } }
public Map<String, Integer> getServerPorts(String serverId) throws Exception { Map<String, Integer> result = new HashMap<String, Integer>(); IServer server = getServer(serverId); if (server != null) { ServerPort[] serverPorts2 = getServerPorts(server); if (serverPorts2 != null) for (ServerPort s : serverPorts2) { result.put(s.getProtocol(), s.getPort()); } } return result; }
public static String getServerAuthenticatedCookie(IServer server) throws Exception { String result = null; if (server != null) { ServerPort[] serverPorts = getInstance().getServerPorts(server); String httpsPort = "9443"; for (ServerPort port : serverPorts) { if (port.getProtocol().equalsIgnoreCase("https")) { httpsPort = Integer.toString(port.getPort()); } } result = getServerAuthenticatedCookie(server, httpsPort); } return result; }
/** Initialize the fields in this editor. */ protected void initialize() { if (ports == null) return; ports.removeAll(); Iterator iterator = tomcatConfiguration.getServerPorts().iterator(); while (iterator.hasNext()) { ServerPort port = (ServerPort) iterator.next(); TableItem item = new TableItem(ports, SWT.NONE); String portStr = "-"; if (port.getPort() >= 0) portStr = port.getPort() + ""; String[] s = new String[] {port.getName(), portStr}; item.setText(s); item.setImage(TomcatUIPlugin.getImage(TomcatUIPlugin.IMG_PORT)); item.setData(port); } if (readOnly) { viewer.setCellEditors(new CellEditor[] {null, null}); viewer.setCellModifier(null); } else { setupPortEditors(); } }