use of org.apache.catalina.connector.Connector in project sonarqube by SonarSource.
the class TomcatConnectorsTest method bind_to_all_addresses_by_default.
@Test
public void bind_to_all_addresses_by_default() {
Properties p = new Properties();
p.setProperty("sonar.web.port", "9000");
TomcatConnectors.configure(tomcat, new Props(p));
verify(tomcat.getService()).addConnector(argThat(new ArgumentMatcher<Connector>() {
@Override
public boolean matches(Object o) {
Connector c = (Connector) o;
return c.getScheme().equals("http") && c.getPort() == 9000 && ((InetAddress) c.getProperty("address")).getHostAddress().equals("0.0.0.0");
}
}));
}
use of org.apache.catalina.connector.Connector in project sonarqube by SonarSource.
the class TomcatConnectors method newHttpConnector.
private static Connector newHttpConnector(Props props) {
// Not named "sonar.web.http.port" to keep backward-compatibility
int port = props.valueAsInt("sonar.web.port", 9000);
if (port < UNDEFINED_PORT) {
throw new IllegalStateException(format("HTTP port '%s' is invalid", port));
}
Connector connector = newConnector(props, HTTP_PROTOCOL, "http");
configureMaxHttpHeaderSize(connector);
connector.setPort(port);
connector.setMaxPostSize(MAX_POST_SIZE);
return connector;
}
use of org.apache.catalina.connector.Connector in project pinpoint by naver.
the class ConnectorInitializeInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (target instanceof Connector) {
final Connector connector = (Connector) target;
ServerMetaDataHolder holder = this.traceContext.getServerMetaDataHolder();
holder.addConnector(connector.getProtocol(), connector.getPort());
holder.notifyListeners();
}
}
use of org.apache.catalina.connector.Connector in project async-http-client by AsyncHttpClient.
the class WebDavBasicTest method setUpGlobal.
@BeforeClass(alwaysRun = true)
public void setUpGlobal() throws Exception {
embedded = new Embedded();
String path = new File(".").getAbsolutePath();
embedded.setCatalinaHome(path);
Engine engine = embedded.createEngine();
engine.setDefaultHost("localhost");
Host host = embedded.createHost("localhost", path);
engine.addChild(host);
Context c = embedded.createContext("/", path);
c.setReloadable(false);
Wrapper w = c.createWrapper();
w.addMapping("/*");
w.setServletClass(org.apache.catalina.servlets.WebdavServlet.class.getName());
w.addInitParameter("readonly", "false");
w.addInitParameter("listings", "true");
w.setLoadOnStartup(0);
c.addChild(w);
host.addChild(c);
Connector connector = embedded.createConnector("localhost", 0, Http11NioProtocol.class.getName());
connector.setContainer(host);
embedded.addEngine(engine);
embedded.addConnector(connector);
embedded.start();
port1 = connector.getLocalPort();
}
use of org.apache.catalina.connector.Connector in project tomee by apache.
the class TomcatRsRegistry method address.
private static String address(final Collection<Connector> connectors, final String host, final String path) {
final List<String> addresses = new ArrayList<>();
for (final Connector connector : connectors) {
final URI address;
try {
address = new URI(connector.getScheme(), null, host, connector.getPort(), path, null, null);
} catch (final Exception e) {
// just an URI problem normally...shouldn't occur
LOGGER.error("can't add container for path " + path, e);
continue;
}
addresses.add(address.toString());
}
return HttpUtil.selectSingleAddress(addresses);
}
Aggregations