private void setHeaders(MultivaluedMap<String, Object> headers) { this.headers = headers; Object location = headers.getFirst(HttpHeaders.LOCATION); if (location != null) { if (location instanceof URI) { final URI locationUri = (URI) location; if (!locationUri.isAbsolute()) { final URI base = (statusType.getStatusCode() == Status.CREATED.getStatusCode()) ? request.getAbsolutePath() : request.getBaseUri(); location = UriBuilder.fromUri(base) .path(locationUri.getRawPath()) .replaceQuery(locationUri.getRawQuery()) .fragment(locationUri.getRawFragment()) .build(); } headers.putSingle(HttpHeaders.LOCATION, location); } } }
@Override public int getStatus() { return statusType.getStatusCode(); }