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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:06:35+00:00 2026-06-08T15:06:35+00:00

I am curious if anybody can point me to a good example/best practice of

  • 0

I am curious if anybody can point me to a good example/best practice of organizing REST API code with versioning (uri-based, means "/v1/zzz" and "/v2/xxx" or even better something relying on Accept header) — in Java/Spring project? I am afraid I am making it too complicated in my project right now, so it’d be nice to learn from others.

Clarification: not sure if I should do it through filters, and then use some design pattern to change the behavior, but this will make my filter pretty complicated.. or may be I am not thinking about some trick with spring and DI, so I can make my code cleaner. the simplest approach is some strategy pattern in every method which will have different versioning, but it doesn’t seem to be too clean neither 🙁

  • 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-08T15:06:37+00:00Added an answer on June 8, 2026 at 3:06 pm

    I highly recommend reading the book and blogs on Apigee http://offers.apigee.com/api-design-ebook-bw/ I found that it gave me really practical advice for designing the urls and doing error handling.

    http://www.stormpath.com/blog/spring-mvc-rest-exception-handling-best-practices-part-2 has a really great article on how to configure spring mvc to do generic error handling for restful applications.

    As for filtering on accept headrs that is pretty easy to do since spring lets you narrow a handler method mapping based on the filter, as in the headers= in the request mapping below.

    @RequestMapping(value="/narrow/headers/{name}/{email}/{customerNumber}",
            method={RequestMethod.POST,RequestMethod.GET},
            headers="Referer=http://localhost:8080/SpringMVC/request-mappings.html")
    public ResponseEntity<String> narrowOnHeaders(
            @PathVariable("name")String name, 
            @PathVariable("email") String email, 
            @PathVariable("customerNumber") Integer customerNumber,
            @RequestHeader("Referer") String referer
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody provide some data showing the performance of code output by llvm's JIT,
I have a curious issue that I can't explain and was wondering if anybody
I'm curious, does anybody know a good way to do regular expression matching in
Curious if anybody has considered using EnumMap in place of Java beans, particularly value
Just curious, is there a format string I can use to output something like
Recently I have come across a curious pattern in some code. We know that
Anybody out there heard of Define Design Develop Deploy ? Just curious if someone
Does anybody know if it's possible to write the code in the catch block
I know you can override the model methods but I was curious as to
More curious than anything, but I'm wondering if anybody knows why this the scrollviewer

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.