eclipse-ee4j / eclipse-ee4j/jersey

Parameter Validation

Open
#623 4 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

Add more flexible parameter validation to Jersey.

In particular, the solution should at least include the ability to check if a
parameter is present and raise an error if is not.
In general and eventually the solution should allow flexible parameter validation.

Possible solutions:

1) Jersey supports an @Required annotation; or

2) Exposes a lower-level abstraction of MultivaluedParameterExtractor
(which is an internally used interface):

public interface MultivaluedParameterExtractor

{ Object extract(MultivaluedMap parameters); }

public interface MultivaluedParameterExtractorProvider { }

public interface MultivaluedParameterExtractorWorkers { }

and the same type of pattern can be utilized.

3) One can utilize AOP method-level interceptors to support @Required
and check for a null value. This solution is much better if one needs to take
into account more than one value.

I also wonder if there is a more general approach to parameter
validation we can apply with the bean validation framework.
#### Environment
Operating System: All
Platform: All
URL: [http://n2.nabble.com/Required-parameters-on-a-Resource-td3446928.html](http://n2.nabble.com/Required-parameters-on-a-Resource-td3446928.html)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.