Embed Jetty loading web context issue -


i want load web context not xml, configure programatically. if use method setwar(), worked.

<!doctype web-app public     "-//sun microsystems, inc.//dtd web application 2.2//en"     "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">  <web-app id = "derbynet_id">       <servlet>         <servlet-name>h2console</servlet-name>         <servlet-class>org.h2.server.web.webservlet</servlet-class>         <init-param>             <param-name>weballowothers</param-name>             <param-value>true</param-value>         </init-param>         <load-on-startup>1</load-on-startup>     </servlet>     <servlet-mapping>         <servlet-name>h2console</servlet-name>         <url-pattern>/console/*</url-pattern>     </servlet-mapping> </web-app> 

but, want remove webapp. becasuse has xml only. so, want set servlet programmatically below.but, it's not working. can't see error log on console when run application. but, if connect web page, gives 503 status code. why source code doesn't work??

        servlethandler servlethandler = new servlethandler();          servletholder holder = new servletholder("h2console", (class<? extends servlet>) webservlet.class);         holder.setinitorder(1);         holder.setinitparameter("weballowothers", "true");          servletholder[] holders = { holder };          servletmapping servletmapping = new servletmapping();         servletmapping.setservletname("h2console");         servletmapping.setpathspec("/console/*");         servletmapping[] servletmappings =  {servletmapping};          servlethandler.setservlets(holders);         servlethandler.setservletmappings(servletmappings);          derbywebapp.setservlethandler(servlethandler); 


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -