0

I have some code making a @Path for an endpoint:

@Path("/productLine:[a-zA-Z]{1,25}}/cat")

I want to allow two word product lines in the URL. I tried this

@Path("productLine:[a-zA-Z ]{1,25}}/cat")

But the client returns a

HTTP 404 Not Found

when I use a request that has two words, like this:

/services/New Host/cat
Batiaev
  • 1,173
  • 1
  • 14
  • 30
Dave
  • 185
  • 1
  • 3
  • 13
  • 1
    A space is not a valid character in paths. See http://stackoverflow.com/questions/4669692/valid-characters-for-directory-part-of-a-url-for-short-links - at server level, it's represented as `%20` and I guess, that's also what you have to specify in your `@Path()`. Browsers will often show a space instead, because it's nicer for the user. But they should send `%20` under the hood. – zapl May 23 '16 at 17:44

2 Answers2

0

can u try with:

@Path("productLine:[a-zA-Z\x0B]{1,25}}/cat")
Stuk4
  • 33
  • 3
0

This worked:

@Path("productLine:[a-zA-Z%20]{1,25}}/cat")

The %20 is the HTTP encoding for space.

Dave
  • 185
  • 1
  • 3
  • 13