public void doFilter(EventRequest request, EventResponse response,
FilterChain filterChain) throws IOException, PortletException {
processRequest(request);
filterChain.doFilter(request, response);
}
java类javax.portlet.filter.FilterChain的实例源码
WildcardMappedFilter.java 文件源码
项目:portals-pluto
阅读 17
收藏 0
点赞 0
评论 0
WildcardMappedFilter.java 文件源码
项目:portals-pluto
阅读 15
收藏 0
点赞 0
评论 0
public void doFilter(ResourceRequest request, ResourceResponse response,
FilterChain filterChain) throws IOException, PortletException {
processRequest(request);
filterChain.doFilter(request, response);
}
AddlFilterTests_SPEC2_20_FilterMultiple.java 文件源码
项目:portals-pluto
阅读 14
收藏 0
点赞 0
评论 0
public void doFilter(ActionRequest portletReq, ActionResponse portletResp, FilterChain chain)
throws IOException, PortletException {
chain.doFilter(portletReq, portletResp);
}
AddlFilterTests_SPEC2_20_Filter.java 文件源码
项目:portals-pluto
阅读 16
收藏 0
点赞 0
评论 0
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);
}
AddlFilterTests_SPEC2_20_Filter.java 文件源码
项目:portals-pluto
阅读 15
收藏 0
点赞 0
评论 0
@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 */
/* <lifecycle> 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);
}
FilterTests_ResourceFilter_ApiResourceFilter_filter2.java 文件源码
项目:portals-pluto
阅读 15
收藏 0
点赞 0
评论 0
@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);
}
FilterTests_ResourceFilter_ApiResourceFilter_filter.java 文件源码
项目:portals-pluto
阅读 15
收藏 0
点赞 0
评论 0
@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);
}
FilterTests_RenderFilter_ApiRenderFilter_filter.java 文件源码
项目:portals-pluto
阅读 19
收藏 0
点赞 0
评论 0
@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);
}
FilterTests_RenderFilter_ApiRenderFilter_filter2.java 文件源码
项目:portals-pluto
阅读 16
收藏 0
点赞 0
评论 0
@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);
}
FilterTests_ActionFilter_ApiActionFilter_filter2.java 文件源码
项目:portals-pluto
阅读 16
收藏 0
点赞 0
评论 0
@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);
}