user3458271
user3458271

Reputation: 660

How to set base url and common rest URL from property file in Quarkus?

I am working on Quarkus application and what I want to do is to set the global path from application.properties file for all rest rest, my application is working but while calling rest request it is giving not found 404.

@ApplicationScoped
public class ABC {
      @POST
      @javax.ws.rs.Path("/callit")
      public Uni<Response> deleteNoti()
      {
           //whatever logic
       }
}

 @ApplicationScoped
public class PAR {
      @POST
      @javax.ws.rs.Path("/callitPar")
      public Uni<Response> addNoti()
      {
           //whatever logic
       }
}

And in application.properties file I am configuring below properties:

quarkus.resteasy.path=/rest/*
quarkus.rest.path=/rest/*
quarkus.http.root-path=/myapp

but when I am calling rest request from front-end it is not working, my rest request should be as below:

http://localhost:8080/myapp/rest/callit
http://localhost:8080/myapp/rest/callitPar

What I want is every rest request should start with "/rest/*" and my application base URL should be "/myapp", Let me know how can we achieve it?

Upvotes: 1

Views: 2554

Answers (2)

jwwallin
jwwallin

Reputation: 118

This question is very old, but in case someone stumbles on this, according to this post on the Quarkus blog the following should produce the required result:

quarkus.resteasy.path=rest/*
quarkus.http.root-path=/myapp

Upvotes: 0

KevKosDev
KevKosDev

Reputation: 849

Try to annotate your resource classes with @Path("/") and set quarkus.resteasy.path=/rest. This should result in your described behaviour.

quarkus.rest.path can be removed.

Upvotes: 1

Related Questions