1 15 package org.apache.tapestry.portlet; 16 17 import javax.portlet.ActionRequest; 18 import javax.portlet.ActionResponse; 19 20 import org.apache.hivemind.ApplicationRuntimeException; 21 import org.apache.tapestry.IRequestCycle; 22 import org.apache.tapestry.StaleSessionException; 23 import org.apache.tapestry.error.RequestExceptionReporter; 24 import org.apache.tapestry.error.StaleSessionExceptionPresenter; 25 import org.apache.tapestry.services.ServiceConstants; 26 27 31 public class PortletStaleSessionExceptionPresenter implements StaleSessionExceptionPresenter 32 { 33 private PortletRequestGlobals _globals; 34 35 private RequestExceptionReporter _requestExceptionReporter; 36 37 public void presentStaleSessionException(IRequestCycle cycle, StaleSessionException cause) 38 { 39 try 40 { 41 String markup = PortletMessages.staleSession(); 42 43 ActionRequest request = _globals.getActionRequest(); 44 45 request.getPortletSession(true).setAttribute( 46 PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE, 47 markup); 48 49 ActionResponse response = _globals.getActionResponse(); 50 51 response.setRenderParameter( 52 ServiceConstants.SERVICE, 53 PortletConstants.EXCEPTION_SERVICE); 54 } 55 catch (Exception ex) 56 { 57 60 63 _requestExceptionReporter.reportRequestException(PortletMessages 64 .errorReportingException(ex), ex); 65 66 68 throw new ApplicationRuntimeException(ex.getMessage(), ex); 69 } 70 } 71 72 public void setGlobals(PortletRequestGlobals globals) 73 { 74 _globals = globals; 75 } 76 77 public void setRequestExceptionReporter(RequestExceptionReporter requestExceptionReporter) 78 { 79 _requestExceptionReporter = requestExceptionReporter; 80 } 81 } 82 | Popular Tags |