You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jamie Swain <jp...@gmail.com> on 2009/04/02 03:03:04 UTC

setting up REST API that can respond to requests alongside Wicket

I'm sorry this isn't directly a Wicket question, but I thought you
guys in here might be able to help :).  What I'm doing is building a
Wicket-based web app, and I would additionally like to offer some data
to other sites/clients in the form of an HTTP-REST API (that responds
to simple GET and POST requests and returns XML and/or JSON).  (It
would be something that works kind of like the Twitter API
http://apiwiki.twitter.com/REST+API+Documentation).

My question is what is the best way to access the objects and classes
that Wicket can see and call methods on from my REST Web Service API.

Do I create a separate servlet running the the same Tomcat Server that
can call somehow objects in the Wicket realm?

Or is there a class I can implement within my Wicket-based app that
can respond to these REST requests?  It would probably be most
feasible for now to have it all integrated into the same app.

I have been working with Wicket for a while, and feel pretty
comfortable with it, but I don't really have any experience working
with servlets, so I'd really appreciate a little guidance on this.

I appreciate the help guys!
Thanks,
Jamie

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: setting up REST API that can respond to requests alongside Wicket

Posted by jpswain <jp...@gmail.com>.

Casper: Thanks that is helpful :)

Igor: Sorry again for not being clear.  What I meant by Wicket DAO's was the
Dao's I have written and are currently used within my app, which happens to
be Wicket-based, and which also uses Guice and Hibernate.  Basically, "the
DAO's that are working within the space of my existing app."

The reason I asked was because if I set up my REST stuff in a separate
Servlet, then I was wondering if the objects in that app would be able to
call methods on the objects that are living within the classloader of the
Wicket-based app.

So, looking at this other Thread that Casper pointed me to: 
http://www.nabble.com/Wicket-and-%28or%29-restlet-ts22822162.html
it sounds like Jersey might work well for what I'm trying to do.  
So my question is, should I write my Jersey-based classes inside of my
existing Wicket-based webapp and just have them invoked from a separate
servlet?
It seems like that would work since my wicket stuff will be mapped to /* and
my REST stuff will be mapped to /service/*


Thanks guys,
Jamie


Casper Bang-3 wrote:
> 
> Allow me to jump in, since it kinda touches on a related subject we
> discussed earlier today:
> http://www.nabble.com/Wicket-and-(or)-restlet-tt22822162.html#a22833918
> 
> What I understand from Jamie is to do kind of the reverse from what I
> wanted, that is, hook into the raw data Wicket is using to serve Ajax
> components etc. and use it to serve public REST requests. If this was
> possible, I would no longer be using Jersey to serve occasional web
> content
> but rather use Wicket to serve occasional REST requests.
> 
> If I have completely misunderstood you Jamie and is thus stealing your
> thread, I apologize.
> 
> /Casper
> 
> 
> On Thu, Apr 2, 2009 at 5:01 AM, Igor Vaynberg
> <ig...@gmail.com>wrote:
> 
>> yeah, you can map wicket to /* and services to /services/*. wicket
>> filter will let requests that do not map fallthrough, just make sure
>> you have no wicket mounts that are on /services/*.
>>
>> i still dont get what you mean by wicket daos. wicket has no daos. if
>> you put your services handling into the same webapp then it will all
>> live in the same classloader.
>>
>> if you were using spring or guice then wicket would obtain the daos
>> from spring or guice inside its components, and the same would happen
>> inside your services classes.
>>
>> if you deploy this as a single webapp then the shared space is the
>> servlet context which every filter and servlet can access.
>>
>> -igor
>>
>> On Wed, Apr 1, 2009 at 7:51 PM, jpswain <jp...@gmail.com> wrote:
>> >
>> > Igor,
>> >
>> > Thanks for the response.  Sorry, I wasn't very clear when I said
>> "wicket
>> > realm."
>> >
>> > What I meant was to be able to access the Wicket DAO's and stuff like
>> that.
>> > Maybe what I am talking about is only directly possible with objects
>> that
>> > share the same classloader?
>> >
>> > Would the best way to offload the incoming REST requests with RMI?
>> >
>> > Also, would it be possible to map wicket to /* and services to
>> /services/*?
>> >
>> > Finally, thanks for everything you and all the other Wicket developers
>> do
>> to
>> > advance Wicket and make it the best Web Framework on the planet!!  It's
>> > really a pleasure to work with :)
>> >
>> > Jamie
>> >
>> >
>> > igor.vaynberg wrote:
>> >>
>> >> map your wicket filter to /app/* and your services filter/servlet to
>> >> /services/*
>> >>
>> >> im not sure what you mean by services impl calling objects in the
>> >> wicket realm - all that is or should be in the wicket realm are ui
>> >> objects you wont have a need to reuse in your services..
>> >>
>> >> -igor
>> >>
>> >> On Wed, Apr 1, 2009 at 6:03 PM, Jamie Swain <jp...@gmail.com> wrote:
>> >>> I'm sorry this isn't directly a Wicket question, but I thought you
>> >>> guys in here might be able to help :).  What I'm doing is building a
>> >>> Wicket-based web app, and I would additionally like to offer some
>> data
>> >>> to other sites/clients in the form of an HTTP-REST API (that responds
>> >>> to simple GET and POST requests and returns XML and/or JSON).  (It
>> >>> would be something that works kind of like the Twitter API
>> >>> http://apiwiki.twitter.com/REST+API+Documentation).
>> >>>
>> >>> My question is what is the best way to access the objects and classes
>> >>> that Wicket can see and call methods on from my REST Web Service API.
>> >>>
>> >>> Do I create a separate servlet running the the same Tomcat Server
>> that
>> >>> can call somehow objects in the Wicket realm?
>> >>>
>> >>> Or is there a class I can implement within my Wicket-based app that
>> >>> can respond to these REST requests?  It would probably be most
>> >>> feasible for now to have it all integrated into the same app.
>> >>>
>> >>> I have been working with Wicket for a while, and feel pretty
>> >>> comfortable with it, but I don't really have any experience working
>> >>> with servlets, so I'd really appreciate a little guidance on this.
>> >>>
>> >>> I appreciate the help guys!
>> >>> Thanks,
>> >>> Jamie
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >>> For additional commands, e-mail: users-help@wicket.apache.org
>> >>>
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >>
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/setting-up-REST-API-that-can-respond-to-requests-alongside-Wicket-tp22839000p22839851.html
>> > Sent from the Wicket - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/setting-up-REST-API-that-can-respond-to-requests-alongside-Wicket-tp22839000p22855385.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: setting up REST API that can respond to requests alongside Wicket

Posted by Casper Bang <ca...@jbr.dk>.
Allow me to jump in, since it kinda touches on a related subject we
discussed earlier today:
http://www.nabble.com/Wicket-and-(or)-restlet-tt22822162.html#a22833918

What I understand from Jamie is to do kind of the reverse from what I
wanted, that is, hook into the raw data Wicket is using to serve Ajax
components etc. and use it to serve public REST requests. If this was
possible, I would no longer be using Jersey to serve occasional web content
but rather use Wicket to serve occasional REST requests.

If I have completely misunderstood you Jamie and is thus stealing your
thread, I apologize.

/Casper


On Thu, Apr 2, 2009 at 5:01 AM, Igor Vaynberg <ig...@gmail.com>wrote:

> yeah, you can map wicket to /* and services to /services/*. wicket
> filter will let requests that do not map fallthrough, just make sure
> you have no wicket mounts that are on /services/*.
>
> i still dont get what you mean by wicket daos. wicket has no daos. if
> you put your services handling into the same webapp then it will all
> live in the same classloader.
>
> if you were using spring or guice then wicket would obtain the daos
> from spring or guice inside its components, and the same would happen
> inside your services classes.
>
> if you deploy this as a single webapp then the shared space is the
> servlet context which every filter and servlet can access.
>
> -igor
>
> On Wed, Apr 1, 2009 at 7:51 PM, jpswain <jp...@gmail.com> wrote:
> >
> > Igor,
> >
> > Thanks for the response.  Sorry, I wasn't very clear when I said "wicket
> > realm."
> >
> > What I meant was to be able to access the Wicket DAO's and stuff like
> that.
> > Maybe what I am talking about is only directly possible with objects that
> > share the same classloader?
> >
> > Would the best way to offload the incoming REST requests with RMI?
> >
> > Also, would it be possible to map wicket to /* and services to
> /services/*?
> >
> > Finally, thanks for everything you and all the other Wicket developers do
> to
> > advance Wicket and make it the best Web Framework on the planet!!  It's
> > really a pleasure to work with :)
> >
> > Jamie
> >
> >
> > igor.vaynberg wrote:
> >>
> >> map your wicket filter to /app/* and your services filter/servlet to
> >> /services/*
> >>
> >> im not sure what you mean by services impl calling objects in the
> >> wicket realm - all that is or should be in the wicket realm are ui
> >> objects you wont have a need to reuse in your services..
> >>
> >> -igor
> >>
> >> On Wed, Apr 1, 2009 at 6:03 PM, Jamie Swain <jp...@gmail.com> wrote:
> >>> I'm sorry this isn't directly a Wicket question, but I thought you
> >>> guys in here might be able to help :).  What I'm doing is building a
> >>> Wicket-based web app, and I would additionally like to offer some data
> >>> to other sites/clients in the form of an HTTP-REST API (that responds
> >>> to simple GET and POST requests and returns XML and/or JSON).  (It
> >>> would be something that works kind of like the Twitter API
> >>> http://apiwiki.twitter.com/REST+API+Documentation).
> >>>
> >>> My question is what is the best way to access the objects and classes
> >>> that Wicket can see and call methods on from my REST Web Service API.
> >>>
> >>> Do I create a separate servlet running the the same Tomcat Server that
> >>> can call somehow objects in the Wicket realm?
> >>>
> >>> Or is there a class I can implement within my Wicket-based app that
> >>> can respond to these REST requests?  It would probably be most
> >>> feasible for now to have it all integrated into the same app.
> >>>
> >>> I have been working with Wicket for a while, and feel pretty
> >>> comfortable with it, but I don't really have any experience working
> >>> with servlets, so I'd really appreciate a little guidance on this.
> >>>
> >>> I appreciate the help guys!
> >>> Thanks,
> >>> Jamie
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >>
> >
> > --
> > View this message in context:
> http://www.nabble.com/setting-up-REST-API-that-can-respond-to-requests-alongside-Wicket-tp22839000p22839851.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: setting up REST API that can respond to requests alongside Wicket

Posted by Igor Vaynberg <ig...@gmail.com>.
yeah, you can map wicket to /* and services to /services/*. wicket
filter will let requests that do not map fallthrough, just make sure
you have no wicket mounts that are on /services/*.

i still dont get what you mean by wicket daos. wicket has no daos. if
you put your services handling into the same webapp then it will all
live in the same classloader.

if you were using spring or guice then wicket would obtain the daos
from spring or guice inside its components, and the same would happen
inside your services classes.

if you deploy this as a single webapp then the shared space is the
servlet context which every filter and servlet can access.

-igor

On Wed, Apr 1, 2009 at 7:51 PM, jpswain <jp...@gmail.com> wrote:
>
> Igor,
>
> Thanks for the response.  Sorry, I wasn't very clear when I said "wicket
> realm."
>
> What I meant was to be able to access the Wicket DAO's and stuff like that.
> Maybe what I am talking about is only directly possible with objects that
> share the same classloader?
>
> Would the best way to offload the incoming REST requests with RMI?
>
> Also, would it be possible to map wicket to /* and services to /services/*?
>
> Finally, thanks for everything you and all the other Wicket developers do to
> advance Wicket and make it the best Web Framework on the planet!!  It's
> really a pleasure to work with :)
>
> Jamie
>
>
> igor.vaynberg wrote:
>>
>> map your wicket filter to /app/* and your services filter/servlet to
>> /services/*
>>
>> im not sure what you mean by services impl calling objects in the
>> wicket realm - all that is or should be in the wicket realm are ui
>> objects you wont have a need to reuse in your services..
>>
>> -igor
>>
>> On Wed, Apr 1, 2009 at 6:03 PM, Jamie Swain <jp...@gmail.com> wrote:
>>> I'm sorry this isn't directly a Wicket question, but I thought you
>>> guys in here might be able to help :).  What I'm doing is building a
>>> Wicket-based web app, and I would additionally like to offer some data
>>> to other sites/clients in the form of an HTTP-REST API (that responds
>>> to simple GET and POST requests and returns XML and/or JSON).  (It
>>> would be something that works kind of like the Twitter API
>>> http://apiwiki.twitter.com/REST+API+Documentation).
>>>
>>> My question is what is the best way to access the objects and classes
>>> that Wicket can see and call methods on from my REST Web Service API.
>>>
>>> Do I create a separate servlet running the the same Tomcat Server that
>>> can call somehow objects in the Wicket realm?
>>>
>>> Or is there a class I can implement within my Wicket-based app that
>>> can respond to these REST requests?  It would probably be most
>>> feasible for now to have it all integrated into the same app.
>>>
>>> I have been working with Wicket for a while, and feel pretty
>>> comfortable with it, but I don't really have any experience working
>>> with servlets, so I'd really appreciate a little guidance on this.
>>>
>>> I appreciate the help guys!
>>> Thanks,
>>> Jamie
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/setting-up-REST-API-that-can-respond-to-requests-alongside-Wicket-tp22839000p22839851.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: setting up REST API that can respond to requests alongside Wicket

Posted by jpswain <jp...@gmail.com>.
Igor,

Thanks for the response.  Sorry, I wasn't very clear when I said "wicket
realm."  

What I meant was to be able to access the Wicket DAO's and stuff like that. 
Maybe what I am talking about is only directly possible with objects that
share the same classloader?

Would the best way to offload the incoming REST requests with RMI?

Also, would it be possible to map wicket to /* and services to /services/*?

Finally, thanks for everything you and all the other Wicket developers do to
advance Wicket and make it the best Web Framework on the planet!!  It's
really a pleasure to work with :)

Jamie


igor.vaynberg wrote:
> 
> map your wicket filter to /app/* and your services filter/servlet to
> /services/*
> 
> im not sure what you mean by services impl calling objects in the
> wicket realm - all that is or should be in the wicket realm are ui
> objects you wont have a need to reuse in your services..
> 
> -igor
> 
> On Wed, Apr 1, 2009 at 6:03 PM, Jamie Swain <jp...@gmail.com> wrote:
>> I'm sorry this isn't directly a Wicket question, but I thought you
>> guys in here might be able to help :).  What I'm doing is building a
>> Wicket-based web app, and I would additionally like to offer some data
>> to other sites/clients in the form of an HTTP-REST API (that responds
>> to simple GET and POST requests and returns XML and/or JSON).  (It
>> would be something that works kind of like the Twitter API
>> http://apiwiki.twitter.com/REST+API+Documentation).
>>
>> My question is what is the best way to access the objects and classes
>> that Wicket can see and call methods on from my REST Web Service API.
>>
>> Do I create a separate servlet running the the same Tomcat Server that
>> can call somehow objects in the Wicket realm?
>>
>> Or is there a class I can implement within my Wicket-based app that
>> can respond to these REST requests?  It would probably be most
>> feasible for now to have it all integrated into the same app.
>>
>> I have been working with Wicket for a while, and feel pretty
>> comfortable with it, but I don't really have any experience working
>> with servlets, so I'd really appreciate a little guidance on this.
>>
>> I appreciate the help guys!
>> Thanks,
>> Jamie
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/setting-up-REST-API-that-can-respond-to-requests-alongside-Wicket-tp22839000p22839851.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: setting up REST API that can respond to requests alongside Wicket

Posted by Igor Vaynberg <ig...@gmail.com>.
map your wicket filter to /app/* and your services filter/servlet to /services/*

im not sure what you mean by services impl calling objects in the
wicket realm - all that is or should be in the wicket realm are ui
objects you wont have a need to reuse in your services..

-igor

On Wed, Apr 1, 2009 at 6:03 PM, Jamie Swain <jp...@gmail.com> wrote:
> I'm sorry this isn't directly a Wicket question, but I thought you
> guys in here might be able to help :).  What I'm doing is building a
> Wicket-based web app, and I would additionally like to offer some data
> to other sites/clients in the form of an HTTP-REST API (that responds
> to simple GET and POST requests and returns XML and/or JSON).  (It
> would be something that works kind of like the Twitter API
> http://apiwiki.twitter.com/REST+API+Documentation).
>
> My question is what is the best way to access the objects and classes
> that Wicket can see and call methods on from my REST Web Service API.
>
> Do I create a separate servlet running the the same Tomcat Server that
> can call somehow objects in the Wicket realm?
>
> Or is there a class I can implement within my Wicket-based app that
> can respond to these REST requests?  It would probably be most
> feasible for now to have it all integrated into the same app.
>
> I have been working with Wicket for a while, and feel pretty
> comfortable with it, but I don't really have any experience working
> with servlets, so I'd really appreciate a little guidance on this.
>
> I appreciate the help guys!
> Thanks,
> Jamie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org