You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "J.W. Janssen (JIRA)" <ji...@apache.org> on 2014/02/07 17:30:20 UTC

[jira] [Closed] (FELIX-2386) Registering a resource w/ an absolute internal name should result in an absolute name passed to getResource()

     [ https://issues.apache.org/jira/browse/FELIX-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

J.W. Janssen closed FELIX-2386.
-------------------------------

    Resolution: Cannot Reproduce

Please reopen if issue is not fixed.

> 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 was sent by Atlassian JIRA
(v6.1.5#6160)