コード例 #1
0
ファイル: PowerProxy.java プロジェクト: gnomix/repose
  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);
    }
  }
コード例 #2
0
ファイル: PowerProxy.java プロジェクト: gnomix/repose
  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());
  }