/** * Return the wrapped request object. * * @return the wrapped request */ public ClientDataRequest getRequest() { return (ClientDataRequest) super.getRequest(); }
/** * Return the wrapped request object. * * @return the wrapped request */ public EventRequest getRequest() { return (EventRequest) super.getRequest(); }
/** * Return the wrapped request object. * * @return the wrapped request */ public RenderRequest getRequest() { return (RenderRequest) super.getRequest(); }
public static <U extends PortletRequest> U unwrap(PortletRequest wrapped, Class<U> unwrapped) { while (true) { if (wrapped instanceof PortletRequestWrapper) { PortletRequestWrapper wrapper = (PortletRequestWrapper)wrapped; wrapped = wrapper.getRequest(); } else if (unwrapped.isInstance(wrapped)) { return unwrapped.cast(wrapped); } else { throw new IllegalArgumentException(); } } }
private PortletRequestImpl unwrap(PortletRequest wrapped) { while (true) { if (wrapped instanceof PortletRequestImpl) { return (PortletRequestImpl)wrapped; } else if (wrapped instanceof PortletRequestWrapper) { PortletRequestWrapper wrapper = (PortletRequestWrapper)wrapped; wrapped = wrapper.getRequest(); } else { // do we need something similar to unwrap(PortletResponse) behavior? throw new IllegalArgumentException("Cannot unwrap request: " + wrapped.getClass().getName()); } } }
protected PortletRequest getLiferayPortletRequest(PortletRequest portletRequest) { if (portletRequest instanceof PortletRequestWrapper) { PortletRequestWrapper portletRequestWrapper = (PortletRequestWrapper) portletRequest; PortletRequest wrappedPortletRequest = portletRequestWrapper.getRequest(); portletRequest = getLiferayPortletRequest(wrappedPortletRequest); } return portletRequest; }
protected PortletRequest unwrapPortletRequest(PortletRequest portletRequest) { if (portletRequest instanceof PortletRequestWrapper) { PortletRequestWrapper portletRequestWrapper = (PortletRequestWrapper) portletRequest; portletRequest = portletRequestWrapper.getRequest(); return unwrapPortletRequest(portletRequest); } else { return portletRequest; } }
protected PortletRequest getLiferayPortletRequest(PortletRequest portletRequest) { if (portletRequest instanceof PortletRequestWrapper) { PortletRequestWrapper portletRequestWrapper = (PortletRequestWrapper) portletRequest; PortletRequest wrappedPortletRequest = portletRequestWrapper.getRequest(); portletRequest = getLiferayPortletRequest(wrappedPortletRequest); } return portletRequest; }
/** * Determines whether or not the specified {@link javax.portlet.PortletRequest} is one created by Liferay Portal. If * the specified {@link javax.portlet.PortletRequest} is an instance of {@link * javax.portlet.filter.PortletRequestWrapper} then it will work with the wrapped {@link * javax.portlet.PortletRequest}. * * @param portletRequest The current {@link javax.portlet.PortletRequest}. * * @return true if the specified portletRequest was created by Pluto. */ protected boolean isPlutoPortletRequest(PortletRequest portletRequest) { if (portletRequest != null) { while (portletRequest instanceof PortletRequestWrapper) { PortletRequestWrapper portletRequestWrapper = (PortletRequestWrapper) portletRequest; portletRequest = portletRequestWrapper.getRequest(); } return portletRequest.getClass().getName().startsWith("org.apache.pluto"); } else { return false; } }
/** * Return an appropriate request object of the specified type, if available, * unwrapping the given request as far as necessary. * @param request the portlet request to introspect * @param requiredType the desired type of request object * @return the matching request object, or {@code null} if none * of that type is available */ @SuppressWarnings("unchecked") public static <T> T getNativeRequest(PortletRequest request, Class<T> requiredType) { if (requiredType != null) { if (requiredType.isInstance(request)) { return (T) request; } else if (request instanceof PortletRequestWrapper) { return getNativeRequest(((PortletRequestWrapper) request).getRequest(), requiredType); } } return null; }
/** * Return an appropriate request object of the specified type, if available, * unwrapping the given request as far as necessary. * @param request the portlet request to introspect * @param requiredType the desired type of request object * @return the matching request object, or <code>null</code> if none * of that type is available */ @SuppressWarnings("unchecked") public static <T> T getNativeRequest(PortletRequest request, Class<T> requiredType) { if (requiredType != null) { if (requiredType.isInstance(request)) { return (T) request; } else if (request instanceof PortletRequestWrapper) { return getNativeRequest(((PortletRequestWrapper) request).getRequest(), requiredType); } } return null; }
portletRequest = portletRequestWrapper.getRequest();
portletRequest = portletRequestWrapper.getRequest();
portletRequest = portletRequestWrapper.getRequest();