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

  • Home
  • SEARCH
  • 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 8387467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:13:09+00:00 2026-06-09T18:13:09+00:00

With Spring, how can i retrieve the following Controller attributes in the view? Controller

  • 0

With Spring, how can i retrieve the following Controller attributes in the view?

  • Controller name
  • Controller’s @RequestMapping URI
  • Action method name
  • Action method’s @RequestMapping URI

One approach which i have tried is by creating a subclass of HandlerInterceptorAdapter and overriding postHandle. I register my subclass as an mvc:interceptor for a list of given paths – which is clunky to maintain but was the only way to avoid my interceptor being called for ResourceHandler requests (which i don’t want). In my postHandle i can easily add the 2 name attributes, but not the URIs…

  1. Parsing from the HttpRequest object requires constraints on all Controller RequestMappings. I.e. i must always map /Controller/Action or equiv scheme. Quite limiting.
  2. Creating an ApplicationContext and querying that with the requestURI is too long-winded.

I am thinking about dropping the HandlerInterceptorAdapter and instead defining a BaseController for all my controllers to extend.

I wanted to ask before i do this, is there a better approach?

  • 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-09T18:13:10+00:00Added an answer on June 9, 2026 at 6:13 pm

    You haven’t stated why you need to do this (it sometimes helps to include your motivation, as others can suggest alternative approaches).

    But I’m guessing that the Spring 3.1 features loosely termed “end point documentation” may do what you are asking… See RequestMappingHandlerMapping in the Spring documentation which doesn’t provide a lot of detail, so this example project is the best place to see it in action:

    • Spring MVC 3.1 Demo App
    • example controller
    • example JSP page
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I retrieve a file from the following method: public void getJson(String pathToFile)
I have a spring controller with a request mapping as follows @RequestMapping(/downloadSelected) public void
I have a string value. NSString *myString = @Latitude:-31.9504140#Longitude:115.8606040; How can I retrieve the
I understand that spring can manage your sessions for you, if configured like so:
Is it possible to assure that only spring can instantiate a class, and not
This is just a curiosity question. I know that Spring can be used in
I can access Spring beans in my Servlets using WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); in
Can the Spring @Cacheable be configure so that if there is a cache miss
I want to use both ContextLoaderListener (so that I can pass Spring Beans to
Can I make the spring service classes final? Is there any harm doing that?

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.