0

I'm using spring Data REST . (http://www.springsource.org/spring-data/rest)

My entity id contains "/" in it so trying to do a GET on my entity with entityId(e.g. "thisisanentity/idwithaslashinIt") as path parameter, spring is unable to fetch the correct entity. I get a HTTP 404 in both the cases below.

e.g. GET /myentity/thisisanentity/idwithaslashinIt HTTP 404(doesnt work with slash in entityId)

URL encoding doesent seem to help either.

i.e. GET /myentity/thisisanentity%2FidwithaslashinIt HTTP 404(doesnt work even with slash replaced with %2F)

Is there anyway to change default behaviour of path Parameters to sucessfully extract everything after "/myentity/" ?

Also how do i PUT(update) an entity since my entityId has slashes in it?

javarebel
  • 160
  • 1
  • 9

1 Answers1

0

You didn't mention which database you are accessing, but I think it may be a problem with the database, rather than the spring API. Try to escape the slash before storing it in the database. Also, try to access the entity from a browser/standalone client.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • im using ms sql server. it is a legacy db, so i cannot escape the slash before storing. the data in the tables already have slash. its not a problem with the db, if i unit test the spring repository using junits it works, but if i come through the rest layer i get a 404. – javarebel Feb 05 '13 at 06:32
  • Why do you access the database with REST, rather than using SQL? – Bozho Feb 05 '13 at 09:06
  • @Bozho could you have a look at this question, thank you! http://stackoverflow.com/questions/19032798/spring-soap-no-adapter-for-endpoint-error – Spring Sep 26 '13 at 16:12