Java 类javax.portlet.filter.FilterChain 实例源码

项目:docs-samples    文件:OAuthPortletFilter.java   
@Override
public void doFilter(ActionRequest request, ActionResponse response, FilterChain chain) throws IOException,
        PortletException {
    String username = request.getRemoteUser();
    OAuthProvider oauthProvider = getOAuthProvider();
    AccessToken accessToken;
    if (username != null && oauthProvider != null) {
        accessToken = oauthProvider.loadAccessToken(username);
    } else {
        accessToken = null;
    }

    if (oauthProvider != null) {
        requestContext.saveOAuthInfo(oauthProvider, accessToken);
    }

    chain.doFilter(request, response);
}
项目:portlet-pack    文件:ResponseFilter.java   
public void doFilter(RenderRequest request, RenderResponse response, FilterChain chain) throws IOException, PortletException
  {

    Element metaViewport = response.createElement("meta");
    metaViewport.setAttribute("name", "viewport");
    metaViewport.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1");
    response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, metaViewport);

    metaViewport = response.createElement("meta");
    metaViewport.setAttribute("name", "apple-mobile-web-app-capable");
    metaViewport.setAttribute("content", "yes");
    response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, metaViewport);

/*
    metaViewport = response.createElement("link");
    metaViewport.setAttribute("rel", "apple-touch-icon");
    metaViewport.setAttribute("href", "/demo-extension/img/chat-icon.png");
    response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, metaViewport);
*/

    //
    chain.doFilter(request, response);
  }
项目:portlet-pack    文件:ResponseFilter.java   
public void doFilter(RenderRequest request, RenderResponse response, FilterChain chain) throws IOException, PortletException
{

  String account = request.getPreferences().getValue("account", null);

  if (account!=null) {
    Element jQuery1 = response.createElement("script");
    jQuery1.setAttribute("type", "text/javascript");
    String textContent = "var _gaq = _gaq || [];\n" +
            "  _gaq.push(['_setAccount', '"+account+"']);\n" +
            "  _gaq.push(['_trackPageview']);\n" +
            "\n" +
            "  (function() {\n" +
            "    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n" +
            "    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n" +
            "    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" +
            "  })();";

    jQuery1.setTextContent(textContent);
    response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, jQuery1);
  }

  //
  chain.doFilter(request, response);
}
项目:portals-pluto    文件:AsyncFilter.java   
@Override
public void doFilter(ResourceRequest resourceRequest, ResourceResponse resourceResponse, FilterChain chain) throws IOException,
      PortletException {

   DispatcherType dispatcherType = resourceRequest.getDispatcherType();

   StringBuilder txt = new StringBuilder(128);
   txt.append("Entering request. DispatcherType: ").append(dispatcherType);
   txt.append(", request #: ").append(reqnum.getRandomNumber());
   LOGGER.fine(txt.toString());

   if (asyncDialogBean.isShowFilter()) {
      txt.setLength(0);
      txt.append("<div class='msgbox'>");
      txt.append("Filter: Request number: ").append(reqnum.getRandomNumber());
      txt.append(", DispatcherType: ").append(resourceRequest.getDispatcherType());
      txt.append("</div>");
      resourceResponse.getWriter().write(txt.toString());
   }

   chain.doFilter(resourceRequest, resourceResponse);

   LOGGER.fine("Exiting request. DispatcherType: " + resourceRequest.getDispatcherType());

}
项目:liferay-blade-samples    文件:ExampleRenderFilter.java   
@Override
public void doFilter(
        RenderRequest request, RenderResponse response, FilterChain chain)
    throws IOException, PortletException {

    System.out.println("Before filter");
    request.setAttribute("CUSTOM_ATTRIBUTE", "My Custom Attribute Value");
    chain.doFilter(request, response);
    System.out.println("After filter");
}
项目:liferay-blade-samples    文件:ExampleRenderFilter.java   
@Override
public void doFilter(
        RenderRequest request, RenderResponse response, FilterChain chain)
    throws IOException, PortletException {

    System.out.println("Before filter");
    request.setAttribute("CUSTOM_ATTRIBUTE", "My Custom Attribute Value");
    chain.doFilter(request, response);
    System.out.println("After filter");
}
项目:liferay-blade-samples    文件:ExampleRenderFilter.java   
@Override
public void doFilter(
        RenderRequest request, RenderResponse response, FilterChain chain)
    throws IOException, PortletException {

    System.out.println("Before filter");
    request.setAttribute("CUSTOM_ATTRIBUTE", "My Custom Attribute Value");
    chain.doFilter(request, response);
    System.out.println("After filter");
}
项目:docs-samples    文件:CDIFilter.java   
@Override
public void doFilter(RenderRequest request, RenderResponse response, FilterChain chain) throws IOException,
        PortletException {
    if (null != bean) {
        bean.setMessage("Hello from Filter with CDI!");
        log.info("bean.message set to 'Hello from Filter with CDI!'");
    }
    chain.doFilter(request, response);
}
项目:portals-pluto    文件:AddlFilterTests_SPEC2_20_Filter.java   
@Override
public void doFilter(EventRequest portletReq, EventResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();
  /* TestCase: V2AddlFilterTests_SPEC2_20_Event_filter4 */
  /* Details: "If the filter declaration specifies the */
  /* &lt;lifecycle&gt; tag value EVENT_PHASE, the EventFilter.doFilter */
  /* method is called" */
  TestResult tr13 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_EVENT_FILTER4);
  tr13.setTcSuccess(true);
  tr13.writeTo(writer);

  /* TestCase: V2AddlFilterTests_SPEC2_20_Event_filterWrapper3 */
  /* Details: "An EVENT_PHASE filter can wrap the EventRequest object */
  /* with a custom wrapper" */
  TestResult tr11 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_EVENT_FILTERWRAPPER3);
  EventRequestWrapper eventReq = new EventRequestWrapper(portletReq);
  if (eventReq.getParameter("tr11_event") != null
      && eventReq.getParameter("tr11_event").equals("true")) {
    tr11.setTcSuccess(true);
  } else {
    tr11.appendTcDetail("Event Parameter tr11_event is not found in the wrapper");
  }
  tr11.writeTo(writer);

  /* TestCase: V2AddlFilterTests_SPEC2_20_Event_filterWrapper4 */
  /* Details: "An EVENT_PHASE filter can wrap the EventResponse object */
  /* with a custom wrapper" */
  EventResponseWrapper eventResp = new EventResponseWrapper(portletResp);
  eventResp.setRenderParameter("tr12", "true");

  portletReq.getPortletSession().setAttribute(
      RESULT_ATTR_PREFIX + "AddlFilterTests_SPEC2_20_Event", writer.toString(),
      APPLICATION_SCOPE);
  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:AddlFilterTests_SPEC2_20_Filter.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {
  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);
  JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();

  /* TestCase: V2AddlFilterTests_SPEC2_20_Render_filterWrapper6 */
  /* Details: "An RENDER_PHASE filter can wrap the RenderResponse */
  /* object with a custom wrapper" */
  RenderResponseWrapper renderResp = new RenderResponseWrapper(portletResp);
  PrintWriter writer = renderResp.getWriter();
  TestResult tr12 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_RENDER_FILTERWRAPPER6);
  tr12.setTcSuccess(true);
  tr12.writeTo(writer);

  // Create result objects for the tests

  /* TestCase: V2AddlFilterTests_SPEC2_20_Render_filterWrapper5 */
  /* Details: "An RENDER_PHASE filter can wrap the RenderRequest object */
  /* with a custom wrapper" */
  TestResult tr11 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_RENDER_FILTERWRAPPER5);
  RenderRequestWrapper renderReq = new RenderRequestWrapper(portletReq);
  if (renderReq.getParameter("tr11") != null && renderReq.getParameter("tr11").equals("true")) {
    tr11.setTcSuccess(true);
  } else {
    tr11.appendTcDetail("Render Parameter tr11 is not found in the wrapper");
  }
  tr11.writeTo(writer);

  /* TestCase: V2AddlFilterTests_SPEC2_20_Render_filter3 */
  /* Details: "If the filter declaration specifies the */
  /* &lt;lifecycle&gt; tag value RENDER_PHASE, the */
  /* RenderFilter.doFilter method is called" */
  TestResult tr13 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_RENDER_FILTER3);
  tr13.setTcSuccess(true);
  tr13.writeTo(writer);

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiActionFilter_filter2.java   
@Override
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_FilterChain_ApiActionFilter_invokeActionFilter */
  /* Details: "Invoking doFilter(ActionRequest, ActionResponse): causes */
  /* next filter to be invoked" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_FILTERCHAIN_APIACTIONFILTER_INVOKEACTIONFILTER);
  if (FilterTests_FilterChain_ApiActionFilter_filter.tr0_success) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_FilterChain_ApiActionFilter_invokeActionFilter2 */
  /* Details: "Invoking doFilter(ActionRequest, ActionResponse): causes */
  /* portlet action method to be invoked" */
  FilterTests_FilterChain_ApiActionFilter_filter2.tr1_success = true;

  PortletSession ps = portletReq.getPortletSession();
  String msg =
      (String) ps.getAttribute(RESULT_ATTR_PREFIX + "FilterTests_FilterChain_ApiActionFilter",
          APPLICATION_SCOPE);
  portletReq.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "FilterTests_FilterChain_ApiActionFilter",
      msg + writer.toString(), APPLICATION_SCOPE);

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiEventFilter_filter2.java   
@Override
public void doFilter(EventRequest portletReq, EventResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_FilterChain_ApiEventFilter_invokeEventFilter */
  /* Details: "Invoking doFilter(EventRequest, EventResponse): causes */
  /* next filter to be invoked" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_FILTERCHAIN_APIEVENTFILTER_INVOKEEVENTFILTER);
  if (FilterTests_FilterChain_ApiEventFilter_filter.tr0_success) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_FilterChain_ApiEventFilter_invokeEventFilter2 */
  /* Details: "Invoking doFilter(EventRequest, EventResponse): causes */
  /* portlet Event method to be invoked" */
  FilterTests_FilterChain_ApiEventFilter_filter2.tr1_success = true;

  String msg = (String) portletReq.getPortletSession().getAttribute(
      RESULT_ATTR_PREFIX + "FilterTests_FilterChain_ApiEventFilter", APPLICATION_SCOPE);
  portletReq.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "FilterTests_FilterChain_ApiEventFilter",
      msg + writer.toString(), APPLICATION_SCOPE);

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiResourceFilter_filter.java   
@Override
public void doFilter(ResourceRequest portletReq, ResourceResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  /* TestCase: V2FilterTests_FilterChain_ApiResourceFilter_invokeResourceFilter */
  /* Details: "Invoking doFilter(ResourceRequest, ResourceResponse): */
  /* causes next filter to be invoked" */
  FilterTests_FilterChain_ApiResourceFilter_filter.tr0_success = true;

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_PortletFilter_ApiResourceFilter_filter.java   
@Override
public void doFilter(ResourceRequest portletReq, ResourceResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_PortletFilter_ApiResourceFilter_initResource1 */
  /* Details: "The init(FilterConfig): method is called when an */
  /* ResourceFilter is configured" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIRESOURCEFILTER_INITRESOURCE1);
  if (initCalled == true) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_PortletFilter_ApiResourceFilter_initResource2 */
  /* Details: "The init(FilterConfig): method for an ResourceFilter is */
  /* passed a FilterConfig object" */
  TestResult tr1 =
      tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIRESOURCEFILTER_INITRESOURCE2);
  if (this.filterConfig != null) {
    tr1.setTcSuccess(true);
  }
  tr1.writeTo(writer);

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_PortletFilter_ApiEventFilter_filter.java   
@Override
public void doFilter(EventRequest portletReq, EventResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2FilterTests_PortletFilter_ApiEventFilter_initEvent1 */
  /* Details: "The init(FilterConfig): method is called when an */
  /* EventFilter is configured" */
  TestResult tr0 = tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIEVENTFILTER_INITEVENT1);
  if (initCalled == true) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_PortletFilter_ApiEventFilter_initEvent2 */
  /* Details: "The init(FilterConfig): method for an EventFilter is */
  /* passed a FilterConfig object" */
  TestResult tr1 = tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIEVENTFILTER_INITEVENT2);
  if (this.filterConfig != null) {
    tr1.setTcSuccess(true);
  }
  tr1.writeTo(writer);

  portletReq.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "FilterTests_PortletFilter_ApiEventFilter",
      writer.toString(), APPLICATION_SCOPE);

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_PortletFilter_ApiActionFilter_filter.java   
@Override
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_PortletFilter_ApiActionFilter_initAction1 */
  /* Details: "The init(FilterConfig): method is called when an */
  /* ActionFilter is configured" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIACTIONFILTER_INITACTION1);
  if (initCalled == true) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_PortletFilter_ApiActionFilter_initAction2 */
  /* Details: "The init(FilterConfig): method for an ActionFilter is */
  /* passed a FilterConfig object" */
  TestResult tr1 =
      tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIACTIONFILTER_INITACTION2);
  if (this.filterConfig != null) {
    tr1.setTcSuccess(true);
  }
  tr1.writeTo(writer);

  portletReq.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "FilterTests_PortletFilter_ApiActionFilter",
      writer.toString(), APPLICATION_SCOPE);

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiActionFilter_filter.java   
@Override
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  /* TestCase: V2FilterTests_FilterChain_ApiActionFilter_invokeActionFilter */
  /* Details: "Invoking doFilter(ActionRequest, ActionResponse): causes */
  /* next filter to be invoked" */
  FilterTests_FilterChain_ApiActionFilter_filter.tr0_success = true;

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiRenderFilter_filter.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  /* TestCase: V2FilterTests_FilterChain_ApiRenderFilter_invokeRenderFilter */
  /* Details: "Invoking doFilter(RenderRequest, RenderResponse): causes */
  /* next filter to be invoked" */
  FilterTests_FilterChain_ApiRenderFilter_filter.tr0_success = true;

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiResourceFilter_filter2.java   
@Override
public void doFilter(ResourceRequest portletReq, ResourceResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_FilterChain_ApiResourceFilter_invokeResourceFilter */
  /* Details: "Invoking doFilter(ResourceRequest, ResourceResponse): */
  /* causes next filter to be invoked" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_FILTERCHAIN_APIRESOURCEFILTER_INVOKERESOURCEFILTER);
  if (FilterTests_FilterChain_ApiResourceFilter_filter.tr0_success) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_FilterChain_ApiResourceFilter_invokeResourceFilter2 */
  /* Details: "Invoking doFilter(ResourceRequest, ResourceResponse): */
  /* causes portlet Resource method to be invoked" */
  FilterTests_FilterChain_ApiResourceFilter_filter2.tr1_success = true;

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_PortletFilter_ApiRenderFilter_filter.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_PortletFilter_ApiRenderFilter_initRender1 */
  /* Details: "The init(FilterConfig): method is called when an */
  /* RenderFilter is configured" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIRENDERFILTER_INITRENDER1);
  if (initCalled == true) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_PortletFilter_ApiRenderFilter_initRender2 */
  /* Details: "The init(FilterConfig): method for an RenderFilter is */
  /* passed a FilterConfig object" */
  TestResult tr1 =
      tcd.getTestResultFailed(V2FILTERTESTS_PORTLETFILTER_APIRENDERFILTER_INITRENDER2);
  if (this.filterConfig != null) {
    tr1.setTcSuccess(true);
  }
  tr1.writeTo(writer);

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiEventFilter_filter.java   
@Override
public void doFilter(EventRequest portletReq, EventResponse portletResp, FilterChain chain)
    throws IOException, PortletException {
  /* TestCase: V2FilterTests_FilterChain_ApiEventFilter_invokeEventFilter */
  /* Details: "Invoking doFilter(EventRequest, EventResponse): causes */
  /* next filter to be invoked" */
  FilterTests_FilterChain_ApiEventFilter_filter.tr0_success = true;


  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_EventFilter_ApiEventFilter_filter.java   
@Override
public void doFilter(EventRequest portletReq, EventResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2FilterTests_EventFilter_ApiEventFilter_canBeConfigured1 */
  /* Details: "An EventFilter can be configured in the portlet */
  /* descriptor" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_EVENTFILTER_APIEVENTFILTER_CANBECONFIGURED1);
  String action = filterConfig.getFilterName();
  if (action.equals("FilterTests_EventFilter_ApiEventFilter_filter")) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_EventFilter_ApiEventFilter_doFilterProcessEvent2 */
  /* Details: "After the doFilter(EventRequest, EventResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the next filter in the chain is called if multiple */
  /* filters are defined" */
  tr4_success = true;

  portletReq.getPortletSession().setAttribute(
      RESULT_ATTR_PREFIX + "FilterTests_EventFilter_ApiEventFilter", writer.toString(),
      APPLICATION_SCOPE);
  chain.doFilter(portletReq, portletResp);

  /* TestCase: V2FilterTests_EventFilter_ApiEventFilter_doFilterExamine */
  /* Details: "Method doFilter(EventRequest, EventResponse, */
  /* FilterChain): After the next filter has been successfully invoked, */
  /* the EventResponse may be examined" */
  portletResp.setRenderParameter("tr8", "true");

}
项目:portals-pluto    文件:FilterTests_FilterConfig_ApiRenderFilter_filter2.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_FilterConfig_ApiRenderFilter_getInitParameterNames1 */
  /* Details: "Method getInitParameterNames(): Returns empty */
  /* Enumeration if no parameters defined" */
  TestResult tr4 =
      tcd.getTestResultFailed(V2FILTERTESTS_FILTERCONFIG_APIRENDERFILTER_GETINITPARAMETERNAMES1);
  Enumeration<String> initParams = filterConfig.getInitParameterNames();
  if (!initParams.hasMoreElements()) {
    tr4.setTcSuccess(true);
  } else {
    tr4.appendTcDetail("Failed because found init paramerters.");
  }
  tr4.writeTo(writer);

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_FilterChain_ApiRenderFilter_filter2.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  // first execute the chain



  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_FilterChain_ApiRenderFilter_invokeRenderFilter */
  /* Details: "Invoking doFilter(RenderRequest, RenderResponse): causes */
  /* next filter to be invoked" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_FILTERCHAIN_APIRENDERFILTER_INVOKERENDERFILTER);
  if (FilterTests_FilterChain_ApiRenderFilter_filter.tr0_success) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_FilterChain_ApiRenderFilter_invokeRenderFilter2 */
  /* Details: "Invoking doFilter(RenderRequest, RenderResponse): causes */
  /* portlet Render method to be invoked" */
  FilterTests_FilterChain_ApiRenderFilter_filter2.tr1_success = true;

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:TestFilter.java   
public void doFilter(RenderRequest request, RenderResponse response,
        FilterChain chain) throws IOException, PortletException {
    processRequest(request);
    chain.doFilter(request, response);
}
项目:portals-pluto    文件:TestFilter.java   
public void doFilter(ActionRequest request, ActionResponse response,
        FilterChain chain) throws IOException, PortletException {
    processRequest(request);
    chain.doFilter(request, response);
}
项目:portals-pluto    文件:TestFilter.java   
public void doFilter(ResourceRequest request, ResourceResponse response,
        FilterChain chain) throws IOException, PortletException {
    processRequest(request);
    chain.doFilter(request, response);
}
项目:portals-pluto    文件:TestFilter.java   
public void doFilter(EventRequest request, EventResponse response,
        FilterChain chain) throws IOException, PortletException {
    processRequest(request);
    chain.doFilter(request, response);
}
项目:portals-pluto    文件:WildcardMappedFilter.java   
public void doFilter(RenderRequest request, RenderResponse response,
        FilterChain filterChain) throws IOException, PortletException {
    processRequest(request);
    filterChain.doFilter(request, response);
}
项目:portals-pluto    文件:WildcardMappedFilter.java   
public void doFilter(ActionRequest request, ActionResponse response,
        FilterChain filterChain) throws IOException, PortletException {
    processRequest(request);
    filterChain.doFilter(request, response);
}
项目:portals-pluto    文件:WildcardMappedFilter.java   
public void doFilter(EventRequest request, EventResponse response, 
        FilterChain filterChain) throws IOException, PortletException {
    processRequest(request);
    filterChain.doFilter(request, response);
}
项目:portals-pluto    文件:WildcardMappedFilter.java   
public void doFilter(ResourceRequest request, ResourceResponse response,
        FilterChain filterChain) throws IOException, PortletException {
    processRequest(request);
    filterChain.doFilter(request, response);        
}
项目:portals-pluto    文件:AddlFilterTests_SPEC2_20_FilterMultiple.java   
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
    throws IOException, PortletException {
  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:AddlFilterTests_SPEC2_20_Filter.java   
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  portletResp.setRenderParameters(portletReq.getParameterMap());
  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);

  StringWriter writer = new StringWriter();

  writer.write(initWriter.toString());

  JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2AddlFilterTests_SPEC2_20_Action_filterWrapper1 */
  /* Details: "An ACTION_PHASE filter can wrap the ActionRequest object */
  /* with a custom wrapper" */
  TestResult tr11 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_ACTION_FILTERWRAPPER1);
  ActionRequestWrapper actionReq = new ActionRequestWrapper(portletReq);
  if (actionReq.getParameter("tr11") != null && actionReq.getParameter("tr11").equals("true")) {
    tr11.setTcSuccess(true);
  } else {
    tr11.appendTcDetail("Action Parameter tr11 is not found in the wrapper");
  }
  tr11.writeTo(writer);

  /* TestCase: V2AddlFilterTests_SPEC2_20_Action_filterWrapper2 */
  /* Details: "An ACTION_PHASE filter can wrap the ActionResponse */
  /* object with a custom wrapper" */
  ActionResponseWrapper actionResp = new ActionResponseWrapper(portletResp);
  actionResp.setRenderParameter("tr12", "true");

  /* TestCase: V2AddlFilterTests_SPEC2_20_Action_filter2 */
  /* Details: "If the filter declaration specifies the */
  /* &lt;lifecycle&gt; tag value ACTION_PHASE, the */
  /* ActionFilter.doFilter method is called" */
  TestResult tr13 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_ACTION_FILTER2);
  tr13.setTcSuccess(true);
  tr13.writeTo(writer);

  portletReq.getPortletSession().setAttribute(
      RESULT_ATTR_PREFIX + "AddlFilterTests_SPEC2_20_Action", writer.toString(),
      APPLICATION_SCOPE);

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:AddlFilterTests_SPEC2_20_Filter.java   
@Override
public void doFilter(ResourceRequest portletReq, ResourceResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);

  ResourceResponseWrapper resourceResp = new ResourceResponseWrapper(portletResp);
  PrintWriter writer = resourceResp.getWriter();

  JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2AddlFilterTests_SPEC2_20_Resource_filterWrapper7 */
  /* Details: "An RESOURCE_PHASE filter can wrap the ResourceRequest */
  /* object with a custom wrapper" */
  TestResult tr12 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_RESOURCE_FILTERWRAPPER7);

  ResourceRequestWrapper resourceReq = new ResourceRequestWrapper(portletReq);
  if (resourceReq.getParameter("tr12") != null
      && resourceReq.getParameter("tr12").equals("true")) {
    tr12.setTcSuccess(true);
  } else {
    tr12.appendTcDetail("Render Parameter tr12 is not found in the wrapper");
  }
  tr12.writeTo(writer);

  /* TestCase: V2AddlFilterTests_SPEC2_20_Resource_filterWrapper8 */
  /* Details: "An RESOURCE_PHASE filter can wrap the ResourceResponse */
  /* object with a custom wrapper" */
  TestResult tr13 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_RESOURCE_FILTERWRAPPER8);
  tr13.setTcSuccess(true);
  tr13.writeTo(writer);


  /* TestCase: V2AddlFilterTests_SPEC2_20_Resource_filter5 */
  /* Details: "If the filter declaration specifies the */
  /* &lt;lifecycle&gt; tag value RESOURCE_PHASE, the */
  /* ResourceFilter.doFilter method is called" */
  TestResult tr11 = tcd.getTestResultFailed(V2ADDLFILTERTESTS_SPEC2_20_RESOURCE_FILTER5);
  tr11.setTcSuccess(true);
  tr11.writeTo(writer);

  chain.doFilter(portletReq, portletResp);
}
项目:portals-pluto    文件:FilterTests_ResourceFilter_ApiResourceFilter_filter2.java   
@Override
public void doFilter(ResourceRequest portletReq, ResourceResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_canBeConfigured2 */
  /* Details: "Multiple ResourceFilter classes can be configured in the */
  /* portlet descriptor" */
  TestResult tr1 =
      tcd.getTestResultFailed(V2FILTERTESTS_RESOURCEFILTER_APIRESOURCEFILTER_CANBECONFIGURED2);
  tr1.setTcSuccess(true);
  tr1.writeTo(writer);

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_doFilterIsCalled */
  /* Details: "The doFilter(ResourceRequest, ResourceResponse, */
  /* FilterChain): method is called before the processResource method */
  /* for the portlet" */
  tr2_success = true;

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_doFilterProcessResource1 */
  /* Details: "After the doFilter(ResourceRequest, ResourceResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the processResourceMethod is called" */
  tr3_success = true;

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_doFilterProcessResource2 */
  /* Details: "After the doFilter(ResourceRequest, ResourceResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the next filter in the chain is called if multiple */
  /* filters are defined" */
  TestResult tr4 = tcd.getTestResultFailed(
      V2FILTERTESTS_RESOURCEFILTER_APIRESOURCEFILTER_DOFILTERPROCESSRESOURCE2);
  if (FilterTests_ResourceFilter_ApiResourceFilter_filter.tr4_success) {
    tr4.setTcSuccess(true);
  }
  tr4.writeTo(writer);

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_ResourceFilter_ApiResourceFilter_filter.java   
@Override
public void doFilter(ResourceRequest portletReq, ResourceResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_canBeConfigured1 */
  /* Details: "An ResourceFilter can be configured in the portlet */
  /* descriptor" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_RESOURCEFILTER_APIRESOURCEFILTER_CANBECONFIGURED1);
  if (filterConfig.getFilterName()
      .equals("FilterTests_ResourceFilter_ApiResourceFilter_filter")) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_doFilterProcessResource2 */
  /* Details: "After the doFilter(ResourceRequest, ResourceResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the next filter in the chain is called if multiple */
  /* filters are defined" */
  tr4_success = true;

  chain.doFilter(portletReq, portletResp);

  /* TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_doFilterExamine */
  /* Details: "Method doFilter(ResourceRequest, ResourceResponse, */
  /* FilterChain): After the next filter has been successfully invoked, */
  /* the ResourceResponse may be examined" */
  TestResult tr8 =
      tcd.getTestResultFailed(V2FILTERTESTS_RESOURCEFILTER_APIRESOURCEFILTER_DOFILTEREXAMINE);
  if (!portletResp.isCommitted()) {
    tr8.setTcSuccess(true);
  }
  tr8.writeTo(writer);

  /*
   * TestCase: V2FilterTests_ResourceFilter_ApiResourceFilter_doFilterBlock Details: If the
   * doFilter(ResourceRequest, ResourceResponse, FilterChain): method does not invoke the next
   * filter, processResource is not called
   */
  TestResult tr5 =
      tcd.getTestResultSucceeded(V2FILTERTESTS_RESOURCEFILTER_APIRESOURCEFILTER_DOFILTERBLOCK);
  tr5.appendTcDetail(
      "Can't be tested as processResource is the (last) step which render test markup");
  tr5.writeTo(writer);

}
项目:portals-pluto    文件:FilterTests_RenderFilter_ApiRenderFilter_filter.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_canBeConfigured1 */
  /* Details: "An RenderFilter can be configured in the portlet */
  /* descriptor" */
  TestResult tr0 =
      tcd.getTestResultFailed(V2FILTERTESTS_RENDERFILTER_APIRENDERFILTER_CANBECONFIGURED1);
  if (filterConfig.getFilterName().equals("FilterTests_RenderFilter_ApiRenderFilter_filter")) {
    tr0.setTcSuccess(true);
  }
  tr0.writeTo(writer);

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_doFilterProcessRender2 */
  /* Details: "After the doFilter(RenderRequest, RenderResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the next filter in the chain is called if multiple */
  /* filters are defined" */
  tr4_success = true;

  chain.doFilter(portletReq, portletResp);

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_doFilterExamine */
  /* Details: "Method doFilter(RenderRequest, RenderResponse, */
  /* FilterChain): After the next filter has been successfully invoked, */
  /* the RenderResponse may be examined" */
  TestResult tr8 =
      tcd.getTestResultFailed(V2FILTERTESTS_RENDERFILTER_APIRENDERFILTER_DOFILTEREXAMINE);
  if (!portletResp.isCommitted()) {
    tr8.setTcSuccess(true);
  }
  tr8.writeTo(writer);

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_doFilterBlock */
  /*
   * Details: "If the doFilter(RenderRequest, RenderResponse, FilterChain): method does not invoke
   * the next filter, processRender is not called"
   */
  TestResult tr5 =
      tcd.getTestResultSucceeded("V2FilterTests_RenderFilter_ApiRenderFilter_doFilterBlock");
  tr5.appendTcDetail(
      "Not possible to test as render() is the last method in chain which is also responsible for test markup");
  tr5.writeTo(writer);

}
项目:portals-pluto    文件:FilterTests_RenderFilter_ApiRenderFilter_filter2.java   
@Override
public void doFilter(RenderRequest portletReq, RenderResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  PrintWriter writer = portletResp.getWriter();
  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_canBeConfigured2 */
  /* Details: "Multiple RenderFilter classes can be configured in the */
  /* portlet descriptor" */
  TestResult tr1 =
      tcd.getTestResultFailed(V2FILTERTESTS_RENDERFILTER_APIRENDERFILTER_CANBECONFIGURED2);
  tr1.setTcSuccess(true);
  tr1.writeTo(writer);

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_doFilterIsCalled */
  /* Details: "The doFilter(RenderRequest, RenderResponse, */
  /* FilterChain): method is called before the processRender method for */
  /* the portlet" */
  tr2_success = true;

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_doFilterProcessRender1 */
  /* Details: "After the doFilter(RenderRequest, RenderResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the processRenderMethod is called" */
  tr3_success = true;

  /* TestCase: V2FilterTests_RenderFilter_ApiRenderFilter_doFilterProcessRender2 */
  /* Details: "After the doFilter(RenderRequest, RenderResponse, */
  /* FilterChain): method has sucessfully completed and invokes the */
  /* next filter, the next filter in the chain is called if multiple */
  /* filters are defined" */
  TestResult tr4 =
      tcd.getTestResultFailed(V2FILTERTESTS_RENDERFILTER_APIRENDERFILTER_DOFILTERPROCESSRENDER2);
  if (FilterTests_RenderFilter_ApiRenderFilter_filter.tr4_success) {
    tr4.setTcSuccess(true);
  }
  tr4.writeTo(writer);

  chain.doFilter(portletReq, portletResp);

}
项目:portals-pluto    文件:FilterTests_ActionFilter_ApiActionFilter_filter2.java   
@Override
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
    throws IOException, PortletException {

  StringWriter writer = new StringWriter();

  // now do the tests and write output

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2FilterTests_ActionFilter_ApiActionFilter_canBeConfigured2 */
  /* Details: "Multiple ActionFilter classes can be configured in the */
  /* portlet descriptor" */
  TestResult tr1 =
      tcd.getTestResultFailed(V2FILTERTESTS_ACTIONFILTER_APIACTIONFILTER_CANBECONFIGURED2);
  tr1.setTcSuccess(true);
  tr1.writeTo(writer);

  /* TestCase: V2FilterTests_ActionFilter_ApiActionFilter_doFilterIsCalled */
  /* Details: "The doFilter(ActionRequest, ActionResponse, */
  /* FilterChain): method is called before the processAction method for */
  /* the portlet" */
  tr2_success = true;

  /* TestCase: V2FilterTests_ActionFilter_ApiActionFilter_doFilterProcessAction1 */
  /* Details: "After the doFilter(ActionRequest, ActionResponse, */
  /* FilterChain): method has successfully completed and invokes the */
  /* next filter, the processActionMethod is called" */
  tr3_success = true;

  /* TestCase: V2FilterTests_ActionFilter_ApiActionFilter_doFilterProcessAction2 */
  /* Details: "After the doFilter(ActionRequest, ActionResponse, */
  /* FilterChain): method has successfully completed and invokes the */
  /* next filter, the next filter in the chain is called if multiple */
  /* filters are defined" */
  TestResult tr4 =
      tcd.getTestResultFailed(V2FILTERTESTS_ACTIONFILTER_APIACTIONFILTER_DOFILTERPROCESSACTION2);
  if (FilterTests_ActionFilter_ApiActionFilter_filter.tr4_success) {
    tr4.setTcSuccess(true);
  }
  tr4.writeTo(writer);

  PortletSession ps = portletReq.getPortletSession();
  String msg =
      (String) ps.getAttribute(RESULT_ATTR_PREFIX + "FilterTests_ActionFilter_ApiActionFilter",
          APPLICATION_SCOPE);
  portletReq.getPortletSession().setAttribute(
      RESULT_ATTR_PREFIX + "FilterTests_ActionFilter_ApiActionFilter", msg + writer.toString(),
      APPLICATION_SCOPE);

  chain.doFilter(portletReq, portletResp);
}