Closed iberrada closed 9 years ago
I also have experienced problems setting the root path to /
on felix. Don't know if this is a general felix problem. I mean what it does is just registering a servlet using the OSGi HttpService. Can you try to register a servlet manually in /
using the HttpService?
Btw. Shouldn't your method declaration have the @Path
annotation too?
@GET
@Path( "{path}" )
@Produces(MediaType.APPLICATION_JSON)
public Response get (
@DefaultValue("data") @PathParam("path") String path,
@DefaultValue("0") @QueryParam("depth") int depth
) throws TechnicalException {
//processing request
}
Hello
I read the documentation about how to register a servlet via the HttpService said that / is not allowed http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#using-the-httpservice
"The servlet alias must begin with a slash and must not end with a slash."
I add the Path annotation in my method declaration but the result is the same
On 13 May 2015 at 09:10, Holger Staudacher notifications@github.com wrote:
I also have experienced problems setting the root path to / on felix. Don't know if this is a general felix problem. I mean what it does is just registering a servlet using the OSGi HttpService. Can you try to register a servlet manually in / using the HttpService?
Btw. Shouldn't your method declaration have the @Path annotation too?
@GET @Path( "{data}/{depth}" ) @Produces(MediaType.APPLICATION_JSON) public Response get ( @DefaultValue("data") @PathParam("path") String path, @DefaultValue("0") @QueryParam("depth") int depth ) throws TechnicalException { //processing request }
— Reply to this email directly or view it on GitHub https://github.com/hstaudacher/osgi-jax-rs-connector/issues/97#issuecomment-101542863 .
Ismail Berrada 06 30 55 65 80
So, if it's not allowed by felix we can't do anything. In equinox it is allowed as far as I know.
Will close this issue as invalid.
Sorry I was wrong and I read the Javadoc of HttpService class and it seems that "/" is authorized
https://osgi.org/javadoc/r4v42/org/osgi/service/http/HttpService.html Here an extract of the javadoc
void registerServlet(java.lang.String alias, javax.servlet.Servlet servlet, java.util.Dictionary initparams, HttpContext https://osgi.org/javadoc/r4v42/org/osgi/service/http/HttpContext.html context) throws javax.servlet.ServletException, NamespaceException https://osgi.org/javadoc/r4v42/org/osgi/service/http/NamespaceException.html
Registers a servlet into the URI namespace.
The alias is the name in the URI namespace of the Http Service at which the registration will be mapped.
An alias must begin with slash ('/') and must not end with slash ('/'), with the exception that an alias of the form "/" is used to denote the root alias.
On 13 May 2015 at 13:08, Holger Staudacher notifications@github.com wrote:
So, if it's not allowed by felix we can't do anything. In equinox it is allowed as far as I know.
Will close this issue as invalid.
— Reply to this email directly or view it on GitHub https://github.com/hstaudacher/osgi-jax-rs-connector/issues/97#issuecomment-101629601 .
Ismail Berrada 06 30 55 65 80
Hmm, as I said with Equinox this is not a problem at all. Are you sure no other servlet is registered on /
? E.g. the WebConsole.
I'm not sur that this the real problem. In fact I tried to register a servlet with the following alias "/alias" and the request curl -v -X GET "http://localhost:8080/alias/path/to/resources"
gives the same result
On 13 May 2015 at 19:07, Holger Staudacher notifications@github.com wrote:
Hmm, as I said with Equinox this is not a problem at all. Are you sure no other servlet is registered on /? E.g. the WebConsole.
— Reply to this email directly or view it on GitHub https://github.com/hstaudacher/osgi-jax-rs-connector/issues/97#issuecomment-101748628 .
Ismail Berrada 06 30 55 65 80
ok, and what does curl -v -X GET "http://localhost:8080/services/path/to/resources"
return?
I'm using osgi-jax-rs-connector with felix framework 4.3 and tried ti change /services default path but it has no effects. (I remove cache files)
I always get a 404 error Here's an example of code in my Activator class
I'm using curl to send HTTP GET request
curl -v -X GET "http://localhost:8080/data/path/to/resource