eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
691 stars 357 forks source link

Parameter Validation #623

Open jerseyrobot opened 15 years ago

jerseyrobot commented 15 years ago

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<String, String> 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

jerseyrobot commented 6 years ago
jerseyrobot commented 15 years ago

@glassfishrobot Commented Reported by dirkm@java.net

jerseyrobot commented 13 years ago

@glassfishrobot Commented ccamel said: This feature will be great.

I think it would be interesting to use a set of annotations derived from JSR-305.

jerseyrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JERSEY-351