dev@glassfish.java.net

Re: Webtier APIs for GlassFish Embedded

From: Jerome Dochez <Jerome.Dochez_at_Sun.COM>
Date: Tue, 10 Feb 2009 09:20:52 -0800

On Feb 9, 2009, at 4:13 PM, Rajiv Mordani wrote:

>
>
> Jan Luehe wrote:
>> On 02/06/09 09:25, Jerome Dochez wrote:
>>> I could not resist looking at the APIs and it seems very similar
>>> to the XML inspired way of organization the metadata, wouldn't be
>>> more java centric to propose APIs like :
>>>
>>> Interface Contect {
>>>
>>> public Servlet addServlet(String name, Class<? extends
>>> javax.servlet.Servlet> servletClass);
>>
>> Would it make more sense to pass a Servlet instance, rather
>> than a Servlet Class object?
>
> If you pass an instance how would you handle resource injection?

that was my reason for basically using a class. If we authorize (maybe
through a different API) passing an instance, the state of that
instance need to be clearly defined (constructed, injected ?, init
called ?). What about if you pass the same instance twice, blah blah...

>
>
>>
>> This would give developers more flexibility in how the Servlet is
>> constructed, rather than limiting them to a zero-arg constructor
>> (which would be the case when passing in a Class object).
>>
>> To address Jeanfrancois' comment about missing listener support, i
>> think we
>> should define methods on Context for adding each of the following
>> listener types (which may already be declared in web.xml):
>>
>> javax.servlet.ServletContextAttributeListener
>> javax.servlet.ServletRequestAttributeListener
>> javax.servlet.ServletRequestListener
>> javax.servlet.ServletContextListener
>> javax.servlet.http.HttpSessionAttributeListener
>> javax.servlet.http.HttpSessionListener
>>
>> Again, I suggest we pass listener instances, instead of the
>> underlying
>> Class objects.
>
> Yes sounds good. I will add it to the API and try and generate the
> javadocs and send it out.
>
> - Rajiv
>
>>
>>
>> Jan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>