users@jersey.java.net

Re: [Lift] Re: [Jersey] jersey as filter

From: Alex Boisvert <boisvert_at_intalio.com>
Date: Mon, 2 Mar 2009 18:01:53 -0800

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.ServletContainer_at_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
<lgreg.meredith_at_gmail.com>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.ServletContainer_at_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 <boisvert_at_intalio.com>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 <
>> lgreg.meredith_at_gmail.com> 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 <boisvert_at_intalio.com>wrote:
>>>
>>>> Can you post your web.xml?
>>>>
>>>>
>>>>
>>>> On Mon, Mar 2, 2009 at 3:50 PM, Meredith Gregory <
>>>> lgreg.meredith_at_gmail.com> 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 <Marc.Hadley_at_sun.com>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: users-unsubscribe_at_jersey.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to liftweb_at_googlegroups.com
> To unsubscribe from this group, send email to
> liftweb+unsubscribe_at_googlegroups.com<liftweb%2Bunsubscribe_at_googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>