Skip to content

Commit

Permalink
Don't use RuntimeDelegate in ResponseHandler
Browse files Browse the repository at this point in the history
This is needed in order to avoid getting CCE
when other implementations of Jakarta REST are
on the classpath

Closes: quarkusio#36024
(cherry picked from commit c636df6)
  • Loading branch information
geoand authored and aloubyansky committed Oct 31, 2023
1 parent 8449c98 commit 7f3dee5
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 7f3dee5

Please sign in to comment.