| Author |
Spring Portlet MVC - Accessing Portlet-Preferences during
|
|
| iops@gmx.de 2007-11-27, 7:36 am |
| Hi!<br />
<br />
I'm developing a portlet-app with Spring Portlet MVC.<br />
<br />
I would like to use the Portlet-Preferences to configure the app.<br />
I need only one set of Preferences for all users and all pages. <br />
Only the admin should be able to edit them.<br />
<br />
For that I want to read the Portlet-Preferences during the<br />
initialization of the Spring-Context. (Done by org.springframework.web.context.ContextLoaderListener in web.xml)<br />
<br />
Any idea, how I could access the Portlet-Preferences in Spring-Initialization?<br />
I know the Portlet-Preferences are bound to requests and so to a page and a user,<br />
but these informations doesn't bother me. I just want to read the basic preferences-level<br />
valid for all users and all pages.<br />
<br />
How do others solve this issue, with Spring Portlet MVC?<br />
<br />
Regards, Herbert
| |
| Ryan Wilson 2007-11-27, 7:36 am |
| As you are ware you need the PortletRequest in order to access PortletPreferences.<br />
Since ContextLoadListener will only provide you with the ServletContext you could use context-params in the web.xml.<br />
These values will also be available in the PortletContext. <br />
<br />
Ryan<br />
<br />
SCJP & SCWCD<br />
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0<br />
<br />
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
| |
| iops@gmx.de 2007-11-27, 1:32 pm |
| Hi Ryan!<br />
<br />
Thanks for your answer!<br />
<br />
Yes, I could use the context-params in ServletContext.<br />
<br />
Am I right, that in this case, I can't use the PortletPreferences-mechanism<br />
to save the params? So I would have to implement <br />
my own preferences-logic?<br />
<br />
I would like to use the built in mechanism of portal-servers.<br />
Maybe there is a way to combine the context-params of ServletContext with PortletPreferences?<br />
<br />
Regards, Herbert
| |
| Ryan Wilson 2007-11-27, 1:32 pm |
| In order to use portletpreferences you need the request. I'm by no means a Spring expert but from what I can see in the API you do not have access to the request.<br />
<br />
You could create your own custom preference mechanism by using something like a portlet service but this add much more complexity then is really needed.<br />
Why are you opposed to using context-params?<br />
<br />
Ryan<br />
<br />
SCJP & SCWCD<br />
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0<br />
<br />
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
| |
| iops@gmx.de 2007-11-29, 1:32 pm |
| Hi Ryan!<br />
<br />
<div class="jive-quote">Why are you opposed to using context-params?</div>
<br />
I don't have that much experience with spring and portal and I'm just <br />
thinking about different ways to solve my issue. <br />
<br />
I justed liked the idea of using the built-in mechanism.
| |
| Ryan Wilson 2007-11-29, 1:32 pm |
| context-params are a built in mechanism and as stated earlier these values would also be available in the PortletContext.<br />
I think this would be the easiest solution to your problem.<br />
<p />
Ryan<br />
<br />
SCJP & SCWCD<br />
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0<br />
<br />
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
|
|
|
|