The other thing I have been thinking about (wish list item) is how to expose
the Restlet Http Server as a OSGi HttpService.
I mentioned to Rob the possiblity of doing it the other way around, but I
suspect that OSGi HttpService does not expose enough of the stuff that an
HttpConnector might need to do its stuff.
Why do I want to do this? Just that I have a bunch of bundles that work now
using Http Service and I want to leave that as is for now.
For now I have avoided the problem by using two embedded servers, one does http
for OSGi, the other does http for Restlets!
I don't know enough about using Restlets yet to know the answer, but I suspect
that it ought not to be too difficult to have a User Restlet http bundle
register as an OSGi httpService.
For reference, the OSGi Http interface is:
public interface HttpService{
public HttpContext createDefaultHttpContext( )
public void registerResources( String alias, String name, HttpContext context
) throws NamespaceException
public void registerServlet( String alias, Servlet servlet, Dictionary
initparams, HttpContext context ) throws ServletException,
NamespaceException
public void unregister( String alias )
}
public interface HttpContext
public static final String AUTHENTICATION_TYPE =
“org.osgi.service.http.authentication.type”
public static final String AUTHORIZATION =
“org.osgi.service.useradmin.authorization”
public static final String REMOTE_USER =
“org.osgi.service.http.authentication.remote.user”
public String getMimeType( String name )
public URL getResource( String name )
public boolean handleSecurity( HttpServletRequest request,
HttpServletResponse response )
throws IOException
}
Without getting too detailed, it seems RestletOSGiService just needs to be
able to deal with:
registerResources( String alias, String name, HttpContext context ) for
static files
and
registerServlet( String alias, Servlet servlet, Dictionary initparams,
HttpContext context ) where
servlet is and ordinary Servlet overriding
public void doGet (HttpServletRequest request, HttpServletResponse response)
so Restlet needs to be able to call that.
An expert could probably tell me if there and obvious gotcha's in doing this.
Then, I could throw away the http service I am using and just share the one
connected to Restlets.
Is this easy??
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2382624