Esempio n. 1
0
  public void init() {
    servletContext.setInitParameter(
        InitParameter.POWER_API_CONFIG_DIR.getParameterName(), "/etc/powerapi");

    // Show me Papi!
    servletContext.setInitParameter("show-me-papi", "true");

    final Map<String, String> powerFilterParams = new HashMap<String, String>();
    final FilterConfig fc = new NXPFilterConfig("power-filter", servletContext, powerFilterParams);

    try {
      ctxManager.contextInitialized(new ServletContextEvent(servletContext));
      powerFilterInstance.init(fc);
    } catch (ServletException servletException) {
      LOG.error(servletException.getMessage(), servletException);
    }
  }
Esempio n. 2
0
  public RequestResponsePair handleRequest(
      ExternalConnectionFuture connectionFuture,
      HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException {
    final LastCallFilterChain rootFilterChain = new LastCallFilterChain();

    try {
      powerFilterInstance.doFilter(request, response, rootFilterChain);
    } catch (IOException ioe) {
      LOG.error(ioe.getMessage(), ioe);
    } catch (ServletException se) {
      LOG.error(se.getMessage(), se);
    }

    return new RequestResponsePair(
        rootFilterChain.getLastRequestObjectPassed(),
        rootFilterChain.getLastResponseObjectPassed());
  }