开发者

Basic question on Portlet url mapping

开发者 https://www.devze.com 2023-04-04 16:37 出处:网络
Why the url mapping for a portlet is not specified in portlet.xml? Unlike \'servlet-开发者_C百科mapping\' in web.xml?

Why the url mapping for a portlet is not specified in portlet.xml? Unlike 'servlet-开发者_C百科mapping' in web.xml? What is the necessity of doing it through the portal console?


The principle behind portlets is that they can be dropped onto portal pages according to the wishes of the portal site designer, or sometimes according to the wishes of the portal user themselves. If a portlet was accessed via a mapping in the portlet.xml file, then you would have to redeploy the portlet application each time you wanted a new mapping. Using a portal console allows you to place the portlet on any one of the portal pages that you create.

Using a portlet-mapping and navigating to it would also suggest that you would only be able to see that single portlet. Some portlets cooperate on a page, and so these wouldn't function properly without being deployed together on a portal page.

If a portlet was accessed directly, then what would the look and feel of the response be? Portals are generally used with themes which control the overall look and feel of the site and allow the portlets in a site to look consistent with each other. Themes often provide you with a standard header and footer etc. A combination of the Portal and the theme often provide you with page navigation too, built up from the pages that are stored within the Portal.

Also, if portlets are allowed to be invoked directly, then you could be able to bypass the Portal Container's security mechanism.

As an 'and finally', some Portlet Containers actually do let you address a portlet directly for certain specific use cases. And some Portlet Containers internally convert the deployed portlets into servlets - and these do have a servlet-mapping that can be accessed directly (although they might break as they may have expectations that the portlet container has put certain attributes in the servlet request).

So it's not a black-and-white answer. Generally speaking, if you're developing a portlet then you're doing so because you do want your portlet to be invoked from a Portal page and you do want all of the value-added stuff that comes from running within a Portal.

If you don't want these things, then maybe the question is should my application be built using portlets?

0

精彩评论

暂无评论...
验证码 换一张
取 消