• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring Path Variable Issue

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have defined a rest request Handler like this

@RequestMapping(value="/{userId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML)
public @ResponseBody
Domain getUserProfile(@PathVariable String userId) throws XmlException{


It works like /api/users/abc@xyz.com/ but not /api/users/abc@xyz.com, not able to figure out what exactly is the reason.
 
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you meant to say that with extra / it is not working?
 
Ram Para
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This one is working

/api/users/abc@xyz.com/


and

/api/users/abc@xyz.com
is not and throwing 406 exception.
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpMediaTypeNotAcceptableException: 406 Not Acceptable


is not the same as:

NoSuchRequestHandlingMethodException 404 Not Found
HttpRequestMethodNotSupportedException 405 Method not Allowed
HttpMediaTypeNotSupportedException 415 Unsupported Media Type

Have a check again, use TCP/IP mon to see what client send up to the server:
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic