Consider the following code sending an HTTP 201 \"Created\" response to the client:
String url = \"/app/things?id=42\"; // example response.setStatus(Htt
You might try
new URL(new URL(request.getRequestURL().toString()), url).toString();
That will at least be smart about canonicalizing away any .. or other oddities. Other than that, I don't think it's much better than string manipulation.
..