use of org.eclipse.jetty.server.session.SessionHandler in project textdb by TextDB.
the class TexeraWebApplication method run.
@Override
public void run(TexeraWebConfiguration texeraWebConfiguration, Environment environment) throws Exception {
// serve backend at /api
environment.jersey().setUrlPattern("/api/*");
// redirect all 404 to index page, according to Angular routing requirements
ErrorPageErrorHandler eph = new ErrorPageErrorHandler();
eph.addErrorPage(404, "/");
environment.getApplicationContext().setErrorHandler(eph);
final QueryPlanResource newQueryPlanResource = new QueryPlanResource();
environment.jersey().register(newQueryPlanResource);
// Creates an instance of the PlanStoreResource class to register with Jersey
final PlanStoreResource planStoreResource = new PlanStoreResource();
// Registers the PlanStoreResource with Jersey
environment.jersey().register(planStoreResource);
final DownloadFileResource downloadFileResource = new DownloadFileResource();
environment.jersey().register(downloadFileResource);
// Creates an instance of the HealthCheck and registers it with the environment
final SampleHealthCheck sampleHealthCheck = new SampleHealthCheck();
// Registering the SampleHealthCheck with the environment
environment.healthChecks().register("sample", sampleHealthCheck);
// Creates an instance of the InitSystemResource class to register with Jersey
final SystemResource systemResource = new SystemResource();
// Registers the systemResource with Jersey
environment.jersey().register(systemResource);
environment.jersey().register(SessionHandler.class);
environment.servlets().setSessionHandler(new SessionHandler());
final UserResource userResource = new UserResource();
environment.jersey().register(userResource);
final UserFileResource userFileResource = new UserFileResource();
environment.jersey().register(userFileResource);
final KeywordDictionaryResource keywordDictionaryResource = new KeywordDictionaryResource();
environment.jersey().register(keywordDictionaryResource);
final WorkflowResource workflowResource = new WorkflowResource();
environment.jersey().register(workflowResource);
// Registers MultiPartFeature to support file upload
environment.jersey().register(MultiPartFeature.class);
// Configuring the object mapper used by Dropwizard
environment.getObjectMapper().configure(MapperFeature.USE_GETTERS_AS_SETTERS, false);
environment.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
use of org.eclipse.jetty.server.session.SessionHandler in project jphp by jphp-compiler.
the class PHttpServer method initSessionManager.
private void initSessionManager() {
idmanager = new DefaultSessionIdManager(server);
server.setSessionIdManager(idmanager);
SessionHandler sessions = new SessionHandler();
sessions.setSessionIdManager(idmanager);
filters.addHandler(sessions);
}
use of org.eclipse.jetty.server.session.SessionHandler in project NMEAParser by tvesalainen.
the class CommandLine method start.
private void start() throws IOException, InterruptedException, JAXBException, Exception {
config("starting NMEA Server");
Path configfile = getArgument("configuration file");
Config config = new Config(configfile);
String address = config.getNmeaMulticastAddress();
int nmeaPort = config.getNmeaMulticastPort();
int httpPort = config.getHttpPort();
config("NMEA Multicast Address=%s", address);
config("NMEA Multicast Port=%s", nmeaPort);
config("HTTP Port=%s", httpPort);
CachedScheduledThreadPool executor = new CachedScheduledThreadPool(64);
config("ThreadPool started %s", executor);
NMEAService nmeaService = new NMEAService(address, nmeaPort, executor);
PropertyServer propertyServer = new PropertyServer(Clock.systemDefaultZone(), config, executor);
nmeaService.addNMEAObserver(propertyServer);
nmeaService.start();
config("NMEA Service started");
JavaUtilLog log = new JavaUtilLog();
// make jetty use java.util.logger
Log.setLog(log);
Server server = new Server(httpPort);
HandlerList handlers = new HandlerList();
ServletContextHandler context = new ServletContextHandler();
context.addServlet(ResourceServlet.class, "/");
ServletHolder holder = new ServletHolder(SseServlet.class);
holder.setAsyncSupported(true);
context.addServlet(holder, "/sse");
context.addServlet(ResourceServlet.class, "*.js");
context.addServlet(ResourceServlet.class, "*.css");
context.addServlet(ResourceServlet.class, "*.gif");
context.addServlet(ResourceServlet.class, "*.png");
context.addServlet(ResourceServlet.class, "*.ico");
context.addServlet(PrefsServlet.class, "/prefs");
context.addServlet(I18nServlet.class, "/i18n");
SessionHandler sessionHandler = new SessionHandler();
context.setSessionHandler(sessionHandler);
handlers.addHandler(context);
server.setHandler(handlers);
server.setSessionIdManager(new DefaultSessionIdManager(server));
ServletContext servletContext = context.getServletContext().getContext("/sse");
servletContext.setAttribute(PropertyServer.class.getName(), propertyServer);
server.start();
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
use of org.eclipse.jetty.server.session.SessionHandler in project dropwizard-shiro by silb.
the class ApiApplication method run.
@Override
public void run(ApiConfiguration configuration, Environment environment) throws Exception {
environment.jersey().register(new UserFactory());
environment.jersey().register(new ShiroExceptionMapper());
environment.getApplicationContext().setSessionHandler(new SessionHandler());
for (Object resource : IntegrationTestApplication.createAllIntegrationTestResources()) {
environment.jersey().register(resource);
}
}
use of org.eclipse.jetty.server.session.SessionHandler in project dropwizard by dropwizard.
the class ServletEnvironmentTest method setsSessionHandlers.
@Test
void setsSessionHandlers() {
final SessionHandler sessionHandler = new SessionHandler();
environment.setSessionHandler(sessionHandler);
assertThat(handler.getSessionHandler()).isEqualTo(sessionHandler);
assertThat(handler.isSessionsEnabled()).isTrue();
}
Aggregations