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

2013-11-11 Thread J.W. Janssen (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13819324#comment-13819324
 ] 

J.W. Janssen commented on FELIX-2386:
-

Is this still an issue with the latest version of Felix HTTP? I did some quick 
tests, but could not reproduce the incorrect behaviour...


 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#6144)


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

2010-06-04 Thread Sten Roger Sandvik (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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.