jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] Re: Re: 1012 ExternalContext.getApplicationContextPath()

From: Neil Griffin <neil.griffin_at_portletfaces.org>
Date: Thu, 20 Dec 2012 11:46:54 -0500

On Dec 19, 2012, at 4:52 PM, Manfred Riem <manfred.riem_at_oracle.com> wrote:

> What would it point to for the Portlet case?
>
> If it is not available in the Portlet scenario why are we pulling it up for the Servlet case?
>
> Is getContext() and then the appropriate methods on the ServletContext not good enough?

For the portlet case, there are two options (that I can think of):

1) Have the portlet bridge register a ServletContextListener and remember the value of ServletContext.getContextPath() for later reference.

2) Utilize the factory pattern for creating FacesContext and ExternalContext instances at startup time. That would enable portlet bridge factory decorators to intercept the specified ServletContext and remember the value of ServletContext.getContextPath() for subsequent calls to the factories at request time. That would eliminate the need for a portlet bridge ServletContextListener.

Perhaps there are other ideas as well. But right now I lean towards #2.

>
> Manfred
>
> On 12/19/2012 3:44 PM, Edward Burns wrote:
>>>>>>> On Tue, 18 Dec 2012 16:56:58 -0500, Neil Griffin<neil.griffin_at_portletfaces.org> said:
>> [...]
>>
>> NG> Perhaps it would be more straightforward (from the API perspective)
>> NG> if FacesContextFactory and/or ExternalContextFactory had methods for
>> NG> acquiring startup instances?
>>
>> I really like the current arrangement of providing a unified way to
>> access it whether it's startup time or request processing time.

I understand better now, thanks. Kindly ask that you would consider the factory pattern for creation of instances during startup, as I think the current mechanism used by Mojarra and MyFaces might be un-decoratable.

>>
>> NG> If not, then given the current startup design of MyFaces and
>> NG> Mojarra, is it safe to assume that the portlet bridge implementation
>> NG> of ExternalContext.getApplicationContextPath() would only be called
>> NG> during a request?
>>
>> If we specify it that way, it will be that way. It is currently
>> specified so that getApplicationContextPath() may be called at startup
>> time. Note that there is no "Portlet:" text in the javadoc for
>> ExternalContext. I'd like to keep it that way. I could see a need for
>> it in some kinds of extensions to JSF, so I'd rather not restrict it.

Agreed, I would like to avoid "Portlet:" text in there too if possible.

-- Neil

>>
>> Ed
>>