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 */
/* <lifecycle> 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);
}
java类javax.portlet.filter.ActionRequestWrapper的实例源码
AddlFilterTests_SPEC2_20_Filter.java 文件源码
项目:portals-pluto
阅读 19
收藏 0
点赞 0
评论 0