felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sten Roger Sandvik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-2386) Registering a resource w/ an absolute internal name should result in an absolute name passed to getResource()
Date Fri, 04 Jun 2010 18:58:58 GMT

    [ https://issues.apache.org/jira/browse/FELIX-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875714#action_12875714
] 

Sten Roger Sandvik commented on FELIX-2386:
-------------------------------------------

When you put in "/org/papoose/tck" will the parameter in getResource be "org/papoose/tck"
(without slash)? If so, this is probably a bug. Not sure if fixing this will break other code.
Anyone?


> 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.


Mime
View raw message