I got it working!
Eclipse/m2Eclipse was running another server that was actually
handling my requests, so it turns out I had it configured properly
after all!!
For the record, using serve("/file") actually requires /<context_name>/
file, so Dhanji, your recommendation of using serve("test/file")
actually results in a url of <localhost>/test/test/file. So I am
going to keep that in mind.
Thanks to Dhanji and TJ for your help!!
On Sep 1, 11:26 am, Dan Billings <[email protected]> wrote:
> Hold the phone. Now I am getting a ClassNotFoundException on my
> listener when I run my simple servlet. Thanks for you help but i
> think I'm abandoning ship.
>
> I am using Maven, I suspect there is some issue with that. I think I
> am going back to Ant, where everything is nice and explicit.
>
> On Sep 1, 10:41 am, Dan Billings <[email protected]> wrote:
>
>
>
>
>
>
>
> > thanks for the help:
>
> > public class GuiceListener extends GuiceServletContextListener {
>
> > @Override
> > protected Injector getInjector() {
> > return Guice.createInjector(new GuiceModule());
>
> > public class GuiceModule extends ServletModule {
>
> > @Override
> > protected void configureServlets() {
> > super.configureServlets();
> > serve("/test/file").with(FileServlet.class);
>
> > also, I tried /test/file to no avail.
>
> > On Aug 31, 11:54 pm, "Dhanji R. Prasanna" <[email protected]> wrote:
>
> > > Also, try changing it to:
>
> > > serve("/test/file")
>
> > > Guice reads the entire request URI for dispatch.
>
> > > Dhanji.
>
> > > On Wed, Sep 1, 2010 at 2:53 PM, Dhanji R. Prasanna <[email protected]>
> > > wrote:
>
> > > > Can you paste the code in:
>
> > > > billco.test.guice.GuiceListener please?
>
> > > > On Wed, Sep 1, 2010 at 9:34 AM, Dan Billings <[email protected]> wrote:
>
> > > >> BTW I'm using Jetty
>
> > > >> On Aug 31, 6:27 pm, Dan Billings <[email protected]> wrote:
> > > >> > GuiceModule:
> > > >> > serve("/file").with(FileServlet.class);
>
> > > >> > Navigating to <localhost:port>/test/file gives me a 404
>
> > > >> > I know for a fact my listener is being called.
>
> > > >> > As a control, I have one explicitly mapped Servlet which works fine
> > > >> > at
> > > >> > <localhost>/test/simple
>
> > > >> > My web.xml:
>
> > > >> > <filter>
> > > >> > <filter-name>guiceFilter</filter-name>
> > > >> >
> > > >> > <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
> > > >> > </filter>
>
> > > >> > <filter-mapping>
> > > >> > <filter-name>guiceFilter</filter-name>
> > > >> > <url-pattern>/*</url-pattern>
> > > >> > </filter-mapping>
> > > >> > <listener>
> > > >> >
> > > >> > <listener-class>billco.test.guice.GuiceListener</listener-class>
> > > >> > </listener>
>
> > > >> > <servlet>
> > > >> > <servlet-name>SimpleServlet</servlet-name>
> > > >> > <servlet-class>billco.test.SimpleServlet</servlet-class>
> > > >> > </servlet>
> > > >> > <servlet-mapping>
> > > >> > <servlet-name>SimpleServlet</servlet-name>
> > > >> > <url-pattern>/simple</url-pattern>
> > > >> > </servlet-mapping>
>
> > > >> --
> > > >> You received this message because you are subscribed to the Google
> > > >> Groups
> > > >> "google-guice" group.
> > > >> To post to this group, send email to [email protected].
> > > >> To unsubscribe from this group, send email to
> > > >> [email protected]<google-guice%2bunsubscr...@google
> > > >> groups.com>
> > > >> .
> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/google-guice?hl=en.
--
You received this message because you are subscribed to the Google Groups
"google-guice" 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/google-guice?hl=en.