Jonathan Cook - Online wrote:
> Paul,
>
> If I try to inject the servlet request using:
> @HttpContext HttpServletRequest r;
>
I am guessing you are using jersey 0.5 or less... add the jsr250-api.jar
to your classpath and use:
@Resource HttpServletRequest r;
Otherwise if you switch to 0.6 then HttpContext has been renamed to
Context and you no longer require the jsr250-api.jar in the classpath
and you do:
@Context HttpServletRequest r;
The reason we switched was because we were using @Resource incorrectly.
Note that the example per session provider i sent out earlier will only
work for 0.6 or greater.
Paul.
> I get the following error:
>
> 2008-04-08 12:18:52.335::WARN: Error for /footballfixtures
> java.lang.NoClassDefFoundError: javax/annotation/Resource
> at
> com.sun.ws.rest.spi.container.servlet.ServletContainer$1.getAnnotationClass(ServletContainer.java:276)
> at com.sun.ws.rest.spi.resource.Injectable.inject(Injectable.java:52)
> at
> com.sun.ws.rest.impl.application.WebApplicationImpl.injectResources(WebApplicationImpl.java:197)
> at
> com.sun.ws.rest.impl.application.WebApplicationImpl.injectResources(WebApplicationImpl.java:189)
> at
> com.sun.ws.rest.impl.application.WebApplicationContext.injectDependencies(WebApplicationContext.java:95)
> at
> com.sun.ws.rest.impl.resource.PerRequestProvider.getInstance(PerRequestProvider.java:70)
> at
> com.sun.ws.rest.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:127)
> at
> com.sun.ws.rest.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:49)
> at
> com.sun.ws.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:83)
> at
> com.sun.ws.rest.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:49)
> at
> com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:246)
> at
> com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContainer.java:123)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> at
> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
> at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>
> maybe I have some missing jar?
>
> Jonathan
>
> http://www.bbc.co.uk
> This e-mail (and any attachments) is confidential and may contain
> personal views which are not the views of the BBC unless specifically
> stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in
> reliance on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109