[arquillian-issues] [JBoss JIRA] Updated: (ARQ-539) Resource injection for Servlet type should inject URL(s) for the servlet instead of baseURL

Ian Brandt (JIRA) jira-events at lists.jboss.org
Thu Aug 4 16:42:28 EDT 2011


     [ https://issues.jboss.org/browse/ARQ-539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ian Brandt updated ARQ-539:
---------------------------

    Description: 
As is suggested by the [current documentation on Resource Injection|https://docs.jboss.org/author/pages/viewpage.action?pageId=5932080] the following injects the URL for the context (i.e. the base URL, e.g. "http://localhost:8080/test"):

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

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:

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

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.

  was:
As is suggested by the [current documentation on Resource Injection|https://docs.jboss.org/author/display/ARQ/Resource+injection] the following injects the URL for the context (i.e. the base URL, e.g. "http://localhost:8080/test"):

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

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:

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

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.



> Resource injection for Servlet type should inject URL(s) for the servlet instead of baseURL
> -------------------------------------------------------------------------------------------
>
>                 Key: ARQ-539
>                 URL: https://issues.jboss.org/browse/ARQ-539
>             Project: Arquillian
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 1.0.0.CR2
>            Reporter: Ian Brandt
>            Assignee: Ian Brandt
>
> As is suggested by the [current documentation on Resource Injection|https://docs.jboss.org/author/pages/viewpage.action?pageId=5932080] the following injects the URL for the context (i.e. the base URL, e.g. "http://localhost:8080/test"):
> {code:java}
> @Test
> private void shouldDoX(@ArquillianResource(MyServlet.class) URL baseURL) 
> {
> }
> {code}
> 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:
> {code:java}
> @Test
> private void shouldDoX(@ArquillianResource(MyServlet.class) Collection<URL> servletURLs) 
> {
> }
> {code}
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list