ü If two resource methods are there with the same http method
designators then the jax-rs runtime can't pass the request, it runs into
ambiguous state. This behavior will be changing from one vendor to the vendor. If
it is jersy we will get ambiguous problem and if it is rest easy then the first
method will be called.
ü To solve this problem we should go for Path parameters, so
each and every method should also be annotated with the "@Path"
annotation. The methods which are annotated with @Path ("") along
with the http method designators are called "sub resource methods”. We
can't access the sub resource methods with the resource URL we should send sub
resource Uri also.
ü When we are working with @Path ("") along with the
@QueryParam ("") then the query parameters are optional. But if we
want to mandate the query parameters then we should go for @PathParam
("") annotation. Path parameters should be declared in @Path annotation
and should be referred as parameters.
ü If we want to validate the data before the method is being
called by the jax-rs runtime then we should go for path expressions. Path
expressions are optional, if we don't specify any path expression the default
expression is @Path ("/seats/ {train-no :\\.+}").
ü If we don't specify the path expression, then the jersy
runtime tries to call the resource method, and tries to map the query data into
the parameter if both are not compatible then it throws an
"exception", but resteasy runtime will suppress the exception it will
not give any result.
ü If we specify the path expression then jersy will not call
the method before calling it validates the data, if the data is not compatible
then it will not throw any exception just returns "404 error page".
But the rest easy runtime even will not display 404 page just it suppress it.
Program:

No comments:
Post a Comment