java类javax.portlet.EventRequest的实例源码

AnnotationMethodHandlerAdapter.java 文件源码 项目:spring4-understanding 阅读 18 收藏 0 点赞 0 评论 0
private String determineDefaultPhase(Method handlerMethod) {
    if (void.class != handlerMethod.getReturnType()) {
        return PortletRequest.RENDER_PHASE;
    }
    for (Class<?> argType : handlerMethod.getParameterTypes()) {
        if (ActionRequest.class.isAssignableFrom(argType) || ActionResponse.class.isAssignableFrom(argType) ||
                InputStream.class.isAssignableFrom(argType) || Reader.class.isAssignableFrom(argType)) {
            return PortletRequest.ACTION_PHASE;
        }
        else if (RenderRequest.class.isAssignableFrom(argType) || RenderResponse.class.isAssignableFrom(argType) ||
                OutputStream.class.isAssignableFrom(argType) || Writer.class.isAssignableFrom(argType)) {
            return PortletRequest.RENDER_PHASE;
        }
        else if (ResourceRequest.class.isAssignableFrom(argType) || ResourceResponse.class.isAssignableFrom(argType)) {
            return PortletRequest.RESOURCE_PHASE;
        }
        else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isAssignableFrom(argType)) {
            return PortletRequest.EVENT_PHASE;
        }
    }
    return "";
}
DispatcherPortlet.java 文件源码 项目:spring4-understanding 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
 * Will just invoke afterCompletion for all interceptors whose preHandle
 * invocation has successfully completed and returned true.
 * @param mappedHandler the mapped HandlerExecutionChain
 * @param interceptorIndex index of last interceptor that successfully completed
 * @param ex Exception thrown on handler execution, or null if none
 * @see HandlerInterceptor#afterRenderCompletion
 */
private void triggerAfterEventCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex,
        EventRequest request, EventResponse response, Exception ex)
        throws Exception {

    // Apply afterCompletion methods of registered interceptors.
    if (mappedHandler != null) {
        HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
        if (interceptors != null) {
            for (int i = interceptorIndex; i >= 0; i--) {
                HandlerInterceptor interceptor = interceptors[i];
                try {
                    interceptor.afterEventCompletion(request, response, mappedHandler.getHandler(), ex);
                }
                catch (Throwable ex2) {
                    logger.error("HandlerInterceptor.afterCompletion threw exception", ex2);
                }
            }
        }
    }
}
AnnotationMethodHandlerAdapter.java 文件源码 项目:class-guard 阅读 18 收藏 0 点赞 0 评论 0
private String determineDefaultPhase(Method handlerMethod) {
    if (!void.class.equals(handlerMethod.getReturnType())) {
        return PortletRequest.RENDER_PHASE;
    }
    for (Class<?> argType : handlerMethod.getParameterTypes()) {
        if (ActionRequest.class.isAssignableFrom(argType) || ActionResponse.class.isAssignableFrom(argType) ||
                InputStream.class.isAssignableFrom(argType) || Reader.class.isAssignableFrom(argType)) {
            return PortletRequest.ACTION_PHASE;
        }
        else if (RenderRequest.class.isAssignableFrom(argType) || RenderResponse.class.isAssignableFrom(argType) ||
                OutputStream.class.isAssignableFrom(argType) || Writer.class.isAssignableFrom(argType)) {
            return PortletRequest.RENDER_PHASE;
        }
        else if (ResourceRequest.class.isAssignableFrom(argType) || ResourceResponse.class.isAssignableFrom(argType)) {
            return PortletRequest.RESOURCE_PHASE;
        }
        else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isAssignableFrom(argType)) {
            return PortletRequest.EVENT_PHASE;
        }
    }
    return "";
}
PortletWrappingController.java 文件源码 项目:class-guard 阅读 22 收藏 0 点赞 0 评论 0
public void handleEventRequest(
        EventRequest request, EventResponse response) throws Exception {

    if (!(this.portletInstance instanceof EventPortlet)) {
        logger.debug("Ignoring event request for non-event target portlet: " + this.portletInstance.getClass());
        return;
    }
    EventPortlet eventPortlet = (EventPortlet) this.portletInstance;

    // Delegate to PortletContentGenerator for checking and preparing.
    check(request, response);

    // Execute in synchronized block if required.
    if (isSynchronizeOnSession()) {
        PortletSession session = request.getPortletSession(false);
        if (session != null) {
            Object mutex = PortletUtils.getSessionMutex(session);
            synchronized (mutex) {
                eventPortlet.processEvent(request, response);
                return;
            }
        }
    }

    eventPortlet.processEvent(request, response);
}
DispatcherPortlet.java 文件源码 项目:class-guard 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
 * Will just invoke afterCompletion for all interceptors whose preHandle
 * invocation has successfully completed and returned true.
 * @param mappedHandler the mapped HandlerExecutionChain
 * @param interceptorIndex index of last interceptor that successfully completed
 * @param ex Exception thrown on handler execution, or null if none
 * @see HandlerInterceptor#afterRenderCompletion
 */
private void triggerAfterEventCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex,
        EventRequest request, EventResponse response, Exception ex)
        throws Exception {

    // Apply afterCompletion methods of registered interceptors.
    if (mappedHandler != null) {
        HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
        if (interceptors != null) {
            for (int i = interceptorIndex; i >= 0; i--) {
                HandlerInterceptor interceptor = interceptors[i];
                try {
                    interceptor.afterEventCompletion(request, response, mappedHandler.getHandler(), ex);
                }
                catch (Throwable ex2) {
                    logger.error("HandlerInterceptor.afterCompletion threw exception", ex2);
                }
            }
        }
    }
}
ComplexPayloadEventTest.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
public TestResult checkExpectedEventWasFired(EventRequest request,
        EventResponse response) {
    tally(response);
    TestResult result = new TestResult();
    result.setSpecPLT("15.2.2");
    result.setDescription("Check to make sure the the " + 
            COMPLEX_PAYLOAD_EVENT + " event was fired.");
    if (COMPLEX_PAYLOAD_EVENT.equals(request.getEvent().getName())) {
        result.setReturnCode(TestResult.PASSED);
    } else {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected event name to be '" +
                COMPLEX_PAYLOAD_EVENT + "' but it was actually '" +
                request.getEvent().getName().getClass().getName() + "'");
    }
    return result;
}
ComplexPayloadEventTest.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
public TestResult checkEventPayloadIsCorrectClass(EventRequest request,
        EventResponse response) {
    tally(response);
    TestResult result = new TestResult();
    result.setSpecPLT("15.2.2");
    result.setDescription("Check to make sure that payload is an instance" +
            "of " + ComposedObject.class);
    Object value = request.getEvent().getValue();
    if (value == null) {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected event payload type to be '" + 
                ComposedObject.class.getName() + "' but it was null.");
    } else if (value instanceof ComposedObject) {
        result.setReturnCode(TestResult.PASSED);
    } else {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected event payload type to be '" + 
                ComposedObject.class.getName() + "' but it was actually '" +
            request.getEvent().getValue() + "'");
    }
    return result;
}
ComplexPayloadEventTest.java 文件源码 项目:portals-pluto 阅读 15 收藏 0 点赞 0 评论 0
public TestResult checkEventPayloadIsCorrect(EventRequest request,
        EventResponse response) {
    tally(response);
    TestResult result = new TestResult();
    result.setSpecPLT("15.2.2");
    result.setDescription(
            "Check to make sure that the payload carries the " +
        "proper state information from the event.");
    ComposedObject value = (ComposedObject) request.getEvent().getValue();
    if (!TEST_COLOR.equals(value.getColor())) {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected payload color to be " + 
                TEST_COLOR + " but it was " + value.getColor());
    } else if (!TEST_POINT.equals(value.getPoint())) { 
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected payload point to be " + 
                TEST_POINT + " but it was " + value.getPoint());
    } else {
        result.setReturnCode(TestResult.PASSED);
    }
    return result;
}
SimplePayloadEventTest.java 文件源码 项目:portals-pluto 阅读 19 收藏 0 点赞 0 评论 0
public TestResult checkExpectedEventWasFired(EventRequest request,
        EventResponse response) {
    tally(response);
    TestResult result = new TestResult();
    result.setSpecPLT("15.2.2");
    result.setDescription("Check to make sure the the " + 
            SIMPLE_PAYLOAD_EVENT + " event was fired.");
    Event event = request.getEvent();
    if (event == null) {
        throw new NullPointerException("No event was received!");
    }
    if (SIMPLE_PAYLOAD_EVENT.equals(event.getName())) {
        result.setReturnCode(TestResult.PASSED);
    } else {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected event name to be '" +
                SIMPLE_PAYLOAD_EVENT + "' but it was actually '" +
                event.getName() + "'");
    }
    return result;
}
SimplePayloadEventTest.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
public TestResult checkEventPayloadIsCorrectClass(EventRequest request,
        EventResponse response) {
    tally(response);
    TestResult result = new TestResult();
    result.setSpecPLT("15.2.2");
    result.setDescription("Check to make sure that payload is an instance" +
                    "of " + String.class);
    Event event = request.getEvent();
    if (event == null) {
        throw new NullPointerException("No event received!");
    }
    Object value = event.getValue();
    if (value == null) {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected event payload type to be '" + 
                String.class.getName() + "' but it was null.");
    } else if (value instanceof String) {
        result.setReturnCode(TestResult.PASSED);
    } else {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected event payload type to be '" + 
                String.class.getName() + "' but it was actually '" +
                value.getClass().getName() + "'");
    }
    return result;
}
SimplePayloadEventTest.java 文件源码 项目:portals-pluto 阅读 19 收藏 0 点赞 0 评论 0
public TestResult checkEventPayloadIsCorrect(EventRequest request,
        EventResponse response) {
    tally(response);
    TestResult result = new TestResult();
    result.setSpecPLT("15.2.2");
    result.setDescription(
            "Check to make sure that the payload carries the " +
            "proper state information from the event.");
    String value = (String) request.getEvent().getValue();
    if (!SIMPLE_VALUE_PAYLOAD.equals(value)) {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Expected payload color to be " + 
                SIMPLE_VALUE_PAYLOAD + " but it was " + value);
    } else {
        result.setReturnCode(TestResult.PASSED);
    }
    return result;
}
TestCompanionPortlet.java 文件源码 项目:portals-pluto 阅读 26 收藏 0 点赞 0 评论 0
@ProcessEvent(name = SimplePayloadEventTest.SIMPLE_PAYLOAD_EVENT)
public void processSimplePayload(EventRequest request, 
        EventResponse response) throws PortletException, IOException {

    StringBuilder feedback = new StringBuilder();
    feedback.append("Simple Payload Event received.");

    if (!SimplePayloadEventTest.SIMPLE_VALUE_PAYLOAD.equals(
            request.getEvent().getValue())) {
        feedback.append("  Payload DID NOT match expected value.");
    } else {
        feedback.append("  Payload matched expected value.");
    }

    response.setRenderParameter(EVENT_INFO_PARAM, feedback.toString());
}
TestCompanionPortlet.java 文件源码 项目:portals-pluto 阅读 21 收藏 0 点赞 0 评论 0
@ProcessEvent(name = ComplexPayloadEventTest.COMPLEX_PAYLOAD_EVENT)
public void processComplexPayload(EventRequest request, 
        EventResponse response) throws PortletException, IOException {

    StringBuilder feedback = new StringBuilder();
    feedback.append("Complex Payload Event received.");

    boolean failed = false;
    ComposedObject value = (ComposedObject) request.getEvent().getValue();
    if (!ComplexPayloadEventTest.TEST_COLOR.equals(value.getColor())) {
        feedback.append("  Color DID NOT match expected value.");
        failed = true;
    }
    if (!ComplexPayloadEventTest.TEST_POINT.equals(value.getPoint())) {
        feedback.append("  Point DID NOT match expected value.");
        failed = true;
    }
    if (!failed) {
        feedback.append("  Payload matched expected values.");
    }

    response.setRenderParameter(EVENT_INFO_PARAM, feedback.toString());
}
DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventRequest_event.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {


   portletResp.setRenderParameters(portletReq);

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

   // Prereq for: V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventRequest_getAttribute
   portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventRequest_getAttribute", "Value1");

   // Prereq for: V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventRequest_getAttributeNames
   portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventRequest_getAttributeNames", "Value1");

   // Now do the actual dispatch
   String target = JSP_PREFIX + "DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventRequest" + JSP_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}
DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventResponse_event.java 文件源码 项目:portals-pluto 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {


   portletResp.setRenderParameters(portletReq);

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

   // Now do the actual dispatch
   String target = JSP_PREFIX + "DispatcherReqRespTests1_SPEC2_19_ForwardJSPEventResponse" + JSP_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}
PortletTagLibraryTests_SPEC2_26_IncludeJSPEvent_event.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
    throws PortletException, IOException {


  portletResp.setRenderParameters(portletReq);

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

  // Now do the actual dispatch
  String target = JSP_PREFIX + "PortletTagLibraryTests_SPEC2_26_IncludeJSPEvent" + JSP_SUFFIX
      + "?" + QUERY_STRING;
  PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
  rd.include(portletReq, portletResp);

}
DispatcherTests6_SPEC2_19_FwdThenIncludeServletEvent_event.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {

   portletResp.setRenderParameters(portletReq);

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

   new StringWriter();

   // Multilevel forward / include
   portletReq.setAttribute(ATTR_DISPATCH_ACTION, "include");
   String targ = SERVLET_PREFIX + "DispatcherTests6_SPEC2_19_FwdThenIncludeServletEvent_servlet" + EXTRA_PATH + "?"
         + QUERY_STRING;
   portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);

   // Now do the actual dispatch
   String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}
DispatcherTests6_SPEC2_19_FwdThenForwardServletEvent_event.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {

   portletResp.setRenderParameters(portletReq);

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

   new StringWriter();

   // Multilevel forward / include
   portletReq.setAttribute(ATTR_DISPATCH_ACTION, "forward");
   String targ = SERVLET_PREFIX + "DispatcherTests6_SPEC2_19_FwdThenForwardServletEvent_servlet" + EXTRA_PATH + "?"
         + QUERY_STRING;
   portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);

   // Now do the actual dispatch
   String target = "/IncluderForwarderServlet" + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}
AnnotationPortletConfigTests_SPEC2_28_EventDeclaration.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
@EventMethod(
   portletName = "AnnotationPortletConfigTests_SPEC2_28_EventDeclaration", 
   processingEvents = @PortletQName(
      localPart = "AnnotationPortletConfigTests_SPEC2_28_EventDeclaration_a", 
      namespaceURI = "http://www.apache.org/portals/pluto/portlet-tck_3.0"
   ),
   publishingEvents = {
      @PortletQName(
         localPart = "AnnotationPortletConfigTests_SPEC2_28_EventDeclaration_b", 
         namespaceURI = "http://www.apache.org/portals/pluto/portlet-tck_3.0"
      )
   }
)
public void processEvent_a(EventRequest portletReq, EventResponse portletResp)
         throws PortletException, IOException {

   QName eventQName = new QName(
         "http://www.apache.org/portals/pluto/portlet-tck_3.0",
         "AnnotationPortletConfigTests_SPEC2_28_EventDeclaration_b");
   portletResp.setEvent(eventQName, "Hi!");
}
DispatcherTests_SPEC2_19_ForwardServletEvent_event.java 文件源码 项目:portals-pluto 阅读 15 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {

   portletResp.setRenderParameters(portletReq);

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

   TckParameters params = (TckParameters) portletReq.getEvent().getValue();
   for (Parameter p : params.getParams()) {
      portletResp.setRenderParameter(p.getName(), p.getVals());
   }

   // Now do the actual dispatch
   String target = SERVLET_PREFIX + "DispatcherTests_SPEC2_19_ForwardServletEvent_servlet" + SERVLET_SUFFIX + "?"
         + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}
AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
@EventMethod(
   portletName = "AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2", 
   processingEvents = @PortletQName(
      localPart = "AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2a", 
      namespaceURI = "http://www.apache.org/portals/pluto/portlet-tck_3.0"
   )
)
public void processEventa(EventRequest portletReq, EventResponse portletResp)
         throws PortletException, IOException {
   Event e = portletReq.getEvent();
   String eventPayload = (String) e.getValue();
   if(eventPayload!=null && eventPayload.equals("a")){
      MutableRenderParameters mutableRenderParameters = portletResp.getRenderParameters();
      mutableRenderParameters.setValue("tr0_a", "true");
   }
}
AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration1.java 文件源码 项目:portals-pluto 阅读 14 收藏 0 点赞 0 评论 0
@EventMethod(
   portletName = "AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration1", 
   processingEvents = @PortletQName(
      localPart = "AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration1", 
      namespaceURI = "http://www.apache.org/portals/pluto/portlet-tck_3.0"
   )
)
public void processEventTr0(EventRequest portletReq, EventResponse portletResp)
         throws PortletException, IOException {
   Event e = portletReq.getEvent();
   String eventPayload = (String) e.getValue();
   if(eventPayload!=null && eventPayload.equals("Hi!")){
      MutableRenderParameters mutableRenderParameters = portletResp.getRenderParameters();
      mutableRenderParameters.setValue("tr0", "true");
   }
}
DispatcherReqRespTests4_SPEC2_19_IncludeServletEventResponse_event.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {


   portletResp.setRenderParameters(portletReq);

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

   // Now do the actual dispatch
   String target = SERVLET_PREFIX + "DispatcherReqRespTests4_SPEC2_19_IncludeServletEventResponse_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.include(portletReq, portletResp);

}
DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_event.java 文件源码 项目:portals-pluto 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {


   portletResp.setRenderParameters(portletReq);

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

   // Prereq for: V2DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_getAttribute
   portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_getAttribute", "Value1");

   // Prereq for: V2DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_getAttributeNames
   portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_getAttributeNames", "Value1");

   // Now do the actual dispatch
   String target = SERVLET_PREFIX + "DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.include(portletReq, portletResp);

}
AnnotationTests_ProcessEvent_ApiEvent_event.java 文件源码 项目:portals-pluto 阅读 21 收藏 0 点赞 0 评论 0
@ProcessEvent(qname = "{" + TCKNAMESPACE + "}AnnotationTests_ProcessEvent_ApiEvent")
public void handleEvnt(EventRequest req, EventResponse resp)
    throws PortletException, IOException {

  StringWriter writer = new StringWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  /* TestCase: V2AnnotationTests_ProcessEvent_ApiEvent_qname */
  /* Details: "Method qname(): On an event request, the method is */
  /* executed if the Event qname matches the qname field" */
  TestResult tr0 = tcd.getTestResultFailed(V2ANNOTATIONTESTS_PROCESSEVENT_APIEVENT_QNAME);
  tr0.setTcSuccess(true);
  tr0.writeTo(writer);
  req.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "AnnotationTests_ProcessEvent_ApiEvent", writer.toString(),
      APPLICATION_SCOPE);

  LOGGER.trace("Resulting String: {}", writer);
}
AnnotationTests_ProcessEvent_ApiEvent_event.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
@ProcessEvent(name = "AnnotationTests_ProcessEvent_ApiEvent2")
public void nameEvnt(EventRequest req, EventResponse resp) throws PortletException, IOException {
  StringWriter writer = new StringWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();
  /* TestCase: V2AnnotationTests_ProcessEvent_ApiEvent_name */
  /* Details: "Method name(): On an event request, the method is */
  /* executed if the Event name matches the name field" */
  TestResult tr1 = tcd.getTestResultFailed(V2ANNOTATIONTESTS_PROCESSEVENT_APIEVENT_NAME);
  tr1.setTcSuccess(true);
  tr1.writeTo(writer);
  req.getPortletSession().setAttribute(
      Constants.RESULT_ATTR_PREFIX + "AnnotationTests_ProcessEvent_ApiEvent", writer.toString(),
      APPLICATION_SCOPE);

}
DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_event.java 文件源码 项目:portals-pluto 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {


   portletResp.setRenderParameters(portletReq);

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

   // Prereq for: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_getAttribute
   portletReq.setAttribute(ATTR_PREFIX +"V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_getAttribute", "Value1");

   // Prereq for: V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_getAttributeNames
   portletReq.setAttribute(ATTR_PREFIX + "V2DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_getAttributeNames", "Value1");

   // Now do the actual dispatch
   String target = JSP_PREFIX + "DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest" + JSP_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.include(portletReq, portletResp);

}
DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventResponse_event.java 文件源码 项目:portals-pluto 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
      throws PortletException, IOException {


   portletResp.setRenderParameters(portletReq);

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

   // Now do the actual dispatch
   String target = JSP_PREFIX + "DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventResponse" + JSP_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.include(portletReq, portletResp);

}
DispatcherTests5_SPEC2_19_IncThenIncludeServletEvent_event.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {

   portletResp.setRenderParameters(portletReq);

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

   new StringWriter();

   // Multilevel forward / include
   portletReq.setAttribute(ATTR_DISPATCH_ACTION, "include");
   String targ = SERVLET_PREFIX + "DispatcherTests5_SPEC2_19_IncThenIncludeServletEvent_servlet" + EXTRA_PATH + "?"
         + QUERY_STRING;
   portletReq.setAttribute(ATTR_DISPATCH_TARGET, targ);

   // Now do the actual dispatch
   String target = SERVLET_INCFWD + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.include(portletReq, portletResp);

}
DispatcherTests4_SPEC2_19_ForwardJSPEvent_event.java 文件源码 项目:portals-pluto 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp) throws PortletException, IOException {

   portletResp.setRenderParameters(portletReq);

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

   new StringWriter();

   // Prereq for: V2DispatcherTests4_SPEC2_19_ForwardJSPEvent_invoke3
   portletReq = new EventRequestWrapper(portletReq);
   portletResp = new EventResponseWrapper(portletResp);

   // Now do the actual dispatch
   String target = JSP_PREFIX + "DispatcherTests4_SPEC2_19_ForwardJSPEvent" + JSP_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}


问题


面经


文章

微信
公众号

扫码关注公众号