use of org.eclipse.jetty.server.handler.ContextHandler in project jetty.project by eclipse.
the class ConstraintTest method startServer.
@Before
public void startServer() {
_server = new Server();
_connector = new LocalConnector(_server);
_config = _connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration();
_server.setConnectors(new Connector[] { _connector });
ContextHandler _context = new ContextHandler();
SessionHandler _session = new SessionHandler();
TestLoginService _loginService = new TestLoginService(TEST_REALM);
_loginService.putUser("user0", new Password("password"), new String[] {});
_loginService.putUser("user", new Password("password"), new String[] { "user" });
_loginService.putUser("user2", new Password("password"), new String[] { "user" });
_loginService.putUser("admin", new Password("password"), new String[] { "user", "administrator" });
_loginService.putUser("user3", new Password("password"), new String[] { "foo" });
_context.setContextPath("/ctx");
_server.setHandler(_context);
_context.setHandler(_session);
_server.addBean(_loginService);
_security = new ConstraintSecurityHandler();
_session.setHandler(_security);
RequestHandler _handler = new RequestHandler();
_security.setHandler(_handler);
_security.setConstraintMappings(getConstraintMappings(), getKnownRoles());
}
use of org.eclipse.jetty.server.handler.ContextHandler in project jetty.project by eclipse.
the class CookiesTest method startServer.
protected void startServer(Handler handler) throws Exception {
server = new Server();
connector = new ServerConnector(server);
server.addConnector(connector);
ContextHandler context = new ContextHandler();
context.setContextPath("/");
context.setHandler(handler);
server.setHandler(context);
server.start();
}
use of org.eclipse.jetty.server.handler.ContextHandler in project jetty.project by eclipse.
the class MisbehavingClassTest method startServer.
@SuppressWarnings("Duplicates")
@BeforeClass
public static void startServer() throws Exception {
server = new Server();
ServerConnector connector = new ServerConnector(server);
server.addConnector(connector);
handler = new EchoHandler();
ContextHandler context = new ContextHandler();
context.setContextPath("/");
context.setHandler(handler);
server.setHandler(context);
// Start Server
server.start();
String host = connector.getHost();
if (host == null) {
host = "localhost";
}
int port = connector.getLocalPort();
serverUri = new URI(String.format("ws://%s:%d/", host, port));
}
use of org.eclipse.jetty.server.handler.ContextHandler in project jetty.project by eclipse.
the class AnnotatedEchoTest method startServer.
@SuppressWarnings("Duplicates")
@BeforeClass
public static void startServer() throws Exception {
server = new Server();
ServerConnector connector = new ServerConnector(server);
server.addConnector(connector);
handler = new EchoHandler();
ContextHandler context = new ContextHandler();
context.setContextPath("/");
context.setHandler(handler);
server.setHandler(context);
// Start Server
server.start();
String host = connector.getHost();
if (host == null) {
host = "localhost";
}
int port = connector.getLocalPort();
serverUri = new URI(String.format("ws://%s:%d/", host, port));
}
use of org.eclipse.jetty.server.handler.ContextHandler in project jetty.project by eclipse.
the class ConfiguratorTest method startServer.
@BeforeClass
public static void startServer() throws Exception {
server = new Server();
ServerConnector connector = new ServerConnector(server);
server.addConnector(connector);
handler = new EchoHandler();
ContextHandler context = new ContextHandler();
context.setContextPath("/");
context.setHandler(handler);
server.setHandler(context);
// Start Server
server.start();
String host = connector.getHost();
if (host == null) {
host = "localhost";
}
int port = connector.getLocalPort();
serverUri = new URI(String.format("ws://%s:%d/", host, port));
}
Aggregations