DWR and Guice

View: New views
9 Messages — Rating Filter:   Alert me  

DWR and Guice

by tpeierls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So has anyone else been thinking about how to integrate DWR and Guice? I have!

Here's what I have so far:

  • an abstract class GuiceServletContextListener that extends AbstractModule, creates an Injector based on the results of its own configuration, and stores that Injector in the servlet context;
  • a GuiceCreator class that uses the Injector stored in the servlet context to getInstance of the appropriate class; and
  • a web.xml that installs a concrete extension of GuiceServletContextListener, adds the GuiceFilter to the filter chain, and uses a customConfigurator extending FluentConfigurator to configure the DwrServlet.

My sample DWR webapp uses no XML beyond web.xml, which seems to be the Guice Grail.

The slightly odd thing is that @RemoteProxy classes use DWR scoping to decide when they should be created, but everything injected into them uses Guice scopes.

--tim


Re: DWR and Guice

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Cool - so would you like to submit some classes for Guice support?

Joe.

On 3/21/07, tpeierls <tim@...> wrote:
So has anyone else been thinking about how to integrate DWR and Guice? I have!

Here's what I have so far:

  • an abstract class GuiceServletContextListener that extends AbstractModule, creates an Injector based on the results of its own configuration, and stores that Injector in the servlet context;
  • a GuiceCreator class that uses the Injector stored in the servlet context to getInstance of the appropriate class; and
  • a web.xml that installs a concrete extension of GuiceServletContextListener, adds the GuiceFilter to the filter chain, and uses a customConfigurator extending FluentConfigurator to configure the DwrServlet.

My sample DWR webapp uses no XML beyond web.xml, which seems to be the Guice Grail.

The slightly odd thing is that @RemoteProxy classes use DWR scoping to decide when they should be created, but everything injected into them uses Guice scopes.

--tim


View this message in context: DWR and Guice
Sent from the DWR - Dev mailing list archive at Nabble.com.



Re: DWR and Guice

by tpeierls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe Walker-3 wrote:
Cool - so would you like to submit some classes for Guice support?
Yes, I would! :-)

Here they are. Not sure what to do about copyright notices and @author tags. Currently the former say "Copyright 2007 Tim Peierls" and there are none of the latter. But I'm happy to change them to whatever Joe says.

The code requires 2.0.rc3 or better (because it uses the most recent FluentConfigurator).

--tim

Re: DWR and Guice

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Cool.
I've checked it into the java5 folder.
Shall I give you CVS commit so you can maintain it?
http://getahead.org/dwr/development/contributor

Joe.

On 3/28/07, tpeierls <tim@...> wrote:


Joe Walker-3 wrote:
>
> Cool - so would you like to submit some classes for Guice support?
>

Yes, I would! :-)

http://dev.priorartisans.com/tim/dwr-guice/index.html Here  they are. Not
sure what to do about copyright notices and @author tags. Currently the
former say "Copyright 2007 Tim Peierls" and there are none of the latter.
But I'm happy to change them to whatever Joe says.

The code requires 2.0.rc3 or better (because it uses the most recent
FluentConfigurator).

--tim

--
View this message in context: http://www.nabble.com/DWR-and-Guice-tf3444191.html#a9718406
Sent from the DWR - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...



Re: DWR and Guice

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

On @author tags - please could you copy the style used elsewhere.
I'm not too fussed about what happens for the header comment.
The advantage of consistent @author is that if we need to contact the authors for some copyright reason, we can script it easily.

Joe.

On 3/29/07, Joe Walker <joe@...> wrote:

Cool.
I've checked it into the java5 folder.
Shall I give you CVS commit so you can maintain it?
http://getahead.org/dwr/development/contributor

Joe.


On 3/28/07, tpeierls <tim@...> wrote:


Joe Walker-3 wrote:
>
> Cool - so would you like to submit some classes for Guice support?
>

Yes, I would! :-)

http://dev.priorartisans.com/tim/dwr-guice/index.html Here  they are. Not
sure what to do about copyright notices and @author tags. Currently the
former say "Copyright 2007 Tim Peierls" and there are none of the latter.
But I'm happy to change them to whatever Joe says.

The code requires 2.0.rc3 or better (because it uses the most recent
FluentConfigurator).

--tim

--
View this message in context: http://www.nabble.com/DWR-and-Guice-tf3444191.html#a9718406
Sent from the DWR - Dev mailing list archive at Nabble.com .

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...




Re: DWR and Guice

by tpeierls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK, I'll make a pass for the @author tags and general style uniformity. And yes, please, to CVS commit.

I'd like to add Scopes to the DWR-Guice package to match the DWR scopes, so we'd have a type-safe way to put a remoted object in a DWR scope at bind time (and we could use scope annotations consistently instead of the scope parameter of @RemoteProxy).

If anyone has other ideas please let me know.

--tim

Joe Walker-3 wrote:
On @author tags - please could you copy the style used elsewhere.
I'm not too fussed about what happens for the header comment.
The advantage of consistent @author is that if we need to contact the
authors for some copyright reason, we can script it easily.

> I've checked it into the java5 folder.
> Shall I give you CVS commit so you can maintain it?
> http://getahead.org/dwr/development/contributor
>
> Joe.
>
> On 3/28/07, tpeierls <tim@peierls.net> wrote:
> > http://dev.priorartisans.com/tim/dwr-guice/index.html Here  they are.
> > Not sure what to do about copyright notices and @author tags. Currently the
> > former say "Copyright 2007 Tim Peierls" and there are none of the latter.
> > But I'm happy to change them to whatever Joe says.
> >
> > The code requires 2.0.rc3 or better (because it uses the most recent FluentConfigurator).

Re: DWR and Guice

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


What's your java.net ID?

Joe.

On 3/29/07, tpeierls <tim@... > wrote:

OK, I'll make a pass for the @author tags and general style uniformity. And
yes, please, to CVS commit.

I'd like to add Scopes to the DWR-Guice package to match the DWR scopes, so
we'd have a type-safe way to put a remoted object in a DWR scope at bind
time (and we could use scope annotations consistently instead of the scope
parameter of @RemoteProxy).

If anyone has other ideas please let me know.

--tim


Joe Walker-3 wrote:

>
> On @author tags - please could you copy the style used elsewhere.
> I'm not too fussed about what happens for the header comment.
> The advantage of consistent @author is that if we need to contact the
> authors for some copyright reason, we can script it easily.
>
>> I've checked it into the java5 folder.
>> Shall I give you CVS commit so you can maintain it?
>> http://getahead.org/dwr/development/contributor
>>
>> Joe.
>>
>> On 3/28/07, tpeierls <tim@...> wrote:
>> > http://dev.priorartisans.com/tim/dwr-guice/index.html Here  they are.
>> > Not sure what to do about copyright notices and @author tags. Currently
>> the
>> > former say "Copyright 2007 Tim Peierls" and there are none of the
>> latter.
>> > But I'm happy to change them to whatever Joe says.
>> >
>> > The code requires 2.0.rc3 or better (because it uses the most recent
>> FluentConfigurator).
>

--
View this message in context: http://www.nabble.com/DWR-and-Guice-tf3444191.html#a9733347
Sent from the DWR - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...



Re: DWR and Guice

by tpeierls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

tpeierls

Joe Walker-3 wrote:
What's your java.net ID?

Re: DWR and Guice

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Done.

On 3/29/07, tpeierls <tim@...> wrote:

tpeierls


Joe Walker-3 wrote:
>
> What's your java.net ID?
>
>
>

--
View this message in context: http://www.nabble.com/DWR-and-Guice-tf3444191.html#a9738905
Sent from the DWR - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


LightInTheBox - Buy quality products at wholesale price