1

I just started learning Webservices using JAX-RS in Java. My webservice URL is

http://localhost:8080/test/testWebservcie

That is working fine. Just to play around with it I added '/' at end of the URL like below

http://localhost:8080/test/testWebservcie/

even that is working fine and no issues at all. What is the differences between those two ? can I replace one with another ?

user3786942
  • 163
  • 1
  • 2
  • 7
  • there's no practical difference, unless the server's coders were particularly anal and insist on one or the other. – Marc B Aug 13 '14 at 20:13
  • Possible duplicate of [Trailing slash in URLs - which style is preferred?](http://stackoverflow.com/questions/5948659). It makes e.g. a difference if you want to `java.net.URI("http://localhost:8080/test/testWebservcie/").resolve("foo")`: `testWebservcie/` is handled as directory so you'll get `http://localhost:8080/test/testWebservcie/foo`. Without trailing slash `testWebservcie` is not handled as directory so you are resolving against `/test/` and the result is `http://localhost:8080/test/foo`. – lefloh Aug 14 '14 at 09:59

1 Answers1

0

Generally there is none.

This is usually true of extensions as well, for example, the project I am on has us posting to a .json url. Personally, I think that is stupid and removed the .json and it works fine.

HOWEVER If the coder on the server side was a stickler, he could code it in such a way that only one is valid.

TL;DL They are the same unless someone has gone out of their way to make them not.

r2DoesInc
  • 3,759
  • 3
  • 29
  • 60