You need to encode your url like:
http://localhost:7001/Rest/GetInfo?type=J%26Y
How to pass and read & in @QueryParam Jax-RS
-
11-10-2022 - |
Domanda
I have a Rest Service accepting QueryParam and the value has & in it and how do i pass it and accept it as a Query Param.
Here i am attaching the source i used. i am calling the same by
http://localhost:7001/Rest/GetInfo?type=J&Y
as & is the seperator its taking only till J.
if i use "\" then its not working.
http://localhost:7001/Rest/GetInfo?type=J\&Y
I am deploying on Weblogic.
@GET
@Path("/GetInfo")
//@Produces("text/javascript")
@Produces("application/json")
public String getInfo(@QueryParam("type") String type)
{
// i am reading the type here
if(type != null
getUserType(type)
}
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow