gwt rpc - how to minimize servlet declarations for gwt-rpc in web.xml? -


sorry still beginner in gwt. have noticed when project grow , declarations of servlets rpc in web.xml file many, many , many. single *serviceimpl class , need define in web.xml as

<servlet>     <servlet-name>greetservlet</servlet-name>     <servlet-class>com.my.testing.server.greetingserviceimpl</servlet-class> </servlet>  <servlet-mapping>     <servlet-name>greetservlet</servlet-name>     <url-pattern>/testing/greet</url-pattern> </servlet-mapping> 

if if have 30 *serviceimpl class, may take 200 lines in web.xml rpc calls. , know

  1. is web.xml file place declare rpc servlets ?
  2. has someways skip declarative styles (i mean via annotations '@' etc) ?

gwt works pretty without these declarations in web.xml, using annotations:

/*  * server-side rpc-implementation  */ @webservlet(name = "yourservice", urlpatterns = {"/path/to/yourservice"}) public class yourserviceimpl extends remoteserviceservlet implements yourservice {    public void dosomething() {     //some code   } }  /*  * corresponding rpc-interface  */ @remoteservicerelativepath("path/to/yourservice") public interface yourservice implements remoteservice {    void dosomething(); } 

the resulting path servlet depends on project structure. if project deployed in servers root, find servlet there (with path specified urlpatterns above). however, if deployed project under own uri, have prepend urlpattern.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -