use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class StatisticsServletTest method createServer.
@Before
public void createServer() {
_server = new Server();
_connector = new LocalConnector(_server);
_server.addConnector(_connector);
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class ServletContextResourcesTest method init.
@Before
public void init() throws Exception {
server = new Server();
connector = new LocalConnector(server);
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
Path resBase = MavenTestingUtils.getTestResourcePathDir("contextResources");
context = new ServletContextHandler();
context.setContextPath("/context");
context.setResourceBase(resBase.toFile().toURI().toASCIIString());
server.setHandler(context);
server.addConnector(connector);
server.start();
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class ResponseHeadersTest method startServer.
@BeforeClass
public static void startServer() throws Exception {
server = new Server();
connector = new LocalConnector(server);
server.addConnector(connector);
ServletContextHandler context = new ServletContextHandler();
context.setContextPath("/");
server.setHandler(context);
context.addServlet(new ServletHolder(new SimulateUpgradeServlet()), "/ws/*");
context.addServlet(new ServletHolder(new MultilineResponseValueServlet()), "/multiline/*");
server.start();
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class ConcatServletTest method prepareServer.
@Before
public void prepareServer() throws Exception {
server = new Server();
connector = new LocalConnector(server);
server.addConnector(connector);
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class AliasedConstraintTest method startServer.
@BeforeClass
public static void startServer() throws Exception {
server = new Server();
connector = new LocalConnector(server);
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");
context.setResourceBase(MavenTestingUtils.getTestResourceDir("docroot").getAbsolutePath());
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { context, new DefaultHandler() });
server.setHandler(handlers);
context.setHandler(session);
// context.addAliasCheck(new AllowSymLinkAliasChecker());
server.addBean(loginService);
security = new ConstraintSecurityHandler();
session.setHandler(security);
ResourceHandler handler = new ResourceHandler();
security.setHandler(handler);
List<ConstraintMapping> constraints = new ArrayList<>();
Constraint constraint0 = new Constraint();
constraint0.setAuthenticate(true);
constraint0.setName("forbid");
ConstraintMapping mapping0 = new ConstraintMapping();
mapping0.setPathSpec("/forbid/*");
mapping0.setConstraint(constraint0);
constraints.add(mapping0);
Set<String> knownRoles = new HashSet<>();
knownRoles.add("user");
knownRoles.add("administrator");
security.setConstraintMappings(constraints, knownRoles);
server.start();
}
Aggregations