I'd try asking your question on the Google Guice group:
http://groups.google.com/group/google-guice?pli=1

--
Arthur Kalmenson



On Wed, Jun 10, 2009 at 2:40 AM, Dariusz<[email protected]> wrote:
>
> I'm trying to get the example of guice 2.0 running, but I can't figure
> out why it's not working. I try to do the same thing as on this page:
> http://code.google.com/p/google-guice/wiki/ServletModule
>
>
> Here is what I got:
>
> web.xml
>
> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/
> ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
>        <display-name>guicy</display-name>
>
>        <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>com.test.MyGuiceServletConfig</listener-class>
>        </listener>
>
> </web-app>
>
>
> MyGuiceServletConfig.java
>
> import com.google.inject.Guice;
> import com.google.inject.Injector;
> import com.google.inject.servlet.GuiceServletContextListener;
>
> public class MyGuiceServletConfig extends GuiceServletContextListener
> {
>
>       �...@override
>        protected Injector getInjector() {
>                return Guice.createInjector( new MyServletModule() );
>        }
> }
>
>
> MyServletModule.java
>
> import com.google.inject.servlet.ServletModule;
>
> public class MyServletModule extends ServletModule {
>
>       �...@override
>        protected void configureServlets() {
>                serve("/*").with( MyServlet.class );
>        }
>
> }
>
>
> MyServlet.java
>
> import java.io.IOException;
> import java.io.PrintWriter;
>
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import com.google.inject.Singleton;
>
> @Singleton
> public class MyServlet extends HttpServlet {
>
>   �...@override
>    public void doGet(HttpServletRequest req, HttpServletResponse
> resp)
>                    throws ServletException, IOException {
>        resp.setContentType("text/html");
>        PrintWriter writer = resp.getWriter();
>        writer.printf("<h1>Welcome to the application!</h1>" );
>        System.out.println( "...testing" );
>        resp.setStatus( HttpServletResponse.SC_OK );
>    }
>
>        /**
>         * Process the HTTP Post request
>         */
>        public void doPost( HttpServletRequest request, HttpServletResponse
> response ) throws ServletException, IOException {
>                System.out.println( "inside MyServlet class" );
>        }
> }
>
> I'm not getting anywhere and I don't have anything in my log file. I
> would really appreciate any help. I think th approach of Guice is
> excellent and would love to use it for my applications.
>
> Thanks a lot in advance!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to