use of jakarta.ws.rs.HeaderParam in project resteasy by resteasy.
the class ProcessorFactory method createProcessor.
public static Object createProcessor(Class<?> declaring, String defaultParameterName, ClientConfiguration configuration, Class<?> type, Annotation[] annotations, Type genericType, AccessibleObject target, MediaType defaultConsumes, boolean ignoreBody) {
Object processor = null;
QueryParam query;
org.jboss.resteasy.annotations.jaxrs.QueryParam queryParam2;
HeaderParam header;
org.jboss.resteasy.annotations.jaxrs.HeaderParam header2;
MatrixParam matrix;
org.jboss.resteasy.annotations.jaxrs.MatrixParam matrix2;
PathParam uriParam;
org.jboss.resteasy.annotations.jaxrs.PathParam uriParam2;
CookieParam cookie;
org.jboss.resteasy.annotations.jaxrs.CookieParam cookie2;
FormParam formParam;
org.jboss.resteasy.annotations.jaxrs.FormParam formParam2;
// Form form;
boolean isEncoded = FindAnnotation.findAnnotation(annotations, Encoded.class) != null;
if ((query = FindAnnotation.findAnnotation(annotations, QueryParam.class)) != null) {
processor = new QueryParamProcessor(query.value(), genericType, annotations, configuration);
} else if ((queryParam2 = FindAnnotation.findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.QueryParam.class)) != null) {
processor = new QueryParamProcessor(getParamName(defaultParameterName, queryParam2.value()), genericType, annotations, configuration);
} else if ((header = FindAnnotation.findAnnotation(annotations, HeaderParam.class)) != null) {
processor = new HeaderParamProcessor(header.value(), genericType, annotations, configuration);
} else if ((header2 = FindAnnotation.findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.HeaderParam.class)) != null) {
processor = new HeaderParamProcessor(getParamName(defaultParameterName, header2.value()), genericType, annotations, configuration);
} else if ((cookie = FindAnnotation.findAnnotation(annotations, CookieParam.class)) != null) {
processor = new CookieParamProcessor(cookie.value(), genericType, annotations);
} else if ((cookie2 = FindAnnotation.findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.CookieParam.class)) != null) {
processor = new CookieParamProcessor(getParamName(defaultParameterName, cookie2.value()), genericType, annotations);
} else if ((uriParam = FindAnnotation.findAnnotation(annotations, PathParam.class)) != null) {
processor = new PathParamProcessor(uriParam.value(), isEncoded, genericType, annotations, configuration);
} else if ((uriParam2 = FindAnnotation.findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.PathParam.class)) != null) {
processor = new PathParamProcessor(getParamName(defaultParameterName, uriParam2.value()), isEncoded, genericType, annotations, configuration);
} else if ((matrix = FindAnnotation.findAnnotation(annotations, MatrixParam.class)) != null) {
processor = new MatrixParamProcessor(matrix.value(), genericType, annotations, configuration);
} else if ((matrix2 = FindAnnotation.findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.MatrixParam.class)) != null) {
processor = new MatrixParamProcessor(getParamName(defaultParameterName, matrix2.value()), genericType, annotations, configuration);
} else if ((formParam = FindAnnotation.findAnnotation(annotations, FormParam.class)) != null) {
processor = new FormParamProcessor(formParam.value(), genericType, annotations, configuration);
} else if ((formParam2 = FindAnnotation.findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.FormParam.class)) != null) {
processor = new FormParamProcessor(getParamName(defaultParameterName, formParam2.value()), genericType, annotations, configuration);
} else if ((/* form = */
FindAnnotation.findAnnotation(annotations, Form.class)) != null) {
processor = new FormProcessor(type, configuration, defaultParameterName);
} else if ((/* form = */
FindAnnotation.findAnnotation(annotations, BeanParam.class)) != null) {
processor = new FormProcessor(type, configuration, defaultParameterName);
} else if ((FindAnnotation.findAnnotation(annotations, Context.class)) != null) {
processor = null;
} else if (type.equals(Cookie.class)) {
processor = new CookieParamProcessor(null);
} else // this is for HATEAOS clients
if (FindAnnotation.findAnnotation(annotations, ClientURI.class.getName()) != null) {
processor = new URIParamProcessor();
} else if (!ignoreBody) {
MediaType mediaType = MediaTypeHelper.getConsumes(declaring, target);
if (mediaType == null)
mediaType = defaultConsumes;
if (mediaType == null) {
throw new RuntimeException(Messages.MESSAGES.mustDefineConsumesType());
}
processor = new MessageBodyParameterProcessor(mediaType, type, genericType, annotations);
}
return processor;
}
use of jakarta.ws.rs.HeaderParam in project resteasy by resteasy.
the class MethodMetaData method processMetaData.
protected void processMetaData(Class<?> type, Annotation[] annotations, boolean useBody) {
QueryParam query;
HeaderParam header;
MatrixParam matrix;
PathParam uriParam;
CookieParam cookie;
FormParam formParam;
Form form;
if ((query = FindAnnotation.findAnnotation(annotations, QueryParam.class)) != null) {
addParameter(type, annotations, MethodParamType.QUERY_PARAMETER, query.value());
} else if ((header = FindAnnotation.findAnnotation(annotations, HeaderParam.class)) != null) {
addParameter(type, annotations, MethodParamType.HEADER_PARAMETER, header.value());
} else if ((cookie = FindAnnotation.findAnnotation(annotations, CookieParam.class)) != null) {
addParameter(type, annotations, MethodParamType.COOKIE_PARAMETER, cookie.value());
} else if ((uriParam = FindAnnotation.findAnnotation(annotations, PathParam.class)) != null) {
addParameter(type, annotations, MethodParamType.PATH_PARAMETER, uriParam.value());
} else if ((matrix = FindAnnotation.findAnnotation(annotations, MatrixParam.class)) != null) {
addParameter(type, annotations, MethodParamType.MATRIX_PARAMETER, matrix.value());
} else if ((formParam = FindAnnotation.findAnnotation(annotations, FormParam.class)) != null) {
addParameter(type, annotations, MethodParamType.FORM_PARAMETER, formParam.value());
this.wantsForm = true;
} else if ((form = FindAnnotation.findAnnotation(annotations, Form.class)) != null) {
if (type == Map.class || type == List.class) {
addParameter(type, annotations, MethodParamType.FORM, form.prefix());
this.wantsForm = true;
} else
walkForm(type);
} else if ((FindAnnotation.findAnnotation(annotations, Context.class)) != null) {
// righfully ignore
} else if (useBody) {
addParameter(type, annotations, MethodParamType.ENTITY_PARAMETER, null);
}
}
use of jakarta.ws.rs.HeaderParam in project resteasy by resteasy.
the class ResteasyWadlMethodMetaData method processMetaData.
protected void processMetaData(Class<?> type, Annotation[] annotations, boolean useBody) {
QueryParam queryParam;
HeaderParam headerParam;
MatrixParam matrixParam;
PathParam pathParam;
CookieParam cookieParam;
FormParam formParam;
Form form;
if ((queryParam = FindAnnotation.findAnnotation(annotations, QueryParam.class)) != null) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.QUERY_PARAMETER, queryParam.value());
} else if ((headerParam = FindAnnotation.findAnnotation(annotations, HeaderParam.class)) != null) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.HEADER_PARAMETER, headerParam.value());
} else if ((cookieParam = FindAnnotation.findAnnotation(annotations, CookieParam.class)) != null) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.COOKIE_PARAMETER, cookieParam.value());
} else if ((pathParam = FindAnnotation.findAnnotation(annotations, PathParam.class)) != null) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.PATH_PARAMETER, pathParam.value());
} else if ((matrixParam = FindAnnotation.findAnnotation(annotations, MatrixParam.class)) != null) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.MATRIX_PARAMETER, matrixParam.value());
} else if ((formParam = FindAnnotation.findAnnotation(annotations, FormParam.class)) != null) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.FORM_PARAMETER, formParam.value());
this.wantsForm = true;
} else if ((form = FindAnnotation.findAnnotation(annotations, Form.class)) != null) {
if (type == List.class) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.FORM, form.prefix());
this.wantsForm = true;
} else if (type == Map.class) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.FORM, form.prefix());
this.wantsForm = true;
} else
walkForm(type);
} else if ((FindAnnotation.findAnnotation(annotations, Context.class)) != null) {
// righfully ignore
} else if (useBody) {
addParameter(type, annotations, ResteasyWadlMethodParamMetaData.MethodParamType.ENTITY_PARAMETER, null);
}
}
use of jakarta.ws.rs.HeaderParam in project resteasy by resteasy.
the class InjectorFactoryImpl method createParameterExtractor0.
private ValueInjector createParameterExtractor0(Class injectTargetClass, AccessibleObject injectTarget, String defaultName, Class type, Type genericType, Annotation[] annotations, boolean useDefault, ResteasyProviderFactory providerFactory) {
DefaultValue defaultValue = findAnnotation(annotations, DefaultValue.class);
boolean encode = findAnnotation(annotations, Encoded.class) != null || injectTarget.isAnnotationPresent(Encoded.class) || type.isAnnotationPresent(Encoded.class);
String defaultVal = null;
if (defaultValue != null)
defaultVal = defaultValue.value();
QueryParam queryParam;
HeaderParam header;
MatrixParam matrix;
PathParam uriParam;
CookieParam cookie;
FormParam formParam;
Form form;
if ((queryParam = findAnnotation(annotations, QueryParam.class)) != null) {
return new QueryParamInjector(type, genericType, injectTarget, queryParam.value(), defaultVal, encode, annotations, providerFactory);
} else if (findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.QueryParam.class) != null) {
return new QueryParamInjector(type, genericType, injectTarget, defaultName, defaultVal, encode, annotations, providerFactory);
} else if (findAnnotation(annotations, Query.class) != null) {
return new QueryInjector(type, providerFactory);
} else if ((header = findAnnotation(annotations, HeaderParam.class)) != null) {
return new HeaderParamInjector(type, genericType, injectTarget, header.value(), defaultVal, annotations, providerFactory);
} else if (findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.HeaderParam.class) != null) {
return new HeaderParamInjector(type, genericType, injectTarget, defaultName, defaultVal, annotations, providerFactory);
} else if ((formParam = findAnnotation(annotations, FormParam.class)) != null) {
return new FormParamInjector(type, genericType, injectTarget, formParam.value(), defaultVal, encode, annotations, providerFactory);
} else if (findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.FormParam.class) != null) {
return new FormParamInjector(type, genericType, injectTarget, defaultName, defaultVal, encode, annotations, providerFactory);
} else if ((cookie = findAnnotation(annotations, CookieParam.class)) != null) {
return new CookieParamInjector(type, genericType, injectTarget, cookie.value(), defaultVal, annotations, providerFactory);
} else if (findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.CookieParam.class) != null) {
return new CookieParamInjector(type, genericType, injectTarget, defaultName, defaultVal, annotations, providerFactory);
} else if ((uriParam = findAnnotation(annotations, PathParam.class)) != null) {
return new PathParamInjector(type, genericType, injectTarget, uriParam.value(), defaultVal, encode, annotations, providerFactory);
} else if (findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.PathParam.class) != null) {
return new PathParamInjector(type, genericType, injectTarget, defaultName, defaultVal, encode, annotations, providerFactory);
} else if ((form = findAnnotation(annotations, Form.class)) != null) {
String prefix = form.prefix();
if (prefix.length() > 0) {
if (genericType instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) genericType;
if (Types.isA(List.class, pType)) {
return new ListFormInjector(type, Types.getArgumentType(pType, 0), prefix, providerFactory);
}
if (Types.isA(Map.class, pType)) {
return new MapFormInjector(type, Types.getArgumentType(pType, 0), Types.getArgumentType(pType, 1), prefix, providerFactory);
}
}
return new PrefixedFormInjector(type, prefix, providerFactory);
}
return new FormInjector(type, providerFactory);
} else if (findAnnotation(annotations, BeanParam.class) != null) {
return new FormInjector(type, providerFactory);
} else if ((matrix = findAnnotation(annotations, MatrixParam.class)) != null) {
return new MatrixParamInjector(type, genericType, injectTarget, matrix.value(), defaultVal, encode, annotations, providerFactory);
} else if (findAnnotation(annotations, org.jboss.resteasy.annotations.jaxrs.MatrixParam.class) != null) {
return new MatrixParamInjector(type, genericType, injectTarget, defaultName, defaultVal, encode, annotations, providerFactory);
} else if (findAnnotation(annotations, Context.class) != null) {
return new ContextParameterInjector(null, type, genericType, annotations, providerFactory);
} else if (findAnnotation(annotations, Suspended.class) != null) {
return new AsynchronousResponseInjector();
} else if (jakarta.ws.rs.container.AsyncResponse.class.isAssignableFrom(type)) {
return new AsynchronousResponseInjector();
} else if (useDefault) {
return new MessageBodyParameterInjector(injectTargetClass, injectTarget, type, genericType, annotations, providerFactory);
} else {
return null;
}
}
use of jakarta.ws.rs.HeaderParam in project jans by JanssenProject.
the class Fido2DeviceWebService method deleteF2Device.
@Path("{id}")
@DELETE
@Produces({ MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT })
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi(scopes = { "https://jans.io/scim/fido2.write" })
public Response deleteF2Device(@PathParam("id") String id) {
Response response;
try {
log.debug("Executing web service method. deleteDevice");
GluuFido2Device device = fidoDeviceService.getFido2DeviceById(null, id);
if (device == null)
return notFoundResponse(id, fido2ResourceType);
response = externalConstraintsService.applyEntityCheck(device, null, httpHeaders, uriInfo, HttpMethod.DELETE, fido2ResourceType);
if (response != null)
return response;
fidoDeviceService.removeFido2Device(device);
response = Response.noContent().build();
} catch (Exception e) {
log.error("Failure at deleteDevice method", e);
response = getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
return response;
}
Aggregations