本文整理汇总了Java中javax.portlet.EventResponse类的典型用法代码示例。如果您正苦于以下问题:Java EventResponse类的具体用法?Java EventResponse怎么用?Java EventResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventResponse类属于javax.portlet包,在下文中一共展示了EventResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: determineDefaultPhase
import javax.portlet.EventResponse; //导入依赖的package包/类
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 "";
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:AnnotationMethodHandlerAdapter.java
示例2: triggerAfterEventCompletion
import javax.portlet.EventResponse; //导入依赖的package包/类
/**
* 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);
}
}
}
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:DispatcherPortlet.java
示例3: determineDefaultPhase
import javax.portlet.EventResponse; //导入依赖的package包/类
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 "";
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:23,代码来源:AnnotationMethodHandlerAdapter.java
示例4: checkExpectedEventWasFired
import javax.portlet.EventResponse; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:portals-pluto,代码行数:18,代码来源:ComplexPayloadEventTest.java
示例5: checkEventPayloadIsCorrectClass
import javax.portlet.EventResponse; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:portals-pluto,代码行数:23,代码来源:ComplexPayloadEventTest.java
示例6: checkEventPayloadIsCorrect
import javax.portlet.EventResponse; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:portals-pluto,代码行数:23,代码来源:ComplexPayloadEventTest.java
示例7: checkExpectedEventWasFired
import javax.portlet.EventResponse; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:portals-pluto,代码行数:22,代码来源:SimplePayloadEventTest.java
示例8: checkEventPayloadIsCorrectClass
import javax.portlet.EventResponse; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:portals-pluto,代码行数:27,代码来源:SimplePayloadEventTest.java
示例9: checkEventPayloadIsCorrect
import javax.portlet.EventResponse; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:portals-pluto,代码行数:19,代码来源:SimplePayloadEventTest.java
示例10: processSimplePayload
import javax.portlet.EventResponse; //导入依赖的package包/类
@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());
}
开发者ID:apache,项目名称:portals-pluto,代码行数:17,代码来源:TestCompanionPortlet.java
示例11: processEvent
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:18,代码来源:PortletTagLibraryTests_SPEC2_26_IncludeJSPEvent_event.java
示例12: processEvent
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:23,代码来源:DispatcherTests6_SPEC2_19_FwdThenIncludeServletEvent_event.java
示例13: processEvent_a
import javax.portlet.EventResponse; //导入依赖的package包/类
@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!");
}
开发者ID:apache,项目名称:portals-pluto,代码行数:22,代码来源:AnnotationPortletConfigTests_SPEC2_28_EventDeclaration.java
示例14: processEvent
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:21,代码来源:DispatcherTests_SPEC2_19_IncludeServletEvent_event.java
示例15: processEventa
import javax.portlet.EventResponse; //导入依赖的package包/类
@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");
}
}
开发者ID:apache,项目名称:portals-pluto,代码行数:17,代码来源:AnnotationPortletAppConfigOverrideTests_SPEC1_28_EventConfiguration2.java
示例16: processEventb
import javax.portlet.EventResponse; //导入依赖的package包/类
@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");
}
}
开发者ID:apache,项目名称:portals-pluto,代码行数:17,代码来源:AnnotationPortletAppConfigOverrideTests_SPEC1_28_PublicRenderParameters3.java
示例17: processEvent
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:18,代码来源:DispatcherReqRespTests4_SPEC2_19_IncludeServletEventResponse_event.java
示例18: processEvent
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:24,代码来源:DispatcherReqRespTests4_SPEC2_19_IncludeServletEventRequest_event.java
示例19: nameEvnt
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:17,代码来源:AnnotationTests_ProcessEvent_ApiEvent_event.java
示例20: processEvent
import javax.portlet.EventResponse; //导入依赖的package包/类
@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);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:24,代码来源:DispatcherReqRespTests3_SPEC2_19_IncludeJSPEventRequest_event.java
注:本文中的javax.portlet.EventResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论