Hi Robbie,
thank you for your reply - I read some paper about Warp but
unfortunately I've never had the opportunity to adopt it in a
production project.
Since in some component we still need the "plain old servlet system"
we developed what I described, and since the guice-servlet still
continue existing (and evolving), it could make sense adding new small
features...
Thank you, best regards!!!
Simone

2008/8/30 Robbie Vanbrabant <[EMAIL PROTECTED]>:
> Did you try using Warp Servlet? (http://www.wideplay.com/). It doesn't force
> you to override init or anything like that.
>
> Robbie
>
> On Sat, Aug 30, 2008 at 1:45 PM, Simone Tripodi <[EMAIL PROTECTED]>
> wrote:
>>
>> Hi again,
>> I'm just writing to submit you folks a small proposal about a little
>> enhancement on servlet component:
>> I experienced reusing same servlet/filter in the same context passing
>> parameters on <init-param/> section in the web.xml and what I found
>> "boring" is overriding the methods:
>>
>> javax.servlet.http.HttpServlet#init(javax.servlet.ServletConfig
>> servletConfig)
>> javax.servlet.Filter#init(javax.servlet.FilterConfig filterConfig)
>>
>> to extracts parameters from Servlet/Filter Config and
>> ServletContext... in my mind I was looking for a more "automatic"
>> solution and Guice is what resolved my problem in this way:
>>
>> 1) I implemented 3 new annotations:
>>
>> FilterInitParam
>> ServletInitParam
>> ServletContextInitParam
>>
>> each annotation is a BindingAnnotation who can be applied to a servlet/
>> filter's field/method's param who is initialized using the Injector;
>>
>> 2) The Guice-based ServletContextListener binds all ServletContext's
>> param as ServletContextInitParam in the main Injector;
>>
>> 3) everytime a new filter/servlet is initialized, a new Injector is
>> created using the "hierarchical injector" policy (the parent injector
>> is who had already been created in the ServletContextListener),
>> binding
>> FilterConfig/ServletConfig's init parameters to Filter/
>> ServletInitParam annotations;
>>
>> 4) The HttpServlet now is just a Guice-annotated POJO where members
>> can be injected and methods can be called like the users are used to,
>> using also init parameters; a small example could be the test servlet
>> I wrote to show you:
>>
>>
>> http://code.google.com/p/injectlet/source/browse/trunk/src/test/java/com/asemantics/commons/injectlet/TestServlet.java
>>
>> I realized a Proof of Concept called "injectlet" (visible on
>> http://code.google.com/p/injectlet/), it's currently working but only
>> with String parameters; moreover, it still uses Guice 1.0.
>> The code has been released under a BSD-alike license and we are happy
>> in donating/contributing our code to you.
>>
>> I hope you find this a - even very small - nice feature to add to
>> Guice-servlet.
>> Please let me know.
>> Best regards,
>> Simone
>>
>>
>
>
> >
>



-- 
My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
My GoogleCode profile: http://code.google.com/u/simone.tripodi/
My Sourceforge: https://sourceforge.net/users/stripodi
My Picasa: http://picasaweb.google.com/simone.tripodi/
My Tube: http://www.youtube.com/user/stripodi
My Del.icio.us: http://del.icio.us/simone.tripodi

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to