AddlPortletTests_SPEC2_5_EventHandling_event.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:portals-pluto 作者:
@Override
public void processEvent(EventRequest portletReq, EventResponse portletResp)
    throws PortletException, IOException {

  portletResp.setRenderParameters(portletReq);

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

  Event event = portletReq.getEvent();
  String qName = event.getName();
  if (qName.equals("AddlPortletTests_SPEC2_5_EventHandling_exception4")) {
    /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception4 */
    /* Details: "If the portlet throws an PortletException in */
    /* processEvent, all operations on the EventResponse, including set */
    /* events, must be ignored" */
    portletResp.setRenderParameter("tr0", "true");
    portletReq.getPortletSession().setAttribute(
        RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_portletException", "true",
        APPLICATION_SCOPE);
    throw new PortletException(
        "PortletException from V2AddlPortletTests_SPEC2_5_EventHandling_exception4");
  } else if (qName.equals("AddlPortletTests_SPEC2_5_EventHandling_exception5")) {
    /* TestCase: V2AddlPortletTests_SPEC2_5_EventHandling_exception5 */
    /* Details: "If the portlet throws a RuntimeException in */
    /* processEvent, all operations on the EventResponse, including set */
    /* events, must be ignored" */
    portletResp.setRenderParameter("tr1", "true");
    portletReq.getPortletSession().setAttribute(
        RESULT_ATTR_PREFIX + "AddlPortletTests_SPEC2_5_EventHandling_runtimeException", "true",
        APPLICATION_SCOPE);
    throw new RuntimeException(
        "RuntimeException from V2AddlPortletTests_SPEC2_5_EventHandling_exception5");
  }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号