[Lift] Re: [Jersey] jersey as filter
Paul, Many thanks for your note. i've been endeavoring to run Jersey and Lift in a filter chain. i was not seeing the requests passed on into Lift. Your explanation fits. What i really need is httpreq -- jersey -- lift -- jersey -- httpresp i can just hack this up myself, or i can log an issue (or both). Best wishes, --greg On Mon, Mar 9, 2009 at 1:39 AM, Paul Sandoz paul.san...@sun.com wrote: Hi Greg, I hope you have resolved things. I have been away on holiday, hence my silence. For Jersey 1.0.2 the Jersey filter support requires that the filter be configured at the end of the filter chain, see: https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/api/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html This is somewhat limited because we added this feature very close to the Jersey release. For Jersey 1.0.3-SNAPSHOT one can declare a regex that if matched defers to the next filter in the chain. See the Bookstore sample for more details on such a configuration: http://download.java.net/maven/2/com/sun/jersey/samples/bookstore/1.0.3-SNAPSHOT/bookstore-1.0.3-SNAPSHOT-project.zip We do not currently support a filter that passes things through to the next filter in the chain if Jersey does not match the URI. If you require this functionality please log an issue. Hope that helps, Paul. On Mar 3, 2009, at 3:32 AM, Meredith Gregory 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com wrote: Alex, i was coming to the same conclusion. OTOH, reflecting on
[Lift] Re: [Jersey] jersey as filter
Greg, have you tried Jersey completely standalone and verified that it's working? Cheers, Viktor On Wed, Mar 4, 2009 at 12:08 AM, Meredith Gregory lgreg.mered...@gmail.comwrote: Viktor, et al, Well, i've scoped things down to just running the Jersey helloworld-webapp sample in jetty with Jersey as the ServletContainer, rather than a Filter. Even that is displaying the same behavior where the server is eating the requests, but it's not hitting the resource class get method. Frankly, i can't see a substantive difference between their sample and the one i've got -- apart from swapping out glassfish for jetty. Best wishes, --greg On Tue, Mar 3, 2009 at 7:50 AM, Meredith Gregory lgreg.mered...@gmail.com wrote: Viktor, The combined servlet is eating http requests, but it's not processing them correctly. i'm still not sure about all the Jersey path stuff. i'm the process of debugging. Best wishes, --greg On Tue, Mar 3, 2009 at 7:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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 viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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
[Lift] Re: [Jersey] jersey as filter
Viktor, Thanks for your note. i got things more or less working. See this thread: jersey and lift side-by-side + request for link to URL rewrite exampleBest wishes, --greg On Wed, Mar 4, 2009 at 1:35 AM, Viktor Klang viktor.kl...@gmail.com wrote: Greg, have you tried Jersey completely standalone and verified that it's working? Cheers, Viktor- Show quoted text - On Wed, Mar 4, 2009 at 12:08 AM, Meredith Gregory lgreg.mered...@gmail.com wrote: Viktor, et al, Well, i've scoped things down to just running the Jersey helloworld-webapp sample in jetty with Jersey as the ServletContainer, rather than a Filter. Even that is displaying the same behavior where the server is eating the requests, but it's not hitting the resource class get method. Frankly, i can't see a substantive difference between their sample and the one i've got -- apart from swapping out glassfish for jetty. Best wishes, --greg On Tue, Mar 3, 2009 at 7:50 AM, Meredith Gregory lgreg.mered...@gmail.com wrote: Viktor, The combined servlet is eating http requests, but it's not processing them correctly. i'm still not sure about all the Jersey path stuff. i'm the process of debugging. Best wishes, --greg On Tue, Mar 3, 2009 at 7:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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 viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.com wrote: No, sorry, I've grown allergic to
[Lift] Re: [Jersey] jersey as filter
Awesome Greg, I'm sorry I wasn't of much help :( On Wed, Mar 4, 2009 at 5:50 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: Viktor, Thanks for your note. i got things more or less working. See this thread: jersey and lift side-by-side + request for link to URL rewrite exampleBest wishes, --greg On Wed, Mar 4, 2009 at 1:35 AM, Viktor Klang viktor.kl...@gmail.comwrote: Greg, have you tried Jersey completely standalone and verified that it's working? Cheers, Viktor - Show quoted text - On Wed, Mar 4, 2009 at 12:08 AM, Meredith Gregory lgreg.mered...@gmail.com wrote: Viktor, et al, Well, i've scoped things down to just running the Jersey helloworld-webapp sample in jetty with Jersey as the ServletContainer, rather than a Filter. Even that is displaying the same behavior where the server is eating the requests, but it's not hitting the resource class get method. Frankly, i can't see a substantive difference between their sample and the one i've got -- apart from swapping out glassfish for jetty. Best wishes, --greg On Tue, Mar 3, 2009 at 7:50 AM, Meredith Gregory lgreg.mered...@gmail.com wrote: Viktor, The combined servlet is eating http requests, but it's not processing them correctly. i'm still not sure about all the Jersey path stuff. i'm the process of debugging. Best wishes, --greg On Tue, Mar 3, 2009 at 7:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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 viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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
[Lift] Re: [Jersey] jersey as filter
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 lgreg.mered...@gmail.comwrote: 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@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()
[Lift] Re: [Jersey] jersey as filter
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 viktor.kl...@gmail.com 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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
[Lift] Re: [Jersey] jersey as filter
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 lgreg.mered...@gmail.comwrote: 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 viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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
[Lift] Re: [Jersey] jersey as filter
Viktor, The combined servlet is eating http requests, but it's not processing them correctly. i'm still not sure about all the Jersey path stuff. i'm the process of debugging. Best wishes, --greg On Tue, Mar 3, 2009 at 7:04 AM, Viktor Klang viktor.kl...@gmail.com wrote: 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 lgreg.mered...@gmail.com 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 viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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.
[Lift] Re: [Jersey] jersey as filter
Viktor, et al, Well, i've scoped things down to just running the Jersey helloworld-webapp sample in jetty with Jersey as the ServletContainer, rather than a Filter. Even that is displaying the same behavior where the server is eating the requests, but it's not hitting the resource class get method. Frankly, i can't see a substantive difference between their sample and the one i've got -- apart from swapping out glassfish for jetty. Best wishes, --greg On Tue, Mar 3, 2009 at 7:50 AM, Meredith Gregory lgreg.mered...@gmail.comwrote: Viktor, The combined servlet is eating http requests, but it's not processing them correctly. i'm still not sure about all the Jersey path stuff. i'm the process of debugging. Best wishes, --greg On Tue, Mar 3, 2009 at 7:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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 viktor.kl...@gmail.comwrote: 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 lgreg.mered...@gmail.com 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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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
[Lift] Re: [Jersey] jersey as filter
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.mered...@gmail.comwrote: 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-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 4:43 PM, Alex Boisvert boisv...@intalio.comwrote: Can you post your web.xml? On Mon, Mar 2, 2009 at 3:50 PM, Meredith Gregory lgreg.mered...@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.had...@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-unsubscr...@jersey.dev.java.net For additional commands, e-mail: users-h...@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 --~--~-~--~~~---~--~~ 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: [Jersey] jersey as filter
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 lgreg.mered...@gmail.comwrote: 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 boisv...@intalio.comwrote: 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.mered...@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-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 4:43 PM, Alex Boisvert boisv...@intalio.comwrote: Can you post your web.xml? On Mon, Mar 2, 2009 at 3:50 PM, Meredith Gregory lgreg.mered...@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.had...@sun.comwrote: 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-unsubscr...@jersey.dev.java.net For additional commands,
[Lift] Re: [Jersey] jersey as filter
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 boisv...@intalio.com 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@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.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 boisv...@intalio.comwrote: 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.mered...@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-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 4:43 PM, Alex Boisvert boisv...@intalio.comwrote: Can you post your web.xml? On Mon, Mar 2, 2009 at 3:50 PM, Meredith Gregory lgreg.mered...@gmail.com wrote: Marc, Thanks for the link! BTW, i'm looking at that sources from the Jersey jar and it appears that
[Lift] Re: [Jersey] jersey as filter
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-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 init-param param-namecom.sun.jersey.config.property.packages/param-name param-valuecom.sap.dspace.model.constellation.resources/param-value /init-param /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 6:25 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: 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 boisv...@intalio.comwrote: 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 lgreg.mered...@gmail.com 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 boisv...@intalio.comwrote: 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 lgreg.mered...@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.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 boisv...@intalio.comwrote: 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.mered...@gmail.com wrote: Alex, Thanks