public ResponseBuilder location(URI location) {
if (location == null) {
headers.remove(HttpHeaders.LOCATION);
}
try {
UriInfo uriInfo = new UriInfoImpl(JaxRsHandler.localRequest.get());
URL baseUrl = uriInfo.getBaseUri().toURL();
URL absolutizedUrl = new URL(baseUrl, location.toString());
headers.putSingle(HttpHeaders.LOCATION, absolutizedUrl.toString());
return this;
} catch (MalformedURLException ex) {
throw new RuntimeException(ex);