Registering a resource w/ an absolute internal name should result in an
absolute name passed to getResource()
-------------------------------------------------------------------------------------------------------------
Key: FELIX-2386
URL: https://issues.apache.org/jira/browse/FELIX-2386
Project: Felix
Issue Type: Bug
Components: HTTP Service
Affects Versions: http-2.0.4
Reporter: Alan Cabrera
I get
name: org/papoose/tck/http/BaseHttpServiceImplTest.class
where I should get
name: /org/papoose/tck/http/BaseHttpServiceImplTest.class
@Test
public void testResourceAbsolute() throws Exception
{
ServiceReference sr =
bundleContext.getServiceReference(HttpService.class.getName());
HttpService service = (HttpService) bundleContext.getService(sr);
service.registerResources("/a/b", "/org/papoose/tck", new HttpContext()
{
public boolean handleSecurity(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
return true;
}
public URL getResource(String name)
{
System.err.println("name: " + name);
return BaseHttpServiceImplTest.class.getResource(name);
}
public String getMimeType(String name)
{
return null;
}
});
URL url = new
URL("http://localhost:8080/a/b/http/BaseHttpServiceImplTest.class");
DataInputStream reader = new DataInputStream(url.openStream());
assertEquals((byte) 0xca, reader.readByte());
assertEquals((byte) 0xfe, reader.readByte());
assertEquals((byte) 0xba, reader.readByte());
assertEquals((byte) 0xbe, reader.readByte());
service.unregister("/a/b");
try
{
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (conn.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND)
throw new IOException("404");
fail("Simple servlet improperly available");
}
catch (IOException e)
{
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.