Dear all,

I am trying to use OSGi HTTP Whiteboard specifications to handle security on 
Servlets using DS. I found this page 
http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html
 and also this example 
http://svn.apache.org/repos/asf/felix/trunk/http/samples/whiteboard/src/main/java/org/apache/felix/http/samples/whiteboard/


Here is how far I got using "default" context. (using another context stops 
servlet from working, which I wish to get working ideally)


ServletContextHelper Code (full code)

@Component(service = ServletContextHelper.class, scope = ServiceScope.BUNDLE, 
property = {
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=default",
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH + "=/devices" })
public class DeviceContextHelper extends ServletContextHelper {
@Override
public boolean handleSecurity(HttpServletRequest request, HttpServletResponse 
response) throws IOException {
return true;
}
}



SERVLET CODE
@Component(service = Servlet.class, property = {
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=("
+ HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=default)",
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN + "=/devices" })
public class DeviceRestProvider extends HttpServlet {
....

}



FILTER CODE


@Component(property = { HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN 
+ "=/*",
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=("
+ HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=default)" })
public class DeviceFilter implements Filter {
...

}


With this code call to http://localhost:8080/devices/sensor3


I receive the following
--------------

HTTP ERROR: 404

Problem accessing /devices/sensor3. Reason:

    File devices/sensor3 could not be found

________________________________
Powered by Jetty://

--------------------


Can you let me know what I am doing wrong?


Cheers

-Daghan


_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to