4 Replies Latest reply on Aug 9, 2010 5:49 PM by Dan Allen

    Using web.xml's non-test servlets

    Ales Justin Master

      I have this @Deployment

       

      @Deployment
         public static Archive createTestArchive()
         {
            WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "simple.war");
            webArchive.addPackage(MockComponentsServlet.class.getPackage()); // mock
            URL webXml = GMcTestCase.class.getResource("/components/WEB-INF/web.xml");
            webArchive.setWebXML(webXml);
            return webArchive;
         }

       

      where the web.xml looks like

       

      <servlet>
              <servlet-name>MC Servlet</servlet-name>
              <servlet-class>org.jboss.test.grapher.support.MockComponentsServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
      
          <servlet-mapping>
              <servlet-name>MC Servlet</servlet-name>
              <url-pattern>/client/mc-initial</url-pattern>
          </servlet-mapping>
      

       

      but I cannot get the non-test url to work

      (the /test works, but not the one mapped in web.xml)

       

      URL url = new URL("http://localhost:8080/test"); // TODO -- real url; /client/mc-initial
      URLConnection conn = url.openConnection();

       

      What am I missing?