Greg,

Great, then it was just me finding the wrong API docs online :)


But the real question is: Does it work? :)


Cheers,
Viktor

On Tue, Mar 3, 2009 at 4:00 PM, Meredith Gregory
<[email protected]>wrote:

> Viktor,
>
> Thanks. Jersey-1.0.2 *does* implement Filter. You can see that in the
> sources jar and if you include it in a scala/lift project and reflect it
> does the right thing.
>
> Best wishes,
>
> --greg
>
> On Tue, Mar 3, 2009 at 1:46 AM, Viktor Klang <[email protected]>wrote:
>
>> Unfortunately,
>>
>>
>> https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.1/api/jersey/index.html
>>
>> says:
>>
>> public class *ServletContainer*extends 
>> javax.servlet.http.HttpServletimplements ContainerListener 
>> <https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.1/api/jersey/com/sun/jersey/spi/container/ContainerListener.html>
>>
>>
>> which means that the ServletContainer is not implementing the
>> javax.servlet.Filter
>>
>>
>> This is just an idea, and I do not know if it will work, but you could try
>> something like this, and map it as a filter:
>>
>> Java: (Feel free to rewrite as Scala :) )
>>
>> public class JerseyFilter extends ServletContainer implements Filter
>> {
>>     @Override
>>     public void doFilter(ServletRequest req, ServletResponse res,
>> FilterChain fChain)
>>             throws IOException, ServletException
>>     {
>>         service(req,res);
>>         fChain.doFilter(req, res);
>>     }
>>
>>     @Override
>>     public void init(FilterConfig fConfig) throws ServletException
>>     {
>>         super.init();
>>     }
>>
>>     @Override
>>     public void destroy()
>>     {
>>         super.destroy();
>>     }
>> }
>>
>> Please get back to us :)
>>
>> Cheers,
>> Viktor
>>
>>
>>
>> On Tue, Mar 3, 2009 at 3:32 AM, Meredith Gregory <
>> [email protected]> wrote:
>>
>>> Lifted,
>>>
>>> Well, at least i've got jetty launching and running with both filters.
>>> See the web.xml that worked below.
>>>
>>> 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-name>JerseyFilter</filter-name>
>>>   <display-name>Jersey Filter</display-name>
>>>   <description>Attempting to use Jersey as a Filter</description>
>>>
>>> <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
>>>   <init-param>
>>>     <param-name>com.sun.jersey.config.property.packages</param-name>
>>>
>>> <param-value>com.sap.dspace.model.constellation.resources</param-value>
>>>   </init-param>
>>> </filter>
>>> <filter>
>>>   <filter-name>LiftFilter</filter-name>
>>>   <display-name>Lift Filter</display-name>
>>>   <description>The Filter that intercepts lift calls</description>
>>>   <filter-class>net.liftweb.http.LiftFilter</filter-class>
>>> </filter>
>>>
>>> <filter-mapping>
>>>   <filter-name>JerseyFilter</filter-name>
>>>   <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>> <filter-mapping>
>>>   <filter-name>LiftFilter</filter-name>
>>>   <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>>
>>> </web-app>
>>>
>>>
>>>  On Mon, Mar 2, 2009 at 6:25 PM, Meredith Gregory <
>>> [email protected]> wrote:
>>>
>>>> Alex,
>>>>
>>>> Thanks for all your help. i switched versions in the pom.xml (to 1.0.2
>>>> which is the most recent on the sun repo that is not labeled SNAPSHOT) and 
>>>> i
>>>> get the right values from reflecting (BTW -- has anybody written a little
>>>> lift browser app that hooks into reflection so that one can graphically
>>>> browse the class/instances in memory?). Now i just need to figure out how 
>>>> to
>>>> pass the resources context to Jersey. It's got a config for the
>>>> ServletContainer class, but i don't see anything if i'm just using it as a
>>>> filter.
>>>>
>>>> Best wishes,
>>>>
>>>> --greg
>>>>
>>>> On Mon, Mar 2, 2009 at 6:13 PM, Alex Boisvert <[email protected]>wrote:
>>>>
>>>>> No, sorry, I've grown allergic to mvn.
>>>>>
>>>>> If you must know, I wrote a 5-line ruby script that bootstraps the
>>>>> scala interpreter with a given classpath.
>>>>>
>>>>> #!/usr/bin/env scalarun
>>>>> classpath << artifact("com.sun.jersey:jersey-server:jar:1.02")
>>>>> classpath << artifact("javax.servlet:servlet-api:jar:2.5")
>>>>> classpath << artifact("javax.ws.rs:jsr311-api:jar:1.0")
>>>>> interactive = true
>>>>> !#
>>>>>
>>>>> So we're down to two main possibilities... 1) something is wrong with
>>>>> your Maven pom.xml or 2) your local artifacts are inconsistent with what's
>>>>> in the repos.
>>>>>
>>>>> alex
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Mar 2, 2009 at 6:05 PM, Meredith Gregory <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Alex,
>>>>>>
>>>>>> Interesting. Did you build with mvn? If so, what were your
>>>>>> plugins/dependencies?
>>>>>>
>>>>>> Best wishes,
>>>>>>
>>>>>> --greg
>>>>>>
>>>>>>
>>>>>> On Mon, Mar 2, 2009 at 6:01 PM, Alex Boisvert 
>>>>>> <[email protected]>wrote:
>>>>>>
>>>>>>> Greg,
>>>>>>>
>>>>>>> Something must be messed up in your configuration.... Here's what I
>>>>>>> get:
>>>>>>>
>>>>>>> Welcome to Scala version 2.7.3.final (Java HotSpot(TM) Server VM,
>>>>>>> Java 1.6.0_10).
>>>>>>> Type in expressions to have them evaluated.
>>>>>>> Type :help for more information.
>>>>>>>
>>>>>>> scala> new com.sun.jersey.spi.container.servlet.ServletContainer()
>>>>>>> res0: com.sun.jersey.spi.container.servlet.ServletContainer =
>>>>>>> com.sun.jersey.spi.container.servlet.servletcontai...@15cd9a
>>>>>>>
>>>>>>> scala> res0.getClass.getInterfaces
>>>>>>> res2: Array[java.lang.Class[_]] = Array(interface
>>>>>>> javax.servlet.Servlet, interface javax.servlet.ServletConfig, interface
>>>>>>> javax.servlet.Filter, interface java.io.Serializable)
>>>>>>>
>>>>>>> (I'm using jersey-server-1.0.2.jar)
>>>>>>>
>>>>>>> alex
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Mar 2, 2009 at 5:47 PM, Meredith Gregory <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Alex,
>>>>>>>>
>>>>>>>> i was coming to the same conclusion. OTOH, reflecting on
>>>>>>>> com.sun.jersey.spi.container.servlet.ServletContainer i see different 
>>>>>>>> stuff
>>>>>>>> than what's declared in the sources. See below.
>>>>>>>>
>>>>>>>> Best wishes,
>>>>>>>>
>>>>>>>> --greg
>>>>>>>>
>>>>>>>> scala> new com.sun.jersey.spi.container.servlet.ServletContainer()
>>>>>>>> new com.sun.jersey.spi.container.servlet.ServletContainer()
>>>>>>>> new com.sun.jersey.spi.container.servlet.ServletContainer()
>>>>>>>> res0: com.sun.jersey.spi.container.servlet.ServletContainer =
>>>>>>>> com.sun.jersey.spi.container.servlet.servletcontai...@50b410
>>>>>>>>
>>>>>>>> scala> res0.getClass
>>>>>>>> res0.getClass
>>>>>>>> res0.getClass
>>>>>>>> res1: java.lang.Class[_ <: java.lang.Object] = class
>>>>>>>> com.sun.jersey.spi.container.servlet.ServletContainer
>>>>>>>>
>>>>>>>> scala> res0.getClass.getSuperclass
>>>>>>>> res0.getClass.getSuperclass
>>>>>>>> res0.getClass.getSuperclass
>>>>>>>> res7: java.lang.Class[_ >: ?0] = class
>>>>>>>> javax.servlet.http.HttpServlet
>>>>>>>>
>>>>>>>> // i was expecting to see WebComponent here
>>>>>>>>
>>>>>>>> scala> res0.getClass.getInterfaces
>>>>>>>> res0.getClass.getInterfaces
>>>>>>>> res0.getClass.getInterfaces
>>>>>>>> res8: Array[java.lang.Class[_]] = Array(interface
>>>>>>>> com.sun.jersey.spi.container.ContainerListener)
>>>>>>>>
>>>>>>>> // i was expecting to see Servlet, ServletConfig, Filter,
>>>>>>>> Serializable in this list.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Mar 2, 2009 at 5:13 PM, Alex Boisvert <[email protected]
>>>>>>>> > wrote:
>>>>>>>>
>>>>>>>>> My guess would be that you have duplicate servlet-api-2.x.jar in
>>>>>>>>> your classloading hierarchy... can you check and remove any 
>>>>>>>>> servlet.jar
>>>>>>>>> under your webapp WEB-INF/lib directory?
>>>>>>>>>
>>>>>>>>> alex
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Mar 2, 2009 at 4:45 PM, Meredith Gregory <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Alex,
>>>>>>>>>>
>>>>>>>>>> Thanks for the interest. See below.
>>>>>>>>>>
>>>>>>>>>> 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-name>JerseyFilter</filter-name>
>>>>>>>>>>   <display-name>Jersey Filter</display-name>
>>>>>>>>>>   <description>Attempting to use Jersey as a Filter</description>
>>>>>>>>>>
>>>>>>>>>> <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
>>>>>>>>>> </filter>
>>>>>>>>>> <filter>
>>>>>>>>>>   <filter-name>LiftFilter</filter-name>
>>>>>>>>>>   <display-name>Lift Filter</display-name>
>>>>>>>>>>   <description>The Filter that intercepts lift calls</description>
>>>>>>>>>>   <filter-class>net.liftweb.http.LiftFilter</filter-class>
>>>>>>>>>> </filter>
>>>>>>>>>>
>>>>>>>>>> <filter-mapping>
>>>>>>>>>>   <filter-name>JerseyFilter</filter-name>
>>>>>>>>>>   <url-pattern>/*</url-pattern>
>>>>>>>>>> </filter-mapping>
>>>>>>>>>> <filter-mapping>
>>>>>>>>>>   <filter-name>LiftFilter</filter-name>
>>>>>>>>>>   <url-pattern>/*</url-pattern>
>>>>>>>>>> </filter-mapping>
>>>>>>>>>>
>>>>>>>>>> </web-app>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, Mar 2, 2009 at 4:43 PM, Alex Boisvert <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Can you post your web.xml?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Mar 2, 2009 at 3:50 PM, Meredith Gregory <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Marc,
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks for the link! BTW, i'm looking at that sources from the
>>>>>>>>>>>> Jersey jar and it appears that
>>>>>>>>>>>> com.sun.jersey.spi.container.servlet.ServletContainer implements 
>>>>>>>>>>>> Filter. And
>>>>>>>>>>>> yet, when i launch with jetty i get:
>>>>>>>>>>>>
>>>>>>>>>>>> 2009-03-02 15:46:18.043::WARN:  failed JerseyFilter
>>>>>>>>>>>> java.lang.IllegalStateException: class
>>>>>>>>>>>> com.sun.jersey.spi.container.servlet.ServletContainer is not a
>>>>>>>>>>>> javax.servlet.Filter
>>>>>>>>>>>>     at
>>>>>>>>>>>> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:88)
>>>>>>>>>>>>
>>>>>>>>>>>> Best wishes,
>>>>>>>>>>>>
>>>>>>>>>>>> --greg
>>>>>>>>>>>>
>>>>>>>>>>>> On Mon, Mar 2, 2009 at 2:16 PM, Marc Hadley <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Apache Camel uses Jersey as a filter:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml
>>>>>>>>>>>>>
>>>>>>>>>>>>> Marc.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Mar 2, 2009, at 4:46 PM, Meredith Gregory wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>  Jerseyans,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Does anyone have any experience with using Jersey as a filter?
>>>>>>>>>>>>>> i'd like to take advantage of some of Jersey's Request/Response 
>>>>>>>>>>>>>> rendering as
>>>>>>>>>>>>>> well as some of Lift's cool stuff. The Lift servlet is a filter 
>>>>>>>>>>>>>> and deployed
>>>>>>>>>>>>>> as such. i note that the
>>>>>>>>>>>>>> com/sun/jersey/spi/container/servlet/ServletContainer implements 
>>>>>>>>>>>>>> Filter.
>>>>>>>>>>>>>> However, i have yet to find an example of Jersey deployed in a 
>>>>>>>>>>>>>> filter
>>>>>>>>>>>>>> capacity. If anyone has used Jersey this way, please let me know.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 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
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>> [email protected]
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>
>>>
>>>
>>
>>
>> --
>> 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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" 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/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to