Skip to content

Commit

Permalink
Merge pull request #36025 from geoand/#36024
Browse files Browse the repository at this point in the history
Don't use RuntimeDelegate in ResponseHandler
  • Loading branch information
geoand authored Sep 20, 2023
2 parents 6fb2d3f + c636df6 commit c19faac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ public Response get() {
if (result instanceof GenericEntity) {
GenericEntity<?> genericEntity = (GenericEntity<?>) result;
requestContext.setGenericReturnType(genericEntity.getType());
responseBuilder = (ResponseBuilderImpl) ResponseImpl.ok(genericEntity.getEntity());
responseBuilder = ResponseBuilderImpl.ok(genericEntity.getEntity());
} else if (result == null) {
// FIXME: custom status codes depending on method?
responseBuilder = (ResponseBuilderImpl) ResponseImpl.noContent();
responseBuilder = ResponseBuilderImpl.noContent();
} else {
// FIXME: custom status codes depending on method?
responseBuilder = (ResponseBuilderImpl) ResponseImpl.ok(result);
responseBuilder = ResponseBuilderImpl.ok(result);
}
if (responseBuilder.getEntity() != null) {
EncodedMediaType produces = requestContext.getResponseContentType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ protected AbstractResponseBuilder doClone() {

//TODO: add the rest of static methods of Response if we need them

public static Response.ResponseBuilder withStatus(Response.Status status) {
return new ResponseBuilderImpl().status(status);
public static ResponseBuilderImpl withStatus(Response.Status status) {
return (ResponseBuilderImpl) new ResponseBuilderImpl().status(status);
}

public static Response.ResponseBuilder ok() {
public static ResponseBuilderImpl ok() {
return withStatus(Response.Status.OK);
}

public static Response.ResponseBuilder ok(Object entity) {
return ok().entity(entity);
public static ResponseBuilderImpl ok(Object entity) {
return (ResponseBuilderImpl) ok().entity(entity);
}

public static Response.ResponseBuilder noContent() {
public static ResponseBuilderImpl noContent() {
return withStatus(Response.Status.NO_CONTENT);
}
}

0 comments on commit c19faac

Please sign in to comment.