Hi,

Are you sure you are not missing the "cxf" prefix in the URL to access your
endpoint? By default, cxf deploys your endpoint with the
CXFNonSpringServlet, which listens on the cxf context path, so your
endpoint should be available here:

http://localhost:8181/cxf/hello <http://localhost:8181/hello>

my 2 cents...

Nicolas





On Thu, Sep 6, 2018 at 5:58 AM Jean-Baptiste Onofré <j...@nanthrax.net> wrote:

> Hi,
>
> did you try to add a application with your context.
>
> Something like:
>
> @Component(
>                 service = Application.class,
>                 property= {
>                                 "osgi.jaxrs.name=RestApp",
>                                 JAX_RS_APPLICATION_BASE + "=/rest",
>                                 "authentication.with=keycloak"
>                 }
>         )
> public class RestApiApp extends Application{
>
>         @Override
>   public Set<Object> getSingletons() {
>       return Collections.singleton(this);
>   }
> }
>
> The resource can refer this application:
>
> @Component(
>         service = Api.class,
>         property = {
>                         "osgi.jaxrs.name=RestApi",
>                         "osgi.jaxrs.resource=true",
>                         "osgi.jaxrs.application.select=(osgi.jaxrs.name
> =RestApp)"
>         }
> )
> @Path("/object")
> public final class Api {
>         public static final Response EMPTY_RESPONSE =
> Response.noContent().type(MediaType.TEXT_HTML_TYPE).build();
>         @GET
>         @Path("/getObject")
>         @Produces(MediaType.APPLICATION_JSON)
>         public String getObject() {
>             //return some json
>         }
> }
>
> Regards
> JB
>
> On 05/09/2018 22:38, atouat wrote:
> > Hi Francois,
> >
> > I treid that too. See this excerpt:
> >
> > karaf@root()> service:list | grep -C 10 rest
> > [de.rest.test.ExampleRest]
> > --------------------------
> >  component.id = 4
> >  component.name = de.rest.test.ExampleRest
> >  osgi.jaxrs.application.select = (osgi.jaxrs.name=.default)
> > * osgi.jaxrs.endpoint = /hello*
> > osgi.jaxrs.resource = true
> >  service.bundleid = 102
> >  service.id = 139
> >  service.scope = bundle
> > Provided by :
> >  de.rest.test.whiteboard.ds Bundle (102)
> >
> >
> > But when calling http://localhost:8181/hello, I get a 404 not found
> error.
> >
> >
> > Thansk for your input :)
> >
> >
> > Greetings,
> >
> > Adnan
> >
> >
> >
> > --
> > Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> >
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Reply via email to