@Encoded

By default, the JAX-RS runtime decodes all the request parameters before injecting the extracted values into the target variables annotated with one of the following annotations: @FormParam, @PathParam, @MatrixParam, or @QueryParam. You can use @javax.ws.rs.Encoded to disable the automatic decoding of the parameter values. With the @Encoded annotation, the value of parameters will be provided in the encoded form itself. This annotation can be used on a class, method, or parameters. If you set this annotation on a method, it will disable decoding for all the parameters defined for this method. You can use this annotation on a class to disable decoding for all the parameters of all the methods. In the following example, the value of the name path parameter is injected into the method parameter in the URL encoded form (without decoding). The method implementation should take care of the decoding of the values in such cases:

@GET 
@Produces(MediaType.APPLICATION_JSON) 
public List<Department> 
findAllDepartmentsByName(@QueryParam("name") String deptName) { //Method body is removed for brevity }
URL encoding converts a string into a valid URL format, which may contain alphabetic characters, numerals, and some special characters supported in the URL string. To learn more about the URL specification, visit http://www.w3.org/Addressing/URL/url-spec.html.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.176.166