org.eclipse.equinox.http.helper.ContextPathServletAdaptor Java Examples

The following examples show how to use org.eclipse.equinox.http.helper.ContextPathServletAdaptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OAuthUIServiceComponent.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected void activate(ComponentContext context) {
    log.debug("Activating Identity OAuth UI bundle.");

    HttpService httpService = OAuthUIServiceComponentHolder.getInstance().getHttpService();

    try {

        // Register OAuth 1.a servlet
        Servlet oauth1aServlet = new ContextPathServletAdaptor(new OAuthServlet(), OAUTH_URL);
        httpService.registerServlet(OAUTH_URL, oauth1aServlet, null, null);
        log.debug("Successfully registered an instance of OAuthServlet");

    } catch (Exception e) {
        String errMsg = "Error when registering an OAuth endpoint via the HttpService.";
        log.error(errMsg, e);
        throw new RuntimeException(errMsg, e);
    }

    log.debug("Successfully activated Identity OAuth UI bundle.");

}
 
Example #2
Source File: FrameworkServiceComponent.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
protected void activate(ComponentContext ctxt) {
    BundleContext bundleContext = ctxt.getBundleContext();
    bundleContext.registerService(ApplicationAuthenticationService.class.getName(), new
            ApplicationAuthenticationService(), null);
    ;
    boolean tenantDropdownEnabled = ConfigurationFacade.getInstance().getTenantDropdownEnabled();

    if (tenantDropdownEnabled) {
        // Register the tenant management listener for tracking changes to tenants
        bundleContext.registerService(TenantMgtListener.class.getName(),
                                      new AuthenticationEndpointTenantActivityListener(), null);

        if (log.isDebugEnabled()) {
            log.debug("AuthenticationEndpointTenantActivityListener is registered. Tenant Domains Dropdown is " +
                      "enabled.");
        }
    }

    // Register Common servlet
    Servlet commonServlet = new ContextPathServletAdaptor(
            new CommonAuthenticationServlet(),
            COMMON_SERVLET_URL);

    Servlet commonInboundServlet = new ContextPathServletAdaptor(
            new CommonInboundAuthenticationServlet(),
            COMMON_INBOUND_SERVLET_URL);
    try {
        httpService.registerServlet(COMMON_SERVLET_URL, commonServlet,
                                    null, null);
        httpService.registerServlet(COMMON_INBOUND_SERVLET_URL, commonInboundServlet,
                null, null);
    } catch (Exception e) {
        String errMsg = "Error when registering Common Servlet via the HttpService.";
        log.error(errMsg, e);
        throw new RuntimeException(errMsg, e);
    }

    FrameworkServiceDataHolder.getInstance().setBundleContext(bundleContext);

    //this is done to load SessionDataStore class and start the cleanup tasks.
    SessionDataStore.getInstance();

    if (log.isDebugEnabled()) {
        log.info("Application Authentication Framework bundle is activated");
    }
}