org.displaytag.portlet
public class: PortletRequestHelper [javadoc |
source]
java.lang.Object
org.displaytag.portlet.PortletRequestHelper
All Implemented Interfaces:
RequestHelper
Reads parameters and generates URLs using javax.portlet APIs. The
javax.servlet.jsp.PageContext passed into
the constructor must provide the
javax.portlet.PortletRequest via an attribute named
#JAVAX_PORTLET_REQUEST and
javax.portlet.RenderResponse via an attribute named
#JAVAX_PORTLET_RESPONSE .
If the pluto portlet container is being used these objects should be setup appropriatly already.
- author:
Eric - Dalquist dalquist@gmail.com
- version:
$ - Id: PortletRequestHelper.java 996 2006-01-06 15:34:08Z fgiust $
| Field Summary |
|---|
| public static final String | JAVAX_PORTLET_RESPONSE | |
| public static final String | JAVAX_PORTLET_REQUEST | |
| Constructor: |
public PortletRequestHelper(PageContext pageContext) {
if (pageContext == null)
{
throw new IllegalArgumentException("pageContext may not be null");
}
this.portletRequest = (PortletRequest) pageContext.findAttribute(JAVAX_PORTLET_REQUEST);
if (this.portletRequest == null)
{
throw new IllegalStateException("A PortletRequest could not be found in the PageContext for the key='"
+ JAVAX_PORTLET_REQUEST
+ "'");
}
this.renderResponse = (RenderResponse) pageContext.findAttribute(JAVAX_PORTLET_RESPONSE);
if (this.portletRequest == null)
{
throw new IllegalStateException("A RenderResponse could not be found in the PageContext for the key='"
+ JAVAX_PORTLET_RESPONSE
+ "'");
}
}
Creates a new request helper for the specified PageContext. Retrieves the PortletRequest and RenderResponse from
the PageContext. Parameters:
pageContext - Current JSP context.
Throws:
IllegalStateException - If the PortletRequest or RenderResponse are not found in the PageContext.
|
| Method from org.displaytag.portlet.PortletRequestHelper Detail: |
public Href getHref() {
final PortletHref href = new PortletHref(this.portletRequest, this.renderResponse);
href.setParameterMap(this.portletRequest.getParameterMap());
if (this.portletRequest.isSecure())
{
href.setRequestedSecure(true);
}
return href;
}
|
public Integer getIntParameter(String key) {
try
{
return new Integer(this.getParameter(key));
}
catch (NumberFormatException nfe)
{
return null;
}
}
|
public String getParameter(String key) {
return this.portletRequest.getParameter(key);
}
|
public Map getParameterMap() {
return this.portletRequest.getParameterMap();
}
|