/** * Helper method to serve up the <code>edit</code> mode. * <p> * The default implementation throws an exception. * * @param request * the portlet request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfill the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fulfill this request due to * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem * */ protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { throw new PortletException("doEdit method not implemented"); }
public List<PortletURLGenerationListener> getPortletURLGenerationListeners(PortletApplicationDefinition app) { List<PortletURLGenerationListener> listeners = null; try { listeners = this.portletFactory.getPortletApplicationListeners((PortletApplication) app); } catch (PortletException e) { log.error("Failed to retrieve portlet application listeners: " + e.getMessage(), e); } return listeners; }
@Override protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException { try { // try to let super handle - it'll call methods annotated for // handling, the default doXYZ(), or throw if a handler for the mode // is not found super.doDispatch(request, response); } catch (PortletException e) { if (e.getCause() == null) { // No cause interpreted as 'unknown mode' - pass that trough // so that the application can handle handleRequest(request, response); } else { // Something else failed, pass on throw e; } } }
/** * Prints the stack trace of this exception to the standard error stream. */ public void printStackTrace() { this.printStackTrace(System.err); }
public void dispatch(String path) throws IOException { if (_actionRequest != null) { // dispatch only allowed for RenderRequest String msg = "Can not call dispatch() during a portlet ActionRequest"; throw new UnsupportedOperationException(msg); } PortletRequestDispatcher requestDispatcher = _portletContext.getRequestDispatcher(path); //TODO: figure out why I need named dispatcher try { requestDispatcher.include((RenderRequest) _portletRequest, (RenderResponse) _portletResponse); } catch (PortletException e) { if (e.getMessage() != null) { throw new FacesException(e.getMessage(), e); } throw new FacesException(e); } }
Throwable cause = pe.getCause();
/** * Prints the stack trace of this exception to the specified print stream. * * @param out the <code>PrintStream</code> to be used for output */ public void printStackTrace(java.io.PrintStream out) { this.printStackTrace(new java.io.PrintWriter(out, true)); }
/** * Helper method to serve up the <code>help</code> mode. * <p> * The default implementation throws an exception. * * @param request * the portlet request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfill the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fulfill this request due to * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem */ protected void doHelp(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { throw new PortletException("doHelp method not implemented"); }
LOG.warn(e.getMessage(),e); } catch (IOException e) { LOG.warn(e.getMessage(),e);
@Override public Part getPart(String name) throws IOException, ServletException { if (preq instanceof ClientDataRequest) { try { return ((ClientDataRequest) preq).getPart(name); } catch (PortletException e) { throw new ServletException(e.getCause()); } } return null; }
/** * Release resources, specifically it destroys the bridge. */ @Override public void destroy() { try { getBridge().destroy(); } catch (PortletException e) { e.printStackTrace(); } }
/** * Helper method to serve up the mandatory <code>view</code> mode. * <p> * The default implementation throws an exception. * * @param request * the portlet request * @param response * the render response * * @exception PortletException * if the portlet cannot fulfill the request * @exception UnavailableException * if the portlet is unavailable to perform render at this * time * @exception PortletSecurityException * if the portlet cannot fulfill this request due to * security reasons * @exception java.io.IOException * if the streaming causes an I/O problem * */ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException { throw new PortletException("doView method not implemented"); }
LOG.warn(e.getMessage(), e); } catch (IOException e) { LOG.warn(e.getMessage(), e);
@Override public Collection<Part> getParts() throws IOException, ServletException { if (preq instanceof ClientDataRequest) { try { return ((ClientDataRequest) preq).getParts(); } catch (PortletException e) { throw new ServletException(e.getCause()); } } return null; }
@Override public void destroy() { try { getBridge().destroy(); } catch (PortletException e) { e.printStackTrace(); } super.destroy(); }
throw new PortletException(e);
if (e.getMessage() != null) throw new FacesException(e.getMessage(), e);
/** * Prints the stack trace of this exception to the specified print writer. * * @param out the <code>PrintWriter</code> to be used for output */ public void printStackTrace(java.io.PrintWriter out) { super.printStackTrace(out); if( getCause () != null ) { out.println(); out.print("Nested Exception is "); getCause ().printStackTrace(out); } // change this when going tojdk1.4: /* super.printStackTrace(out); if( getRootCause () != null ) { out.println(); out.print("Nested Exception is "); getRootCause ().printStackTrace(out); } */ }
@Override protected void doHeaders(RenderRequest renderRequest, RenderResponse renderResponse) { try { // Streaming portals like WebSphere (as opposed to buffered portals like Liferay) will set the // javax.portlet.render_part request attribute to a value of "RENDER_HEADERS" which will cause // javax.portlet.GenericPortlet (the superclass of this class) to call this doHeaders(RenderRequest, // RenderResponse) method, but will not in turn call GenericPortlet.doDispatch(RenderRequest, // RenderResponse). That also means that that the doView(RenderRequest, RenderResponse) will not be called // in this class. So if the attribute is set, we call the Bridge.doFacesRequest(RenderRequest, // RenderResponse) method here, so that the Faces lifecycle can be run, and resources added to // h:head can be retrieved. Note that it is the responsibility of the bridge to check for this // attribute as well, because at this point the bridge should not render any JSF views to the response. Object renderPartAttribute = renderRequest.getAttribute(RenderRequest.RENDER_PART); if ((renderPartAttribute != null) && renderPartAttribute.equals(RenderRequest.RENDER_HEADERS)) { Bridge bridge = getFacesBridge(renderRequest, renderResponse); bridge.doFacesRequest(renderRequest, renderResponse); } } catch (PortletException e) { // Unfortunately the signature for GenericPortlet.doHeaders(RenderRequest, RenderResponse) does not throw // an exception, so we have no choice but to simply report any exceptions by printing the stacktrace. e.printStackTrace(); } }
throw new PortletException(e);