/** * <p> * * @{inheritDoc} * </p> * <p> * Delegates to <code>defaultContext.getResource()</code> */ @Override public URL getResource(String name) { return this.defaultContext.getResource(name); }
/** * <p> * * @{inheritDoc} * </p> * <p> * Delegates to <code>defaultContext.getMimeType()</code> */ @Override public String getMimeType(String name) { return this.defaultContext.getMimeType(name); }
/** * Returns the nested exception. * * <p> * This method predates the general purpose exception chaining mechanism. * The {@code getCause()} method is now the preferred means of obtaining * this information. * * @return The result of calling {@code getCause()}. */ public Throwable getException() { return getCause(); }
try { LOG.log(Level.INFO, "Unregistering previous instance of \"" + alias + "\" servlet"); httpService.unregister(alias); } catch (IllegalArgumentException e) { HttpContext context = httpService.createDefaultHttpContext(); try { LOG.log(Level.INFO, "Registering new instance of \"" + alias + "\" servlet"); httpService.registerServlet(alias, servlet, sprops, context); } catch (Exception e) { LOG.log(Level.WARNING, "Error registering CXF OSGi servlet " + e.getMessage(), e);
private void unregisterServlets() { if (this.httpService != null) { logger.info("JERSEY BUNDLE: UNREGISTERING SERVLETS"); httpService.unregister("/jersey-http-service"); logger.info("JERSEY BUNDLE: SERVLETS UNREGISTERED"); } }
private void rawRegisterServlets() throws ServletException, NamespaceException, InterruptedException { logger.info("JERSEY BUNDLE: REGISTERING SERVLETS"); logger.info("JERSEY BUNDLE: HTTP SERVICE = " + httpService.toString()); // TODO - temporary workaround // This is a workaround related to issue JERSEY-2093; grizzly (1.9.5) needs to have the correct context // classloader set ClassLoader myClassLoader = getClass().getClassLoader(); ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(myClassLoader); httpService.registerServlet("/jersey-http-service", new ServletContainer(), getJerseyServletParams(), null); } finally { Thread.currentThread().setContextClassLoader(originalContextClassLoader); } // END of workaround - after grizzly updated to the recent version, only the inner call from try block will remain: // httpService.registerServlet("/jersey-http-service", new ServletContainer(), getJerseyServletParams(), null); sendAdminEvent(); logger.info("JERSEY BUNDLE: SERVLETS REGISTERED"); }
/** * Creates a {@link HttpContext} * * @return a {@link HttpContext} */ protected HttpContext createHttpContext() { HttpContext defaultHttpContext = httpService.createDefaultHttpContext(); return defaultHttpContext; }
@Override public boolean handleSecurity(HttpServletRequest req, HttpServletResponse res) throws IOException { return this.httpContext.handleSecurity(req, res); }
/** {@inheritDoc} */ public void removedService(ServiceReference reference, Object service) { HttpService httpService = (HttpService) service; httpService.unregister(getServletAlias()); } }
/** {@inheritDoc} */ public Object addingService(ServiceReference reference) { HttpService service = (HttpService) context.getService(reference); try { service.registerServlet(getServletAlias(), new JolokiaServlet(context,restrictor), getConfiguration(), getHttpContext()); } catch (ServletException e) { LogHelper.logError(bundleContext, "Servlet Exception: " + e, e); } catch (NamespaceException e) { LogHelper.logError(bundleContext, "Namespace Exception: " + e, e); } return service; }
/** * Creates an {@link HttpContext}. * * @return an {@link HttpContext} that grants anonymous access */ protected HttpContext createHttpContext() { // TODO: Once we have a role-based permission system in place, we need to make sure that we create an // HttpContext here, which allows accessing the servlet without any authentication. HttpContext httpContext = httpService.createDefaultHttpContext(); return httpContext; }
@Override public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) throws IOException { return service.handleSecurity(request, response); }
@Override public URL run() throws Exception { return httpContext.getResource(p); } }, accessControllerContext);
/** * Returns the nested exception. * * <p> * This method predates the general purpose exception chaining mechanism. * The <code>getCause()</code> method is now the preferred means of * obtaining this information. * * @return The result of calling <code>getCause()</code>. */ public Throwable getException() { return getCause(); }
protected void deactivate() { try { httpService.unregister("/" + PROXY_ALIAS); } catch (IllegalArgumentException e) { // ignore, had not been registered before } }
@Override public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) throws IOException { return service.handleSecurity(request, response); }
public void unregister() { if (alreadyRegistered) { httpService.unregister(alias); alreadyRegistered = false; } }
/** * Delegate to wrapped http context. * * @see org.osgi.service.http.HttpContext#handleSecurity(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) throws IOException { return httpContext.handleSecurity(request, response); }
@Override public boolean handleSecurity(HttpServletRequest req, HttpServletResponse res) throws IOException { return this.httpContext.handleSecurity(req, res); }
@Override public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException { return context.handleSecurity(request, response); }