-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portlet 2.0 (JSR 286) support in Spring MVC [SPR-4259] #8937
Comments
Juergen Hoeller commented John, in practice, I suppose window states are only really mapped differently for render requests... I can only really imagine action requests to differ per portlet mode (which is usually the differentiator between entire controllers) but not per window state - in particular since the window state may change without the action re-executing, just with a different render request issued. As far as I can imagine, action methods would - if it all - just take the window state into account for details of their processing but not for the entire action method mapping... So I was wondering whether we should support an We could be reusing Portlet 2.0's What do you think? Juergen |
John Lewis commented Here are some notes from on email on initial thoughts for Portlet 2.0 support in Spring MVC: Mapping and dispatching all the varied request types that exist in JSR 286 may well best be done via the new Controller Annotations introduced in Spring 2.5. There are some annotations specified in JSR 286, but they are only for use within GenericPortlet. We may want to do something similar in the new Controller annotation set. Our DispatcherPortlet does descent from GenericPortlet, so we can use them in our implementation if we want to. There are only three annotations for GenericPortlet:
So, while these are nice, they certainly aren't a complete set. To have good flexible annotation-based dispatcher mapping for Portlet 2.0, we should support at least the following as mapping criteria:
There is now a request attribute named LIFECYCLE_PHASE ("javax.portlet.lifecycle_phase") that will indicate the type of request: ACTION_PHASE, EVENT_PHASE, RENDER_PHASE, RESOURCE_SERVING_PHASE. This will only be present in JSR 286, so we will still have to rely on other methods (such as instanceOf checking) in the JSR 168 world. Here are some other things we could consider using for the mapping criteria and/or method parameters: PortletRequest:
ActionRequest:
EventRequest:
RenderRequest:
ResourceRequest:
|
John Lewis commented Instead of adding a number of new annotations, what about making the Then we could do things like this:
|
Juergen Hoeller commented This is exactly what I'm wondering about: Do we need special-purpose annotations here or should we try to provide a one-size-fits-all annotation that is capable of expressing everything... Keep in mind that I tend to like dedicated
Generic @(Portlet)RequestMapping attributes would be significantly more verbose here. Supporting specific stuff like action names or event names would be quite unclean there as well. Which is why I wondered whether the specific annotations are the better choice, in particular given that stuff like window states only really makes sense for render requests too... Of course,
This is very close to the present Portlet MVC approach, just annotating action/render methods explicitly. With Portlet 1.0, these would be attribute-less descriptive annotations only (with the exception of Essentially, I'd like to keep Juergen |
John Lewis commented Sorry for the slow response -- too much "real" work to do around here... Okay -- I think that all makes sense. You certainly know the internal structure of the annotations better than I do at this point and those considerations are valid. One assumption I would be careful with is just how common the pattern of mapping the portlet mode at the controller type level will be. In the past few weeks I've talked with a number of portlet developers about the annotations and this assumption was a big turn-off for them because they feel like they have some portlets complicated enough that they would not want to pull all their controller code for the view mode into a single class. Any chance of loosening this restriction on the portlet side somehow? I can see that it makes sense for HTTP paths, but I agree it is overly restrictive for portlet modes. So as to what potential portlet-specific annotations (and their optional elements) might look like, what about something like this:
|
Juergen Hoeller commented John, thanks for the feedback... No hurry at this point, but it'll be good to make up our mind before things become urgent :-) Those special annotations look good to me, except for With respect to mapping the same portlet mode onto different controllers: We can certainly aim for relaxing that. Would you like to see parameter mappings expressed there, similar to PortletModeParameterHandlerMapping? The Juergen |
John Lewis commented Juergen, Good point about the
I think I like the first one the best, but I don't have a strong preference. I think it would be nice to allow Here is another question for you. From a usage stand point, it would be cleaner if the method level annotations mentioned above were also capable of expressing request parameters in addition to their special
Instead of having to do this:
I suppose this largely gets back to my original suggestion, but with special annotations for each portlet phase instead of overloading the single Thanks! |
Juergen Hoeller commented John, I've done some revisions for the 2.5.2 release already: As for the Portlet 2.0 support, I guess I prefer dedicated So in Spring 3.0, people could keep using the general Alternatively, the special Does that sound like a plan? BTW, any updates when containers with compliant Portlet 2.0 previews will be available? Juergen |
John Lewis commented Sounds good to me. Glad to hear the changes are already in place for 2.5.2 -- I think they will help a lot with adoption of the annotations by portlet developers. I agree the "Phase" metaphor is kind of broken, although it is consistent with terminology from the specification itself. XxxMapping is certainly fine by me. Sharing the annotation attribute processing logic sounds like a good approach -- I definitely like having them be shorter. Anyway, it all definitely sounds like a good plan. The reference implementation for JSR 286 is supposed to be Pluto 2.0 -- development there is definitely slow and I have no idea when it will be released. I have been bugging some of the JSR 286 Expert Group about this lately. On the other hand, JBoss has just released a Beta 1 of their JSR 286 Portlet Container (http://labs.jboss.com/portletcontainer/). I even put up a quick blog entry about it (http://www.unicon.net/node/957). This may well be the best place to do early testing. |
Juergen Hoeller commented I'll schedule this for 3.0 M2, since we intend to do an early 3.0 M1 with core container and core MVC updates first. Actual implementation work on Portlet 2.0 support is likely going to start in June. Juergen |
Johan Eltes commented Is there any chance we could see a supported integration with Spring WebFlow + Facelets /JSF + JSR 286 that works for the MyFaces as well as RI of JSF? WebFlow + Facelets /JSF + JSR 186 only support portlet VIEW state and MyFaces, and ist still tagged "experimental". |
Patrick W. McMichael commented As you're thinking about annotation support for 3M2, I'm reminded of an issue I have even in Spring 2.5. For the most part, you try to parallel spring portlet mvc with spring web mvc. In spring web mvc, we typically can get by with a single central dispatcher servlet (i.e. front controller). Bean-name to URL mapping provides ample flexibility. With portlet mvc, however, when mapping by mode / parameter combinations, that is tougher to do. I understand that If I could get the container to do the initial render/VIEW of the portlet with a specified parameter, it would be possible to use a parameter at the type level in addition to the portlet mode to narrow down to a specific handler. As such, it would be possible to go back to using a single dispatcher. That capability outstanding, it seems I'm left with (a) configuring multiple dispatchers, and (b) going with one of the other handler mapping strategies (non-annotation based, mode, parm, or combo). Am I missing a way to have a central dispatcher portlet in a multi-portlet application? pwm |
Juergen Hoeller commented A first cut of Portlet 2.0 support is ready for M2. This includes It turned out that it would have been quite convoluted to support Portlet 2.0 and 1.0 side by side. I eventually decided to do a full update to Portlet 2.0, which significantly simplified the code in the annotation processing and in particular in the general DispatcherPortlet. I preserved full Portlet 1.0 / Spring 2.5 compatibility in the "portlet.mvc" package, with decomposed interfaces etc, since that is what 99% of the user's code typically implements or derives from. This means that, in general, user code should keep working. However, the underlying portal server / portlet container will have to be updated to Portlet API 2.0 in order to run Spring 3.0 on top of it. Juergen |
John Lewis opened SPR-4259 and commented
I've updated the description of this issue to change it to a general place to work out Portlet 2.0 (JSR 286) support for Spring MVC. I think a general approach to this larger issue will result in a resolution to the original point of this issue.
Original Description: Add support for Portlet WindowState to org.springframework.web.bind.annotation.RequestMapping
Affects: 2.5 final
25 votes, 19 watchers
The text was updated successfully, but these errors were encountered: