I am new to Restful
services. I was going through a code and found this line
@GET
@Path("{image:image/.*}")
Can someone please explain the meaning and use of the above syntax?
I am new to Restful
services. I was going through a code and found this line
@GET
@Path("{image:image/.*}")
Can someone please explain the meaning and use of the above syntax?
The notation is known as URI path templates and described in the documentation.
You define a new template variable by declaring it within brackets
{}
. The JX-RS environment will bind the corresponding path segment from the requested URI to a declared@PathParam
handler method parameter.From the documentation
The documentation then goes on to specify the syntax for the notation
So your example
defines a URI template variable named
image
that contains a segment matching the regexThe JAX-RS environment will therefore use your annotated method for requests to URIs matching
Presumably, your method would have a parameter
and
path
would have a value of"image/[anything]"
.@Path
notation supports normal strings to match the path or a regex to match a pattern. In your caseseems to be just matching a pattern of
Correction: Refer to @Sotirios Delimanolis answer for complete details. Thanks mate for correction input.