You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fabrizio Giudici <fa...@tidalwave.it> on 2009/01/29 11:55:14 UTC
Architectural dilemma: Wicket + REST (JSR311)
Hi there.
My application, along with the usual HTML pages generated with Wicket,
should also expose some RESTful services. These REST calls should return
documents of various types: images, movies, as well as RDF/XML and N3
and so far.
In an architectural spike I've made, I've used Jersey (implementation of
JSR-311) and of course the two things can co-exist; so everything works
and I don't have "technical" problems to solve (at the moment).
The dilemma is architectural: I'm guessing whether getting JSR-311 in
increases complexity in a way that can be avoided. In other words, could
Wicket be able to serve the same facilities provided by JSR-311 (I mean,
the subset I need)?
Actually, Wicket can serve non-HTML contents by means of
DynamicWebResource, so it seems doable. There are two specific questions
now:
1. Security. For HTML pages, protected areas shoud handle login in the
WIcket way (or what I assume is the normal Wicket way), i.e. rendering a
specific HTML login page. For other types of documents, instead, I need
HTTP authentication and perhaps in future some token-based approach. The
point is that in any case either I deny the access or I give the
resource, but I can't send back an HTML login page when the client
expects a different document type. Would I be able to handle this with
Wicket?
2. Having the same URL delivering different contents according to the
Accept header. For instance, http://foo.bar/blah should normally render
an HTML page; but if a Accept: text/n3 header is specified, a N3 should
be returned. This means that in the former case the default Wicket
workflow would be ok; in the latter, a DynamicWebResource should be
provided. I think I can solve this using JSR-311: I could implement a
super-filter that discriminates on the presence of the Accept: header
and dispatches either to the Wicket or to the Jersey filter (of course I
would implement a custom URL mount scheme so Wicket accepts the same URL
as Jersey).
Hints? I'm searching to find ASAP a reason for deciding to keep Jersey
or to get rid of it, so I can go on with the development without too
many fears of having to change something in future.
Thanks.
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Architectural dilemma: Wicket + REST (JSR311)
Posted by Fabrizio Giudici <fa...@tidalwave.it>.
Erik van Oosten wrote:
> Wicket is all about stateful applications (though stateless stuff is
> useful and is supported).
> REST is all about stateless resources (though you sometimes need
> stateful hacks for login/authentication).
>
> Given these premises, I would not implement REST resources with Wicket
> (well, maybe if you have just 1 or 2). If you want to be more
> powerful, I would rather implement REST stuff with Spring MVC.
> Currently I am using Restlets which works very well also. Jersey
> sounds fine as well.
I'm aware of the Wicket focus on stateful stuff. But, as you say,
sometimes a few things are stateless - and, yes, I have just a few
resources (three "categories" of objects, each would get its own URL).
So, hmmm, still I don't see a strong motivation to go either way...
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Architectural dilemma: Wicket + REST (JSR311)
Posted by Erik van Oosten <e....@grons.nl>.
Wicket is all about stateful applications (though stateless stuff is
useful and is supported).
REST is all about stateless resources (though you sometimes need
stateful hacks for login/authentication).
Given these premises, I would not implement REST resources with Wicket
(well, maybe if you have just 1 or 2). If you want to be more powerful,
I would rather implement REST stuff with Spring MVC. Currently I am
using Restlets which works very well also. Jersey sounds fine as well.
Regards.
Erik.
Fabrizio Giudici wrote:
> Hi there.
>
> My application, along with the usual HTML pages generated with Wicket,
> should also expose some RESTful services. These REST calls should
> return documents of various types: images, movies, as well as RDF/XML
> and N3 and so far.
> In an architectural spike I've made, I've used Jersey (implementation
> of JSR-311) and of course the two things can co-exist; so everything
> works and I don't have "technical" problems to solve (at the moment).
>
> The dilemma is architectural: I'm guessing whether getting JSR-311 in
> increases complexity in a way that can be avoided. In other words,
> could Wicket be able to serve the same facilities provided by JSR-311
> (I mean, the subset I need)?
> Actually, Wicket can serve non-HTML contents by means of
> DynamicWebResource, so it seems doable. There are two specific
> questions now:
>
> 1. Security. For HTML pages, protected areas shoud handle login in the
> WIcket way (or what I assume is the normal Wicket way), i.e. rendering
> a specific HTML login page. For other types of documents, instead, I
> need HTTP authentication and perhaps in future some token-based
> approach. The point is that in any case either I deny the access or I
> give the resource, but I can't send back an HTML login page when the
> client expects a different document type. Would I be able to handle
> this with Wicket?
>
> 2. Having the same URL delivering different contents according to the
> Accept header. For instance, http://foo.bar/blah should normally
> render an HTML page; but if a Accept: text/n3 header is specified, a
> N3 should be returned. This means that in the former case the default
> Wicket workflow would be ok; in the latter, a DynamicWebResource
> should be provided. I think I can solve this using JSR-311: I could
> implement a super-filter that discriminates on the presence of the
> Accept: header and dispatches either to the Wicket or to the Jersey
> filter (of course I would implement a custom URL mount scheme so
> Wicket accepts the same URL as Jersey).
>
> Hints? I'm searching to find ASAP a reason for deciding to keep Jersey
> or to get rid of it, so I can go on with the development without too
> many fears of having to change something in future.
>
> Thanks.
>
--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org