[arquillian-issues] [JBoss JIRA] Created: (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 13:51:42 EDT 2011
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
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.
--
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