use of org.eclipse.jetty.servlet.ServletHolder in project restfuse by eclipsesource.
the class RequestConfiguration_Test method setUp.
@BeforeClass
public static void setUp() throws Exception {
server = new Server(10043);
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
CallbackStatement statement = mock(CallbackStatement.class);
CallbackSerlvet servlet = new CallbackSerlvet(resource, statement);
context.addServlet(new ServletHolder(servlet), "/");
server.start();
int timer = 0;
while (!server.isRunning() && timer < TIMEOUT) {
Thread.sleep(1000);
timer++;
}
}
use of org.eclipse.jetty.servlet.ServletHolder in project restfuse by eclipsesource.
the class RequestContextConfiguration_Test method setUp.
@BeforeClass
public static void setUp() throws Exception {
server = new Server(10045);
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
CallbackStatement statement = mock(CallbackStatement.class);
CallbackSerlvet servlet = new CallbackSerlvet(resource, statement);
context.addServlet(new ServletHolder(servlet), "/");
server.start();
int timer = 0;
while (!server.isRunning() && timer < TIMEOUT) {
Thread.sleep(1000);
timer++;
}
}
use of org.eclipse.jetty.servlet.ServletHolder in project restfuse by eclipsesource.
the class HttpTestStatement_Test method setUp.
@BeforeClass
public static void setUp() throws Exception {
server = new Server(10042);
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
CallbackStatement statement = mock(CallbackStatement.class);
CallbackSerlvet servlet = new CallbackSerlvet(new DefaultCallbackResource(), statement);
context.addServlet(new ServletHolder(servlet), "/");
server.start();
int timer = 0;
while (!server.isRunning() && timer < TIMEOUT) {
Thread.sleep(1000);
timer++;
}
}
use of org.eclipse.jetty.servlet.ServletHolder in project hadoop by apache.
the class TestWebAppProxyServlet method start.
/**
* Simple http server. Server should send answer with status 200
*/
@BeforeClass
public static void start() throws Exception {
server = new Server(0);
((QueuedThreadPool) server.getThreadPool()).setMaxThreads(10);
ServletContextHandler context = new ServletContextHandler();
context.setContextPath("/foo");
server.setHandler(context);
context.addServlet(new ServletHolder(TestServlet.class), "/bar");
((ServerConnector) server.getConnectors()[0]).setHost("localhost");
server.start();
originalPort = ((ServerConnector) server.getConnectors()[0]).getLocalPort();
LOG.info("Running embedded servlet container at: http://localhost:" + originalPort);
// This property needs to be set otherwise CORS Headers will be dropped
// by HttpUrlConnection
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
}
use of org.eclipse.jetty.servlet.ServletHolder in project zeppelin by apache.
the class ZeppelinServer method setupRestApiContextHandler.
private static void setupRestApiContextHandler(WebAppContext webapp, ZeppelinConfiguration conf) {
final ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
cxfServletHolder.setInitParameter("javax.ws.rs.Application", ZeppelinServer.class.getName());
cxfServletHolder.setName("rest");
cxfServletHolder.setForcedPath("rest");
webapp.setSessionHandler(new SessionHandler());
webapp.addServlet(cxfServletHolder, "/api/*");
String shiroIniPath = conf.getShiroPath();
if (!StringUtils.isBlank(shiroIniPath)) {
webapp.setInitParameter("shiroConfigLocations", new File(shiroIniPath).toURI().toString());
SecurityUtils.initSecurityManager(shiroIniPath);
webapp.addFilter(ShiroFilter.class, "/api/*", EnumSet.allOf(DispatcherType.class));
webapp.addEventListener(new EnvironmentLoaderListener());
}
}
Aggregations