Search in sources :

Example 1 with SampleHealthCheck

use of edu.uci.ics.texera.web.healthcheck.SampleHealthCheck 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);
}
Also used : SessionHandler(org.eclipse.jetty.server.session.SessionHandler) ErrorPageErrorHandler(org.eclipse.jetty.servlet.ErrorPageErrorHandler) SampleHealthCheck(edu.uci.ics.texera.web.healthcheck.SampleHealthCheck)

Aggregations

SampleHealthCheck (edu.uci.ics.texera.web.healthcheck.SampleHealthCheck)1 SessionHandler (org.eclipse.jetty.server.session.SessionHandler)1 ErrorPageErrorHandler (org.eclipse.jetty.servlet.ErrorPageErrorHandler)1