eclipse-ee4j / eclipse-ee4j/jersey

Need a replacement for JResponse<?> in order to provide metadata for the WADL/ Schema generator

Open
#2,819 3 comments 0 reactions 0 assignees View on GitHub
Component: core Priority: Major Type: Improvement
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

In Jersey 1.x you could have a method return JResponse rather than Response as this would allow the WADL generator to introspect the return value for a method to generate the right representation information.

In Jersey 2.x the only way to get this to work is to return Type and then throw a WebApplicationException in every case which is not a very pleasing design.

Ideally we would return to a JResponse like solution because it provides compile time checking, an alternative would be some kind of annotation; but of course this is not type safe.

The annotation could also be applied to any exceptions throw although it would be possible to extra type information if JReponse or similar came back as a subclass of WebApplicationException is used:

public WebErrorException extends WebApplicationException
{
public WebErrorException(JResponse respose)

{ super(response); }

public JResponse getReponse()

{ super.getResponse(); }

}

For error types, we probably need some way of specifying error code in some way. It would be possible to provide run time code at leaf that would verify the status of the response against the annotated code.
#### Affected Versions
[2.9]

Contributor guide

Open the contributing guide

Research direction

Begin by tracing Jersey 2.x handling of resource-method return types and the WADL/schema generator; the issue names no files or tests. Compare the proposed JResponse-like and annotation approaches, including error response metadata. Done means an agreed, type-safe replacement with defined coverage for success and error responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.