What makes a portlet JSR-286 compliant?
Asked Answered
P

2

6

Does anyone have a link to a concise summary of what makes a portlet "JSR-286 compliant" vs being only "JSR-168 compliant". I've got a copy of the spec and that's anything but concise so linking the spec is not a useful answer. I've searched the web for an hour now and I've found nothing that is clear (aside from the spec, which of course requires that you read the previous spec too, and then weed out the "new features" from the "required compliance".

Particularly I've found that there's quite a bit of confusion out there on the necessity of web.xml, which appears to come from people using Liferay and not realizing that Liferay is dropping in a web.xml for them.

Do JSR-286 portlets require a web.xml file in their WAR files?

What I'd really like is something that contains one or more of the following lists:

  • Things you have to do to a JSR-168 to make it become JSR-286 compliant
  • Things you must not do, that would cause an otherwise JSR-286 compliant portlet to be considered only JSR-168.

You can leave "use the portlet-app_2_0.xsd" off the list, as I consider that part obvious.

I'm open to the answer that both lists are empty aside from the DTD/xsd for portlet.xml, and the difference is only in what the portal supports, but please back that assertion up with a link or other reference.

The reason I care is I see posts about Vaadin portlets in Liferay that imply that some features are not available for JSR-168 portlets... It may also be that some logic in Liferay switches based on which version of portlet.xml it sees, but I haven't confirmed that either so that would be interesting information too, but not the answer to my question.

Pneumonic answered 26/1, 2012 at 21:19 Comment(1)
Rereading the forum post I linked in my comment below, I've realized that although the poster is talking about "compliant portlets" he's attributing the differences to the ApplicationPortlet2. I've already extended that, so I guess I get the benefits he speaks of. However, I'm still wondering if there's any meaning to the phrase "JSR 286 compliant portlet" (aside from the backwards incompatabilities mentioned below).Pneumonic
U
3

According to this doc, but it's also mentioned in jsr286:

The JSR 286 spec(Portlet 2.0) does not break binary compatibility with JSR168(Portlet 1.0). This means that all portlets written against the Portlet 1.0 specification can run unchanged. The only exceptions to this rule are:

renderResponse.setContentType is no longer required before calling getWriter or getOutputstream. In JSR168, calling getWriter or getOutputstream without previously setting the content type resulted in an IllegalStateException.

getProtocol for included servlets / JSPs returns ‘HTTP/1.1’, In JSR168, it returned null.

So as long as your jsr168 portlet doesn't depend on the value returned by getProtocol() you're safe (ie every jsr168 portlet is a jsr286 portlet).

The posts you see seem to be logical as jsr286 is a newer spec and there are some features that make jsr268 portlet not a jsr168 portlet.

Unfathomable answered 27/1, 2012 at 16:49 Comment(4)
Yes I've seen that section of the spec, and it answers a slightly different question. That answers the question "Does the portlet run in a 286 compliant portal" However I see people talking about "286 compliant portlets" which seems to say that while 168 portlets may run, they are treated differently by liferay: vaadin.com/forum/-/message_boards/view_message/…Pneumonic
Your answer contains part of my answer, so I upvoted you for now. I'm still trying to decide if it counts as a full answer. I think part of the problem is that I had been mislead by the phraseology in other posts, and I was thinking that there was some larger difference, so there probably is not much of an answer to my question in the first place. If nobody can add to my list below I might give you credit even though it was not new information to me, but rather something I had already found but omitted from my question.Pneumonic
yeah, it's very misleading. anyway i don't think you need to care about jsr168 4 years after final release of jsr286, especially in liferay contextUnfathomable
At the time I posted this question I thought liferay might not be providing services if it decided I wasn't "286 compliant". I don't think that's an issue anymore however, I think I was just reading too much into the way that post was phrased.Pneumonic
P
1

Ok, Since I've not found anything new that distinguishes a 2.0 portlet from a 1.0 portlet (aside from using additional services and ) I'll begin the lists for my answer here.

Must Do:

  1. Conform to the 2.0 XSD for portlet.xml (xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd")

Must Not Do:

  1. Rely on getWriter throwing an exception if renderResponse.setContentType has not been called yet. (Seems unlikely anyway)
  2. Rely on getProtocol() returning null

The upshot is, if you simply convert your portlet.xml, you are now "286 compliant" unless you relied on the two items in the second list for your program flow. I can't find anything else, but if someone finds another item for these lists, please edit.

Pneumonic answered 30/1, 2012 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.