Custom Servlets with VAADIN and GUICE


I have Vaadin working with GUICE but the statement serve( "/*" ).with( GuiceApplicationServlet.class ); does not allow me to define any other servlets for my application.

I would like to have GUICE serve other URLs like /getFiles?id=12 with a servlet of mine.

Thank you for your help.



I’m no guice expert, but I’m guessing that mapping a servlet to “/" will ‘override’ everything else - it’s listening to all URLs. If I read the guice documentation correctly you should be able to do what you want, provided you add the "/getFiles/” -mapping before the “/*” mapping:

serve( "/getFiles/*" ).with( GetFileServlet.class ); 
serve( "/*" ).with( GuiceApplicationServlet.class ); 

I have not tried this tough…

Best Regards,

thank you for your answer. It does work this way. :slight_smile: