@Test public void unsupported_connector() { Connector connector = mock(Connector.class, Mockito.RETURNS_DEEP_STUBS); when(connector.getProtocol()).thenReturn("SPDY/1.1"); when(connector.getScheme()).thenReturn("spdy"); when(tomcat.getService().findConnectors()).thenReturn(new Connector[] {connector}); try { underTest.log(tomcat); fail(); } catch (IllegalArgumentException e) { // expected } }
public boolean start() throws ContainerException { try { tomcat.start(); } catch (LifecycleException e) { throw new ContainerException(e); } for (Connector con: tomcat.getService().findConnectors()) { Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " + (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module); } Debug.logInfo("Started " + ServerInfo.getServerInfo(), module); return true; }
private void verifyHttpConnector(int expectedPort, Map<String, Object> expectedProps) { verify(tomcat.getService()).addConnector(argThat(c -> { if (!c.getScheme().equals("http")) { return false; } if (!c.getProtocol().equals(TomcatConnectors.HTTP_PROTOCOL)) { return false; } if (c.getPort() != expectedPort) { return false; } for (Map.Entry<String, Object> expectedProp : expectedProps.entrySet()) { if (!expectedProp.getValue().equals(c.getProperty(expectedProp.getKey()))) { return false; } } return true; })); } }
public String getTomcatProtocol() { return connector.getProtocol(); }
/** * Indicates whether or not the specified connector use the AJP protocol. * * @param connector a connector * @return true, if the specified connector is AJP, false otherwise */ public static boolean isAJP(org.apache.catalina.connector.Connector connector) { String protocol = connector.getProtocol(); return protocol.startsWith("AJP") || protocol.startsWith("org.apache.coyote.ajp"); }
/** * Indicates whether or not the specified connector use the AJP protocol. * @param connector a connector * @return true, if the specified connector is AJP, false otherwise */ public static boolean isAJP(org.apache.catalina.connector.Connector connector) { String protocol = connector.getProtocol(); return protocol.startsWith("AJP") || protocol.startsWith("org.apache.coyote.ajp"); } /**
/** * Provide a useful toString() implementation as it may be used when logging * Lifecycle errors to identify the component. */ @Override public String toString() { // Not worth caching this right now StringBuilder sb = new StringBuilder("Connector["); sb.append(getProtocol()); sb.append('-'); sb.append(getPort()); sb.append(']'); return sb.toString(); }
/** * Provide a useful toString() implementation as it may be used when logging * Lifecycle errors to identify the component. */ @Override public String toString() { // Not worth caching this right now StringBuilder sb = new StringBuilder("Connector["); sb.append(getProtocol()); sb.append('-'); sb.append(getPort()); sb.append(']'); return sb.toString(); }
/** * Provide a useful toString() implementation as it may be used when logging * Lifecycle errors to identify the component. */ @Override public String toString() { // Not worth caching this right now StringBuilder sb = new StringBuilder("Connector["); sb.append(getProtocol()); sb.append('-'); sb.append(getPort()); sb.append(']'); return sb.toString(); }
/** * Set the Connector through which this Request was received. * * @param connector The new connector */ public void setConnector(Connector connector) { this.connector = connector; if("AJP/1.3".equals(connector.getProtocol())) { // default size to size of one ajp-packet outputBuffer = new OutputBuffer(8184); } else { outputBuffer = new OutputBuffer(); } outputStream = new CoyoteOutputStream(outputBuffer); writer = new CoyoteWriter(outputBuffer); }
/** * Gets the network protocol that this connector handles. */ public String getProtocol() { String protocol = connector.getProtocol(); if(protocol.indexOf("AJP") > -1) { return WebManager.PROTOCOL_AJP; } else if(connector.getScheme().equalsIgnoreCase("http")) { return WebManager.PROTOCOL_HTTP; } else if(connector.getScheme().equalsIgnoreCase("https")) { return WebManager.PROTOCOL_HTTPS; } throw new IllegalStateException("Unknown protocol '"+protocol+"' and scheme '"+connector.getScheme()+"'"); }
/** * This method simply makes the HTTP and SSL ports avaialble everywhere in the JVM in order jsip ha to read them for * balancer description purposes. There is no other good way to communicate the properies to jsip ha without adding * more dependencies. */ public void initializeSystemPortProperties() { for (Connector connector : connectors) { if(connector.getProtocol().contains("HTTP")) { if(connector.getSecure()) { System.setProperty("org.mobicents.properties.sslPort", Integer.toString(connector.getPort())); } else { System.setProperty("org.mobicents.properties.httpPort", Integer.toString(connector.getPort())); } } } }
private Connector findConnector() { final StandardServer server = TomcatHelper.getServer(); final Service[] services = server.findServices(); for (final Service s : services) { for (final Connector connector : s.findConnectors()) { if (connector.getProtocol().toLowerCase(Locale.ENGLISH).contains("http")) { // TODO: enhance, should not be secured ATM return connector; } } } return null; }
/* */ public void setConnector(Connector connector) /* */ { /* 126 */ this.connector = connector; /* 127 */ if ("AJP/1.3".equals(connector.getProtocol())) /* */ { /* 129 */ this.outputBuffer = new OutputBuffer(8184); /* */ } /* 131 */ else this.outputBuffer = new OutputBuffer(); /* */ /* 133 */ this.outputStream = new CoyoteOutputStream(this.outputBuffer); /* 134 */ this.writer = new CoyoteWriter(this.outputBuffer); /* */ } /* */
public int getPort(String protocol, boolean secure) { int result = -1; for (Connector connector : webserver.getService().findConnectors()) { if (connector.getProtocol().equals(protocol) && connector.getSecure() == secure) { return connector.getPort(); } } return result; } }
/** * Set the Connector through which this Request was received. * * @param connector The new connector */ public void setConnector(Connector connector) { if("AJP/1.3".equals(connector.getProtocol())) { // default size to size of one ajp-packet outputBuffer = new OutputBuffer(8184); } else { outputBuffer = new OutputBuffer(); } outputStream = new CoyoteOutputStream(outputBuffer); writer = new CoyoteWriter(outputBuffer); }
/** * Set the Connector through which this Request was received. * * @param connector The new connector */ public void setConnector(Connector connector) { this.connector = connector; if("AJP/1.3".equals(connector.getProtocol())) { // default size to size of one ajp-packet outputBuffer = new OutputBuffer(8184); } else { outputBuffer = new OutputBuffer(); } outputStream = new CoyoteOutputStream(outputBuffer); writer = new CoyoteWriter(outputBuffer); }
/** * Set the Connector through which this Request was received. * * @param connector The new connector */ public void setConnector(Connector connector) { this.connector = connector; if("AJP/1.3".equals(connector.getProtocol())) { // default size to size of one ajp-packet outputBuffer = new OutputBuffer(8184); } else { outputBuffer = new OutputBuffer(); } outputStream = new CoyoteOutputStream(outputBuffer); writer = new CoyoteWriter(outputBuffer); }
/** * Set the Connector through which this Request was received. * * @param connector The new connector */ public void setConnector(Connector connector) { this.connector = connector; if("AJP/1.3".equals(connector.getProtocol())) { // default size to size of one ajp-packet outputBuffer = new OutputBuffer(8184); } else { outputBuffer = new OutputBuffer(); } outputStream = new CoyoteOutputStream(outputBuffer); writer = new CoyoteWriter(outputBuffer); }
/** * Set the Connector through which this Request was received. * * @param connector The new connector */ public void setConnector(Connector connector) { this.connector = connector; if("AJP/1.3".equals(connector.getProtocol())) { // default size to size of one ajp-packet outputBuffer = new OutputBuffer(8184); } else { outputBuffer = new OutputBuffer(); } outputStream = new CoyoteOutputStream(outputBuffer); writer = new CoyoteWriter(outputBuffer); }