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 8347591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:24:20+00:00 2026-06-09T07:24:20+00:00

I have a controller with two methods. One to delete a user another to

  • 0

I have a controller with two methods. One to delete a user another to remove a user from a role.

    @Controller
    @RequestMapping(value="/rest/users/**")
    public class UsersCtrlr {

        @RequestMapping(value="/{username:.+}", method=RequestMethod.DELETE)
        public @ResponseBody HttpStatusDoc deleteUser(HttpServletRequest req, @PathVariable String username) {
         ...
        }

        @RequestMapping(value="/{username:.+}/roles/{role:.+}", method=RequestMethod.DELETE)
        public @ResponseBody HttpStatusDoc deleteUserRole(HttpServletRequest req, @PathVariable String username, @PathVariable String role) {
         ...
        }
    }

My front end makes a jquery ajax call with a url as follows:

/rest/users/jdoe@foo.com/roles/some_role

This uri is being mapped to the deleteUser method with a username equal to some_role

I’m trying to get the uri to map to the deleteUserRole and have the username set to jdoe@foo.com and role set to some_role.

Why won’t the uri map to the deleteUserRole?
Does it have something to do with the regular expressions in the RequestMappings?

  • 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-06-09T07:24:21+00:00Added an answer on June 9, 2026 at 7:24 am

    It is likely because of ** in your class @RequestMapping annotation , your mapping for deleteUser will be /rest/users/**/{username:.+} and for deleteUserRole will be /rest/users/**/{username:.+}/roles/{role:.+} and the first one will match up to /rest/users/jdoe@foo.com/roles/some_role pattern. It should work if ** is removed from the class @RequestMapping annotation

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

Sidebar

Related Questions

I have two ajax calls. Both are sync. Both call methods from one controller.
If I have a Spring Controller with two SEPARATE methods, one annotated by: @ExceptionHandler(Exception.class)
Can somebody explain me one thing. I have two methods in my controller :
In my Asp.net MVC app, I have two methods on a controller, one for
I have a Controller with two Edit methods (see below). When I submit the
I have a model called Details, and two controller methods new and create. New
lets say I have two methods in my controller to support both json and
Let say I have two methods in MVC 4 Web API controller: public IQueryable<A>
I have two Controller unit tests and each one sets an HttpClient metaclass execute
I have two view controller classes in my application delegate. I can change from

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.