Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-539

Resource injection for Servlet type should inject URL(s) for the servlet instead of baseURL

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 1.0.0.CR2
    • None
    • None

      As is suggested by the current documentation on Resource Injection the following injects the URL for the context (i.e. the base URL, e.g. "http://localhost:8080/test"):

      @Test
      private void shouldDoX(@ArquillianResource(MyServlet.class) URL baseURL) 
      {
      }
      

      It would seem more intuitive when requesting injection of a URL for the MyServlet.class resource if that URL was for MyServlet, e.g. "http://localhost:8080/test/MyServlet". Since MyServlet.class could be deployed to any url-pattern, e.g. "http://localhost:8080/test/TestServlet", it's not safe for the end user to guess from the baseURL and MyServlet.class name what the servlet's URL might be. Come to think of it the same servlet could be deployed to numerous url-pattern's, so perhaps injection of a Collection<URL> is really what's called for here:

      @Test
      private void shouldDoX(@ArquillianResource(MyServlet.class) Collection<URL> servletURLs) 
      {
      }
      

      That would imply searching for the servlets in the HTTPContext by type rather than by name, however org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet currently only stores the name and context root.

            ianbrandt Ian Brandt (Inactive)
            ianbrandt Ian Brandt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: