0

I have a url with below pattern for passing data with get method to my rest web server developed by jersey: http://localhost:8080/myprojectName/resrtApp/request?Name=$Name&LastName=$LastName&Message=$Message&UserId=$UserId

when I used '#' character in the end of Message field, the UserId field, passed null to web server. how can I fix this problem? I have to use # sign in the end of Message!!

this is my code for getting parameters:

@POST
@Path("/request")
@Produces(MediaType.APPLICATION_XML + ";charset=utf-8")
public UserResponse getUsers(@QueryParam("Name") String Name,
                               @QueryParam("LastName") String LastName,
                               @QueryParam("Message") String Message,
                               @QueryParam("UserId") String UserId
) {

// simple code }

zorro6064
  • 484
  • 2
  • 7
  • 18
  • Possible duplicate of [How to escape hash character in URL](http://stackoverflow.com/questions/5007352/how-to-escape-hash-character-in-url) – dotvav Nov 02 '15 at 13:41
  • how can I replace # with %23 in my application? – zorro6064 Nov 02 '15 at 13:48
  • I'm not sure what objects you are manipulating since you have not posted your code. If your URL is in a `String`, then you may use the `replaceAll` method. For example `url.replaceAll("#", "%23");` – dotvav Nov 02 '15 at 13:51
  • I edited the question for adding my code, I don't know where should I replace the url? – zorro6064 Nov 02 '15 at 14:01
  • 2
    I believe you have posted some server-side code. `#` must be escaped on the client side. – dotvav Nov 02 '15 at 14:34

0 Answers0