Java 类javax.portlet.EventResponse 实例源码

项目:spring4-understanding    文件:AnnotationMethodHandlerAdapter.java   
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 "";
}
项目:spring4-understanding    文件:DispatcherPortlet.java   
/**
 * 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);
                }
            }
        }
    }
}
项目:class-guard    文件:AnnotationMethodHandlerAdapter.java   
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 "";
}
项目:portals-pluto    文件:ComplexPayloadEventTest.java   
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;
}
项目:portals-pluto    文件:ComplexPayloadEventTest.java   
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;
}
项目:portals-pluto    文件:ComplexPayloadEventTest.java   
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;
}
项目:portals-pluto    文件:SimplePayloadEventTest.java   
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;
}
项目:portals-pluto    文件:SimplePayloadEventTest.java   
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;
}
项目:portals-pluto    文件:SimplePayloadEventTest.java   
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;
}
项目:portals-pluto    文件:TestCompanionPortlet.java   
@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());
}
项目:portals-pluto    文件:PortletTagLibraryTests_SPEC2_26_IncludeJSPEvent_event.java   
@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);

}
项目:portals-pluto    文件:DispatcherTests6_SPEC2_19_FwdThenIncludeServletEvent_event.java   
@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);

}
项目:portals-pluto    文件:AnnotationPortletConfigTests_SPEC2_28_EventDeclaration.java   
@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!");
}
项目:portals-pluto    文件:DispatcherTests_SPEC2_19_IncludeServletEvent_event.java   
@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_IncludeServletEvent_servlet" + SERVLET_SUFFIX + "?"
         + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
   rd.include(portletReq, portletResp);

}
项目:portals-pluto    文件:AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2.java   
@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");
   }
}
项目:portals-pluto    文件:AnnotationPortletAppConfigOverrideTests_SPEC1_28_PublicRenderParameters3.java   
@EventMethod(
   portletName = "AnnotationPortletAppConfigOverrideTests_SPEC1_28_PublicRenderParameters3", 
   processingEvents = @PortletQName(
      localPart = "AnnotationPortletAppConfigOverrideTests_SPEC1_28_PublicRenderParameters2", 
      namespaceURI = "http://www.apache.org/portals/pluto/portlet-tck_3.0"
   )
)
public void processEventb(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("tr2_public", "true");
   }
}
项目:portals-pluto    文件:DispatcherReqRespTests4_SPEC2_19_IncludeServletEventResponse_event.java   
@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);

}
项目:portals-pluto    文件:DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_event.java   
@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);

}
项目:portals-pluto    文件:AnnotationTests_ProcessEvent_ApiEvent_event.java   
@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);

}
项目:portals-pluto    文件:DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_event.java   
@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);

}
项目:portals-pluto    文件:DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventResponse_event.java   
@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);

}
项目:portals-pluto    文件:DispatcherTests5_SPEC2_19_IncThenForwardServletEvent_event.java   
@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 + "DispatcherTests5_SPEC2_19_IncThenForwardServletEvent_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);

}
项目:portals-pluto    文件:DispatcherTests4_SPEC2_19_ForwardJSPEvent_event.java   
@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);

}
项目:portals-pluto    文件:DispatcherTests4_SPEC2_19_ForwardServletEvent_event.java   
@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_ForwardServletEvent_invoke3
   portletReq = new EventRequestWrapper(portletReq);
   portletResp = new EventResponseWrapper(portletResp);

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

}
项目:portals-pluto    文件:PortletHubTests_SPEC_23_JSAction.java   
@EventMethod(portletName = "PortletHubTests_SPEC_23_JSAction", processingEvents = {
      @PortletQName(namespaceURI="http://www.apache.org/", localPart="event")
})
public void doEvent(EventRequest eventReq, EventResponse eventResp) {

   MutableRenderParameters mrp = eventResp.getRenderParameters();
   String testcase = mrp.getValue("testcase");

   if (testcase == null || testcase.isEmpty()) {
      mrp.setValue("status", "Failed. No test case parameter present.");
   } else if (testcase.equals(V3PORTLETHUBTESTS_SPEC_23_JSACTION_ACTION6)) {
      mrp.setValue("status", "OK");
   } else {
      mrp.setValue("status", "Failed. Unknown test case: " + testcase);
   }

}
项目:portals-pluto    文件:AddlPortletTests_SPEC2_5_RenderGenericPortlet.java   
@ProcessEvent(name = "AddlPortletTests_SPEC2_5_RenderGenericPortlet_localPart")
public void processEvent(EventRequest portletReq, EventResponse response)
      throws PortletException, IOException {
   JSR286SpecTestCaseDetails tcd = new JSR286SpecTestCaseDetails();

   /*
    * TestCase:
    * V2AddlPortletTests_SPEC2_5_RenderGenericPortlet_eventDispatching2
    */
   /* Details: "The GenericPortlet processEvent method will dispatch the */
   /* request to a subclass method annotated with the tag */
   /* @ProcessEvent(name=&lt;event_name_local_part&gt;)" */
   TestResult tr2 = tcd.getTestResultFailed(
         V2ADDLPORTLETTESTS_SPEC2_5_RENDERGENERICPORTLET_EVENTDISPATCHING2);
   tr2.setTcSuccess(true);
   portletReq.getPortletSession().setAttribute(
         RESULT_ATTR_PREFIX
               + "AddlPortletTests_SPEC2_5_RenderGenericPortlet_event_b",
         tr2.toString(), APPLICATION_SCOPE);

}
项目:portals-pluto    文件:DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_event.java   
@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 + "DispatcherReqRespTests2_SPEC2_19_ForwardServletEventResponse_servlet" + SERVLET_SUFFIX + "?" + QUERY_STRING;
   PortletRequestDispatcher rd = portletConfig.getPortletContext()
         .getRequestDispatcher(target);
   rd.forward(portletReq, portletResp);

}
项目:spring4-understanding    文件:AnnotationMethodHandlerAdapter.java   
@Override
public void handleEvent(EventRequest request, EventResponse response, Object handler) throws Exception {
    Object returnValue = doHandle(request, response, handler);
    if (returnValue != null) {
        throw new IllegalStateException("Invalid event method return value: " + returnValue);
    }
}
项目:spring4-understanding    文件:PortletWrappingController.java   
@Override
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);
}
项目:spring4-understanding    文件:SimpleControllerHandlerAdapter.java   
@Override
public void handleEvent(EventRequest request, EventResponse response, Object handler) throws Exception {
    if (handler instanceof EventAwareController) {
        ((EventAwareController) handler).handleEventRequest(request, response);
    }
    else {
        // if no event processing method was found just keep render params
        response.setRenderParameters(request);
    }
}
项目:spring4-understanding    文件:HandlerInterceptorAdapter.java   
/**
 * This implementation delegates to {@link #preHandle}.
 */
@Override
public boolean preHandleEvent(EventRequest request, EventResponse response, Object handler)
        throws Exception {

    return preHandle(request, response, handler);
}
项目:spring4-understanding    文件:HandlerInterceptorAdapter.java   
/**
 * This implementation delegates to {@link #afterCompletion}.
 */
@Override
public void afterEventCompletion(
        EventRequest request, EventResponse response, Object handler, Exception ex)
        throws Exception {

    afterCompletion(request, response, handler, ex);
}
项目:spring4-understanding    文件:SimplePortletHandlerAdapter.java   
@Override
public void handleEvent(EventRequest request, EventResponse response, Object handler) throws Exception {
    if (handler instanceof EventPortlet) {
        ((EventPortlet) handler).processEvent(request, response);
    }
    else {
        // if no event processing method was found just keep render params
        response.setRenderParameters(request);
    }
}
项目:OEPv2    文件:DossierProcPortlet.java   
@ProcessEvent(qname = "{http://org.oep.com/events}ipc-domainno")
public void myDomainNoEvent(EventRequest request, EventResponse response) {
    Event event = request.getEvent();
    String domainNo = event.getValue().toString();
    response.setRenderParameter("domainNo", domainNo);

}
项目:OEPv2    文件:DossierProcPortlet.java   
@ProcessEvent(qname = "{http://org.oep.com/events}ipc-administrationno")
public void myAdministrationNoEvent(EventRequest request,
        EventResponse response) {
    Event event = request.getEvent();
    // Get data from the event
    String administrationNo = event.getValue().toString();
    response.setRenderParameter("administrationNo", administrationNo);

}
项目:OEPv2    文件:IpcEventReceiverPortlet.java   
@ProcessEvent(qname = "{http://proliferay.com/events}ipc-text")
public void myEvent(EventRequest request, EventResponse response) {
    Event event = request.getEvent();
    //Get data from the event
    //String sampleText = (String) event.getValue();
    Employee employee = (Employee)event.getValue();

    //Set the text in response to display in UI
    response.setRenderParameter("sampleText", employee.name);
}
项目:liferaylms-portlet    文件:ModuleNavigation.java   
@ProcessEvent(qname = "{http://www.wemooc.com/}themeId")
public void handlethemeEvent(EventRequest eventRequest, EventResponse eventResponse) {
   if (eventRequest.getEvent().getValue() instanceof ThemeIdEvent){
       ThemeIdEvent themeIdEvent = (ThemeIdEvent) eventRequest.getEvent().getValue();
       long moduleId=ParamUtil.getLong(eventRequest, "moduleId",0L);
       if(moduleId==themeIdEvent.getModuleId()){
           eventResponse.setRenderParameter("themeId",Long.toString(themeIdEvent.getThemeId()));
           eventResponse.setRenderParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.TRUE);
       }        
       else if((moduleId==0)&&(themeIdEvent.getModuleId()==ThemeIdEvent.EVALUATION_THEME_ID)){
           eventResponse.setRenderParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.FALSE);
       }
   }
}
项目:liferaylms-portlet    文件:LmsActivitiesList.java   
@ProcessEvent(qname = "{http://www.wemooc.com/}themeId")
public void handlethemeEvent(EventRequest eventRequest, EventResponse eventResponse) {

    if (eventRequest.getEvent().getValue() instanceof ThemeIdEvent){
       ThemeIdEvent themeIdEvent = (ThemeIdEvent) eventRequest.getEvent().getValue();
       long moduleId=ParamUtil.getLong(eventRequest, "moduleId",0L);
       if(moduleId==themeIdEvent.getModuleId()){
           eventResponse.setRenderParameter("viewCurrentModule",StringPool.TRUE);
       }        
       else if((moduleId==0)&&(themeIdEvent.getModuleId()==ThemeIdEvent.EVALUATION_THEME_ID)){
           eventResponse.setRenderParameter("viewCurrentModule",StringPool.FALSE);
       }
    }
}
项目:liferaylms-portlet    文件:EvaluationAvgPortlet.java   
@ProcessEvent(qname = "{http://www.wemooc.com/}themeId")
public void handlethemeEvent(EventRequest eventRequest, EventResponse eventResponse) {

    if (eventRequest.getEvent().getValue() instanceof ThemeIdEvent){
       ThemeIdEvent themeIdEvent = (ThemeIdEvent) eventRequest.getEvent().getValue();
       long moduleId=ParamUtil.getLong(eventRequest, "moduleId",0L);
       if(moduleId==themeIdEvent.getModuleId()){
           eventResponse.setRenderParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.FALSE);
       }        
       else if((moduleId==0)&&(themeIdEvent.getModuleId()==ThemeIdEvent.EVALUATION_THEME_ID)){
           eventResponse.setRenderParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.TRUE);
       }
    }
}
项目:liferaylms-portlet    文件:ModuleTitle.java   
@ProcessEvent(qname = "{http://www.wemooc.com/}themeId")
public void handlethemeEvent(EventRequest eventRequest, EventResponse eventResponse) {
   if (eventRequest.getEvent().getValue() instanceof ThemeIdEvent){
       ThemeIdEvent themeIdEvent = (ThemeIdEvent) eventRequest.getEvent().getValue();
       long moduleId=ParamUtil.getLong(eventRequest, "moduleId",0L);
       if(moduleId==themeIdEvent.getModuleId()){
           eventResponse.setRenderParameter("themeId",Long.toString(themeIdEvent.getThemeId()));
           eventResponse.setRenderParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.TRUE);
       }        
       else if((moduleId==0)&&(themeIdEvent.getModuleId()==ThemeIdEvent.EVALUATION_THEME_ID)){
           eventResponse.setRenderParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.FALSE);
       }
   }
}