Eric,
You'll want to direct portlet development questions at the portlet-dev
list rather than the uportal-dev list probably.
First off, try to use javax.portlet.PortletRequest. If you absolutely
must access HttpServletRequest, then just googling will probably provide
a number of answers:
http://www.google.com/search?q=httpservletrequest+portlet
If you just want access to the session, use
portletRequest.getPortletSession() and use getAttribute and setAttribute
on that. Note that because you are within the portlet environment, part
of the point of the portal is to mostly sandbox off each portlet as much
as it can, so there is also stuff that was well intentioned like
portletPreferences (but even though we used that in some portlets, I
agree with Jen and others that just use JPA, Hibernate, etc. to store a
portlet's data in their own tables (and one reason is that locally we
are still using the LONG Oracle datatype for storing preferences which
keeps us from using LIKE queries for example, and the DBAs haven't
wanted to assist with that migration of data, and we've just put it off
for now...).
If it is a matter of handling forms and actions within the portlet and
their related request params, etc., then you shouldn't normally need
access to it. Look at the variety of examples here:
https://www.ja-sig.org/svn/portlets/
https://www.ja-sig.org/svn/sandbox/
Some of those are older, and some might not work.
Spring's spring-webmvc-portlet stuff in Spring 2.5.6 might be the first
thing to look at just to get familiar with handling forms, requests, and
request routing.
The biggest pain most portlet developers might run into is trying to
figure out how to work around having more than the 3 main views in
portlets which are view, edit, and help. The average way to do this is
via PortletModeParameterHandlerMapping which can be hard to setup
because some examples out there are missing info. Here is an example
from MailPortlet:
<!-- ========================= VIEW DEFINITIONS
========================= -->
<!-- Use ResourceBundleViewResolver to configure views in the
views.properties file -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="cache" value="true"/>
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- ========================= CONTROLLERS ========================= -->
<bean id="parameterMappingInterceptor"
class="org.springframework.web.portlet.handler.ParameterMappingInterceptor"/>
<!-- 1st in handling chain. If this doesn't handle it,
portletModeHandlerMapping will -->
<bean id="portletModeParameterHandlerMapping"
class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping">
<property name="order" value="1"/>
<property name="interceptors">
<list>
<ref bean="parameterMappingInterceptor"/>
</list>
</property>
<property name="portletModeParameterMap">
<map>
<entry key="edit"> <!-- portlet mode: edit -->
<map>
<entry key="prefs">
<ref bean="mailPortletConfigurationController"/>
</entry>
<entry key="resetprefs">
<ref bean="resetPreferencesController"/>
</entry>
<entry key="createmailaccount">
<ref bean="createMailAccountController"/>
</entry>
<entry key="updatemailaccount">
<ref bean="updateMailAccountController"/>
</entry>
<entry key="deletemailaccount">
<ref bean="deleteMailAccountController"/>
</entry>
</map>
</entry>
</map>
</property>
</bean>
<!-- 2nd in handling chain. If portletModeHandlerMapping doesn't handle
it, this will -->
<bean id="portletModeHandlerMapping"
class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
<property name="order" value="2"/>
<property name="portletModeMap">
<map>
<entry key="edit"> <!-- portlet mode: view -->
<ref bean="mailPortletConfigurationController"/>
</entry>
<entry key="view"> <!-- portlet mode: view -->
<ref bean="mailPortletController"/>
</entry>
<entry key="help">
<ref bean="mailPortletController"/>
</entry>
</map>
</property>
</bean>
There's also Spring Web Flow 2 that you might consider (I think that
Eric Dalquist used it in of the uPortal portlets- I forget which.):
http://static.springsource.org/spring-webflow/docs/2.0.x/reference/html/ch13.html
Know it doesn't answer your question specifically, but hopefully this helps.
HTH,
Gary
Domazlicky, Eric wrote:
I know this probably isn’t a JSR-168 standard thing but is there a way
to get access to a HttpServletRequest from within a uPortal Portlet?
This seems to work in other portals but uPortal does not have this
attribute:
HttpServletRequest srvReq =(javax.servlet.http.HttpServletRequest)
request.getAttribute("javax.portlet.portletc.httpServletRequest");
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/uportal-dev
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/uportal-dev