@Provider public class PasswordConverterProvider extends Object implements javax.ws.rs.ext.ParamConverterProvider
@POST
public String login
( @FormParam("username") String userName,
@FormParam("password") Password pwd) {
// ...
}
List<Password>, use instead :
@POST
public String registerNewUser
( @FormParam("username") String userName,
@FormParam("password") PasswordParam pwd) {
// ...
}
As a Provider, this class has to be registered to the application manually, or
by setting on the lookup mechanism of the underlying JAX-RS implementation.
Note that at the invocation stage, the password string passed to the converter is a dummy
string not involved in the conversion process.FormParam,
HeaderParam,
QueryParam| Constructor and Description |
|---|
PasswordConverterProvider() |
| Modifier and Type | Method and Description |
|---|---|
<T> javax.ws.rs.ext.ParamConverter<T> |
getConverter(Class<T> rawType,
Type genericType,
Annotation[] annotations) |
protected void |
processQueryParam(javax.ws.rs.QueryParam passwordFieldAnnotation)
This method is called during annotation processing when a password
field is annotated with @QueryParam, and throws
a security exception.
|
public <T> javax.ws.rs.ext.ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations)
getConverter in interface javax.ws.rs.ext.ParamConverterProviderprotected void processQueryParam(javax.ws.rs.QueryParam passwordFieldAnnotation)
throws SecurityException
passwordFieldAnnotation - The annotation.SecurityException - By default, this implementation throw a security exceptionCopyright © 2018 Alternet. All rights reserved.