[Lift] Re: chaining servlets

2009-03-02 Thread Viktor Klang
On Mon, Mar 2, 2009 at 8:51 PM, Meredith Gregory
lgreg.mered...@gmail.comwrote:

 Lifted, scalads and lasses,

 Does anybody have a working sample of chaining the lift servlet with a 3rd
 party servlet? i'm interested in doing this with the Jersey servlet to get
 some of their request/response rendering support.


This is why we made Lift a Filter :)




 Best wishes,

 --greg

 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 806 55th St NE
 Seattle, WA 98105

 +1 206.650.3740

 http://biosimilarity.blogspot.com

 



-- 
Viktor Klang
Senior Systems Analyst

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: chaining servlets

2009-03-02 Thread Meredith Gregory
PPS The reason i want Jersey on the outbound path is that it has pretty
nifty support for rendering to XML and other formats. A single Produces
annotation at the class level, for example, suffices to cause all the web
methods to render according to format specified in the annotation. Oh, and
Jersey also autogenerates the WADL description of the service -- which is
going to come in handy for other stuff we're doing.

On Mon, Mar 2, 2009 at 3:16 PM, Meredith Gregory
lgreg.mered...@gmail.comwrote:

 Tim, et al,

 Thanks for the many responses. Here's the overall context. i've got a group
 that has done some significant work building a JRoR site. Now they want to
 scale. As a part of a midterm strategy to get some reasonable tooling in,
 we're building Scala-based RESTful APIs. Being an idiot, i want as general a
 soln as possible. So, here's what i've done.

- a plain, vanilla Hibernate reverse engineering strategy will fetch
both JPA and simple POJOs
   - This gets me Scala access to the backend
   - Now, i want to generate default controller behavior. i've
written a Scala program that eats what Hibernate spits out and creates
default controller behavior. It uses the Jersey annotations (Produces,
Consumes, Path, GET, PUT,...) to control rendering to/from the client of 
 the
RESTful API

 What i want to do now is to interject lift into the mix so that we can
 allow programmers to specialize the controller behavior in scala/lift code.

 The reason i've attempted to be fairly generic about all this is that i
 believe this represents a tool-chain that allows a semi-automated migration
 path from pick-you-webframework to lift/scala. The idea is that the SQL
 schema is about 80% of where the rubber meets the road, so that ought to be
 the place to hoist your app out of some existing solution. This works
 especially well if you're transition from a JVM soln (JRoR) to a JVM soln.

 Best wishes,

 --greg


 On Mon, Mar 2, 2009 at 3:02 PM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Greg, can I enquire to your specific use case?
 I’d be interested to hear what you feel Jersey adds value to over lift (im
 not familiar with Jersey)?

 In my experience when you need a round the houses solution such as this
 their can often be a simpler path :-)

 Cheers, Tim


 On 02/03/2009 22:46, Viktor Klang viktor.kl...@gmail.com wrote:

 hehe, no worries, I'm one of your fans. :)

 You should be able to accomplish this by having the filter mapping for
 Jersey in web.xml placed before the Lift filter mapping:

 Recall that a filter chain is one of the objects passed to the 
 doFiltermethod of a filter. This chain is formed indirectly via filter 
 mappings. The
 order of the filters in the chain is the same as the order that filter
 mappings appear in the web application deployment descriptor. 

 http://java.sun.com/products/servlet/Filters.html


 The Jersey will handle the request first, then pass it thru to Lift, then
 back.
 I of course have not tested this with Jersey and do not know if there are
 any strange things that can happen.
 But I'm sure you'll find out and get back to us ;)


 Cheers,
 Viktor

 On Mon, Mar 2, 2009 at 11:28 PM, Meredith Gregory 
 lgreg.mered...@gmail.com wrote:

 Marius, Viktor,

 Many thanks for your prompt responses. You'll have to pardon me as i've
 not graduated from Web101 ;-). i was really looking for an example. To
 illustrate, in looking at web.xml in a archetype-generated lift project i
 see that only filter and filter mapping is defined. How is a servlet then
 chosen?

 Also, i'm sort of interested in *wrapping* lift's request processing.
 Here's what i mean. If i've understood what Jersey does correctly (and
 that's a big if), then it will do Request and Response rendering. So, what i
 want is

  == HttpRequest == (JerseyFilter) == ModifiedRequest == (LiftFilter) ==
 Response == (JerseyFilter) == ModifiedOutboundResponse ==

 It's not clear to me how this is accomplished. There's the dead obvious
 idea, but i'm leary that this won't work because the types are unlikely to
 line up.

 Best wishes,

 --greg

 On Mon, Mar 2, 2009 at 1:00 PM, Viktor Klang viktor.kl...@gmail.com
 wrote:



 On Mon, Mar 2, 2009 at 8:51 PM, Meredith Gregory 
 lgreg.mered...@gmail.com wrote:

 Lifted, scalads and lasses,

 Does anybody have a working sample of chaining the lift servlet with a 3rd
 party servlet? i'm interested in doing this with the Jersey servlet to get
 some of their request/response rendering support.


 This is why we made Lift a Filter :)




 Best wishes,

 --greg


 



 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 806 55th St NE
 Seattle, WA 98105

 +1 206.650.3740

 http://biosimilarity.blogspot.com




-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com

--~--~-~--~~~---~--~~
You received this message because you are 

[Lift] Re: chaining servlets

2009-03-02 Thread Meredith Gregory
David,

Please find below the web.xml i'm currently experimenting with.

Best wishes,

--greg

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
filter
  filter-nameJerseyFilter/filter-name
  display-nameJersey Filter/display-name
  descriptionAttempting to use Jersey as a Filter/description

filter-classcom.sun.jersey.spi.container.servlet.ServletContainer/filter-class
/filter
filter
  filter-nameLiftFilter/filter-name
  display-nameLift Filter/display-name
  descriptionThe Filter that intercepts lift calls/description
  filter-classnet.liftweb.http.LiftFilter/filter-class
/filter

filter-mapping
  filter-nameJerseyFilter/filter-name
  url-pattern/*/url-pattern
/filter-mapping
filter-mapping
  filter-nameLiftFilter/filter-name
  url-pattern/*/url-pattern
/filter-mapping

/web-app


On Mon, Mar 2, 2009 at 3:00 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:

 Not to be a nudge, but how about if Greg sends us his web.xml file and the
 name of his Jersey Filter, we re-write the web.xml file for him and he
 writes a wiki page explaining the process?


 On Mon, Mar 2, 2009 at 2:46 PM, Viktor Klang viktor.kl...@gmail.comwrote:

 hehe, no worries, I'm one of your fans. :)

 You should be able to accomplish this by having the filter mapping for
 Jersey in web.xml placed before the Lift filter mapping:

 Recall that a filter chain is one of the objects passed to the 
 doFiltermethod of a filter. This chain is formed indirectly via filter 
 mappings. The
 order of the filters in the chain is the same as the order that filter
 mappings appear in the web application deployment descriptor. 

 http://java.sun.com/products/servlet/Filters.html


 The Jersey will handle the request first, then pass it thru to Lift, then
 back.
 I of course have not tested this with Jersey and do not know if there are
 any strange things that can happen.
 But I'm sure you'll find out and get back to us ;)


 Cheers,
 Viktor

 On Mon, Mar 2, 2009 at 11:28 PM, Meredith Gregory 
 lgreg.mered...@gmail.com wrote:

 Marius, Viktor,

 Many thanks for your prompt responses. You'll have to pardon me as i've
 not graduated from Web101 ;-). i was really looking for an example. To
 illustrate, in looking at web.xml in a archetype-generated lift project i
 see that only filter and filter mapping is defined. How is a servlet then
 chosen?

 Also, i'm sort of interested in *wrapping* lift's request processing.
 Here's what i mean. If i've understood what Jersey does correctly (and
 that's a big if), then it will do Request and Response rendering. So, what i
 want is

  == HttpRequest == (JerseyFilter) == ModifiedRequest == (LiftFilter)
 == Response == (JerseyFilter) == ModifiedOutboundResponse ==

 It's not clear to me how this is accomplished. There's the dead obvious
 idea, but i'm leary that this won't work because the types are unlikely to
 line up.

 Best wishes,

 --greg

 On Mon, Mar 2, 2009 at 1:00 PM, Viktor Klang viktor.kl...@gmail.comwrote:



 On Mon, Mar 2, 2009 at 8:51 PM, Meredith Gregory 
 lgreg.mered...@gmail.com wrote:

 Lifted, scalads and lasses,

 Does anybody have a working sample of chaining the lift servlet with a
 3rd party servlet? i'm interested in doing this with the Jersey servlet to
 get some of their request/response rendering support.


 This is why we made Lift a Filter :)




 Best wishes,

 --greg

 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 806 55th St NE
 Seattle, WA 98105

 +1 206.650.3740

 http://biosimilarity.blogspot.com





 --
 Viktor Klang
 Senior Systems Analyst





 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 806 55th St NE
 Seattle, WA 98105

 +1 206.650.3740

 http://biosimilarity.blogspot.com





 --
 Viktor Klang
 Senior Systems Analyst





 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp


 



-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: chaining servlets

2009-03-02 Thread Charles F. Munat

Greg,

I'm very interested in how this works out. I've been looking at Jersey 
and I really like the annotations, but I have been way too swamped to 
really play with it with Lift (I've only tried their Hello World app). 
If you get this working, I'd love to see it.

Chas.

Meredith Gregory wrote:
 Tim, et al,
 
 Thanks for the many responses. Here's the overall context. i've got a 
 group that has done some significant work building a JRoR site. Now they 
 want to scale. As a part of a midterm strategy to get some reasonable 
 tooling in, we're building Scala-based RESTful APIs. Being an idiot, i 
 want as general a soln as possible. So, here's what i've done.
 
 * a plain, vanilla Hibernate reverse engineering strategy will fetch
   both JPA and simple POJOs
   o This gets me Scala access to the backend
 * Now, i want to generate default controller behavior. i've
   written a Scala program that eats what Hibernate spits out and
   creates default controller behavior. It uses the Jersey
   annotations (Produces, Consumes, Path, GET, PUT,...) to control
   rendering to/from the client of the RESTful API
 
 What i want to do now is to interject lift into the mix so that we can 
 allow programmers to specialize the controller behavior in scala/lift code.
 
 The reason i've attempted to be fairly generic about all this is that i 
 believe this represents a tool-chain that allows a semi-automated 
 migration path from pick-you-webframework to lift/scala. The idea is 
 that the SQL schema is about 80% of where the rubber meets the road, so 
 that ought to be the place to hoist your app out of some existing 
 solution. This works especially well if you're transition from a JVM 
 soln (JRoR) to a JVM soln.
 
 Best wishes,
 
 --greg
 
 On Mon, Mar 2, 2009 at 3:02 PM, Timothy Perrett 
 timo...@getintheloop.eu wrote:
 
 
 Greg, can I enquire to your specific use case?
 I’d be interested to hear what you feel Jersey adds value to over
 lift (im not familiar with Jersey)?
 
 In my experience when you need a round the houses solution such as
 this their can often be a simpler path :-)
 
 Cheers, Tim
 
 
 On 02/03/2009 22:46, Viktor Klang viktor.kl...@gmail.com
 http://viktor.kl...@gmail.com wrote:
 
 hehe, no worries, I'm one of your fans. :)
 
 You should be able to accomplish this by having the filter
 mapping for Jersey in web.xml placed before the Lift filter mapping:
 
 Recall that a filter chain is one of the objects passed to the
 doFilter method of a filter. This chain is formed indirectly via
 filter mappings. The order of the filters in the chain is the
 same as the order that filter mappings appear in the web
 application deployment descriptor. 
 
 http://java.sun.com/products/servlet/Filters.html
 
 
 The Jersey will handle the request first, then pass it thru to
 Lift, then back.
 I of course have not tested this with Jersey and do not know if
 there are any strange things that can happen.
 But I'm sure you'll find out and get back to us ;)
 
 
 Cheers,
 Viktor
 
 On Mon, Mar 2, 2009 at 11:28 PM, Meredith Gregory
 lgreg.mered...@gmail.com http://lgreg.mered...@gmail.com wrote:
 
 Marius, Viktor,
 
 Many thanks for your prompt responses. You'll have to pardon
 me as i've not graduated from Web101 ;-). i was really
 looking for an example. To illustrate, in looking at web.xml
 in a archetype-generated lift project i see that only filter
 and filter mapping is defined. How is a servlet then chosen?
 
 Also, i'm sort of interested in */wrapping/* lift's request
 processing. Here's what i mean. If i've understood what
 Jersey does correctly (and that's a big if), then it will do
 Request and Response rendering. So, what i want is
 
  == HttpRequest == (JerseyFilter) == ModifiedRequest ==
 (LiftFilter) == Response == (JerseyFilter) ==
 ModifiedOutboundResponse ==
 
 It's not clear to me how this is accomplished. There's the
 dead obvious idea, but i'm leary that this won't work
 because the types are unlikely to line up. 
 
 Best wishes,
 
 --greg
 
 On Mon, Mar 2, 2009 at 1:00 PM, Viktor Klang
 viktor.kl...@gmail.com http://viktor.kl...@gmail.com wrote:
 
 
 
 On Mon, Mar 2, 2009 at 8:51 PM, Meredith Gregory
 lgreg.mered...@gmail.com
 http://lgreg.mered...@gmail.com wrote:
 
 Lifted, scalads and lasses,
 
 Does anybody have a working sample of chaining the
 lift servlet with a 3rd party servlet? i'm
 interested in doing this with the Jersey