Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6695557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:14:09+00:00 2026-05-26T06:14:09+00:00

I have the following 2 methods… @GET @Path(/{solution}) public Response test(@PathParam(solution) String solution, @Context

  • 0

I have the following 2 methods…

@GET
@Path("/{solution}")
public Response test(@PathParam("solution") String solution,
        @Context UriInfo uriInfo, @Context HttpHeaders headers);

@GET
@Path("/{solution}/{path:[a-z0-9/\\-]*}")
public Response testTest(@PathParam("solution") String solution,
        @PathParam("path") String nodePath,
        @Context UriInfo uriInfo, @Context HttpHeaders headers);

When I call /my-app/test/test the second method gets called and the parameters set correctly. When I call /my-app/test instead of the first method getting called I receive a HTTP 405 Method Not Found. I’m assuming it’s mapping the URL to one of the other methods eg.

@DELETE
@Path("{path: [a-z0-9/\\-]*}")
public Response deleteTest(@PathParam("path") String path, @Context HttpHeaders headers);

Anyone spot what I’ve done wrong? Anyone got any tips for finding out which method jersey is trying to map to?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:14:10+00:00Added an answer on May 26, 2026 at 6:14 am

    With the 3 methods defined as above you essentially have 3 resources:

    • /{solution}
    • /{solution}/{path:[a-z0-9/\-]*}
    • {path: [a-z0-9/\-]*}

    When Jersey matches the request to resource methods, it first determines which resource (i.e. URI pattern) it should be mapped to. The third one is the most specific one that matches the request URL, so that one is matched. Only then Jersey looks if a corresponding HTTP method is handled for that resource. This is in compliance with the JAX-RS specification – you can see the detailed description of the matching algorithm in the spec here: http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2

    So, you should think about the logical resources, have the URI templates match them and then implement the corresponding HTTP methods for these. I.e. if “/{solution}” and “/{solution}/{path:[a-z0-9/\-]*}” are logically two distinct resources, and both should support @DELETE, you should define two delete operations, one with the first template and the other one with the second URI template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following methods: public int CountProperty1 { get { int count =
I have following two methods in my backing bean - public String validateUser() {
I have the following methods: public <T> T fromJson( Reader jsonData, Class<T> clazz )
I have the following methods: protected static void updateExistingSection(XmlDocument doc, XmlNode rootNode, string sectionTag,
Suppose I have the following methods declared in my web service: @WebMethod() public Long
Scenario I have the following methods: public void AddItemSecurity(int itemId, int[] userIds) public int[]
Say I have the following methods: public static void MyCoolMethod(params object[] allObjects) { }
I have the following methods: ShowMessage (string text, string caption) {...} ShowMessage (string formatText,
I have the following methods at my disposal: A method to get the running
I have the following methods in my simple Custom Parser Class, when I execute

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.