2009/12/24 Andrea Aime <[email protected]> > maven apache ha scritto: > > 1) I create a new maven module named "king" under the community module,and >> under the directory king/src/main/java I only create a simple Servelt named >> KServelt which just return a string to the client, this is the code: >> >> *public class KServlet extends HttpServlet{* >> * **protected void doGet(HttpServletRequest req, HttpServletResponse resp) >> {* >> * **resp.getOutputStream().write("king".getBytes()); }** **} }* >> 2) edit the applicationContext.xml under the /king/src/main/java, the >> contents can be found here http://dpaste.com/137311/ >> >> 3) modify the web.xml under the web/app/src/main/webapp/WEB-INFO,add the >> following " >> ------------------------- >> <servlet-mapping> >> <servlet-name>dispatcher</servlet-name> >> <url-pattern>/king/*</url-pattern> >> </servlet-mapping> >> ------------------------- >> >> Then I start the geoserver by run the org.geoserver.web.Start , then enter >> http://localhost:8080/geoserver/king/king.do in the browser but it seems >> that the mapping does not work,since I got a 404 error. >> I change the url to http://localhost:8080/geoserver/king.do,things did >> not change. >> > > Is your servlet in the Start.java classpath when you start it? > Usually putting another module in the web-app classpath involves: > - adding a depedency from web-app to your new module, and adding > your module to the general maven build (make sure your module > it built when you do mvn install from the root) > - running mvn eclipse:eclipse again so that the eclipse projects > are rebuilt > - refresh from eclipse > Yes,I forgot mention that: I have add a profile in the pom fo the webapp module: ---------------------- <profile> <id>addking</id> <dependencies> <dependency> <groupId>org.geoserver</groupId> <artifactId>king</artifactId> <version>2.0.0</version> </dependency> </dependencies> </profile> --------------------- Then I run commond: mvn clean install -Dmaven.test.skip=true -P addking, and I am sure the king.2.0.0.jar is included in the web/app/target/geoserver/webinfo/lib.
> > Cheers > Andrea > > -- > Andrea Aime > OpenGeo - http://opengeo.org > Expert service straight from the developers. >
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Geoserver-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-devel
