1
@path("api/attachments")
class Attach{

     @path("/")
     public String method1(){
  
     }    


 } 

this is my sample code. i am using java rest jersey but imethod1 calling if giving URL api/attachments/ .if i am not giving ending slash URL not configure. i want to make ending slash optional even if i am not providing any slash in URL this method should invoked.Thanku in advance

user3629
  • 57
  • 8
  • 2
    Completely remove the @Path("/"). You don't need it. You just need a method (e.g. @GET) – Paul Samsotha Mar 07 '21 at 18:10
  • i want path url like api/entity/{entity}/file/{file}/tag/{tagId} in which want to keep entity, file optional. i have referred your solution https://stackoverflow.com/questions/32765804/optional-params-in-rest-api-request-using-jersey-2-21/32778643 but this only working for api/{entity}/{file}/tag/{tagId}. but i want url api/entity/{entity}/file/{file}/tag/{tagId}. can you plz help me in this. – user3629 Mar 20 '21 at 20:38
  • In your solution @Path("/method{noop: (/)?}{id: ((? <=/)\\d+)?}") V public Response get(@PathParam("id") int id) {} noop: (/) replace via (/entity/) same for the fileType but i am getting 404 error. – user3629 Mar 20 '21 at 20:57
  • Try to use multiple methods instead of trying to make it work with just one. – Paul Samsotha Mar 20 '21 at 20:59
  • [How many accounts do you have?](https://stackoverflow.com/q/66724452/2587435) – Paul Samsotha Mar 20 '21 at 21:03
  • I was facing some issue in this account so created new account just to ask that question then I recovered my original account. – user3629 Mar 21 '21 at 04:22

0 Answers0