Hi,
Glad you got things working.
Sorry about the error in the JavaDocs, i have fixed that and included
the filter mapping as well.
Paul.
On Jul 3, 2009, at 9:17 PM, Christopher Piggott wrote:
> I fixed that. Again, the web.xml had a problem. When you define a
> <filter> you apparently have to also define a <filter-mapping> that
> matches it. Looking at the example in
> https://jersey.dev.java.net/nonav/apidocs/1.1.0-ea/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html
> I thought that if you didn't declare a filter-mapping it would default
> to mapping to everything. Apparently not. (I should have known this
> - I had the same problem the first time I ever declared a <servlet>
> without a <servlet-mapping>)
>
> Apologies for what turned out to be a problem with my tomcat
> configuration, really having nothing to do with jersey.
>
>
> So ... I have a more-or-less complete example now, using guice, tomcat
> 6.0.18, and jersey 1.1.0-ea. If anybody needs any snippets on how I
> made this work please let me know. It is all a lot of fun once you
> get it going.
>
>
>
>
>
> On Fri, Jul 3, 2009 at 2:43 PM, Christopher
> Piggott<cpiggott_at_gmail.com> wrote:
>> I think I'm 90% of the way there.
>>
>> I made my test resource a singleton, like this
>>
>> @Path("/test")
>> @Singleton
>> public class TestResource {
>> static Logger log = LogManager.getLogger(TestResource.class);
>> @Inject
>> public TestResource()
>> {
>> log.info("Created a TestResource");
>> }
>>
>> @GET
>> @Produces("text/plain")
>> @Inject
>> public String getIt() {
>> return "Hello From Guice";
>> }
>> }
>>
>>
>> I configure it like this:
>>
>> public class JerseyGuiceModule extends ServletModule {
>> ...
>> @Override
>> protected void configureServlets() {
>> log.info("Configuring servlets");
>> bind(TestResource.class);
>> bind(CacheResource.class);
>> serve("/*").with(GuiceContainer.class);
>> log.info("Done configuring servlets");
>> }
>> }
>>
>>
>> I see the log message indicating that TestResource was created, but
>> the jersey registration doesn't work. My webapp's root is /alarm
>> so I
>> expect I should find this test resource at /alarm/test or /alarm/
>> test/
>> but the server just returns a 404, as if the registration didn't take
>> place.
>>
>> Is there some way I can probe jersey to see what paths/resources it
>> thinks are registered?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>