Search in sources :

Example 1 with WebappGuiceRole

use of com.peterphi.std.guice.web.rest.setup.WebappGuiceRole in project stdlib by petergeneric.

the class ResteasyDispatcher method init.

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    GuiceBuilder builder = new GuiceBuilder().withRole(new WebappGuiceRole(config));
    this.registry = new GuiceRegistry(builder);
    dispatcher = new GuicedResteasy(registry, config, new ServletBootstrap(config), true);
    startInitialise();
}
Also used : WebappGuiceRole(com.peterphi.std.guice.web.rest.setup.WebappGuiceRole) ServletBootstrap(org.jboss.resteasy.plugins.server.servlet.ServletBootstrap) GuiceBuilder(com.peterphi.std.guice.apploader.impl.GuiceBuilder) GuiceRegistry(com.peterphi.std.guice.apploader.impl.GuiceRegistry)

Example 2 with WebappGuiceRole

use of com.peterphi.std.guice.web.rest.setup.WebappGuiceRole in project stdlib by petergeneric.

the class GuiceServlet method service.

@Override
protected final void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    final HttpCallContext ctx = HttpCallContext.set(req, resp, getServletContext());
    try {
        // Share the call id to log4j
        Tracing.start(ctx.getLogId(), ctx.isVerbose());
        // If necessary set up Guice
        if (!ready.get()) {
            if (registry == null)
                registry = new GuiceRegistry(new GuiceBuilder().withRole(new WebappGuiceRole(getServletConfig())));
            registry.register(this, true);
        }
        // Make the call
        doService(req, resp);
    } finally {
        HttpCallContext.clear();
        Tracing.clear();
    }
}
Also used : HttpCallContext(com.peterphi.std.guice.web.HttpCallContext) WebappGuiceRole(com.peterphi.std.guice.web.rest.setup.WebappGuiceRole) GuiceBuilder(com.peterphi.std.guice.apploader.impl.GuiceBuilder) GuiceRegistry(com.peterphi.std.guice.apploader.impl.GuiceRegistry)

Example 3 with WebappGuiceRole

use of com.peterphi.std.guice.web.rest.setup.WebappGuiceRole in project stdlib by petergeneric.

the class ResteasyDispatcher method init.

@Override
public void init(FilterConfig config) throws ServletException {
    GuiceBuilder builder = new GuiceBuilder().withRole(new WebappGuiceRole(config));
    this.registry = new GuiceRegistry(builder);
    dispatcher = new GuicedResteasy(registry, config, new FilterBootstrap(config), false);
    startInitialise();
}
Also used : WebappGuiceRole(com.peterphi.std.guice.web.rest.setup.WebappGuiceRole) FilterBootstrap(org.jboss.resteasy.plugins.server.servlet.FilterBootstrap) GuiceBuilder(com.peterphi.std.guice.apploader.impl.GuiceBuilder) GuiceRegistry(com.peterphi.std.guice.apploader.impl.GuiceRegistry)

Aggregations

GuiceBuilder (com.peterphi.std.guice.apploader.impl.GuiceBuilder)3 GuiceRegistry (com.peterphi.std.guice.apploader.impl.GuiceRegistry)3 WebappGuiceRole (com.peterphi.std.guice.web.rest.setup.WebappGuiceRole)3 HttpCallContext (com.peterphi.std.guice.web.HttpCallContext)1 FilterBootstrap (org.jboss.resteasy.plugins.server.servlet.FilterBootstrap)1 ServletBootstrap (org.jboss.resteasy.plugins.server.servlet.ServletBootstrap)1