boolean isRestfulData = RestfulData.class.isInstance(annotation);
boolean isCookie = CookieParam.class.isInstance(annotation);
if (!isRestfulData && !isCookie)
continue;
HttpRequest request = RequestUtil.getHttpRequest(servletRequest);
Class type = methodParameter.getParameterType();
Method method = methodParameter.getMethod();
Type genericType = method.getGenericParameterTypes()[i];
Annotation[] annotations = method.getParameterAnnotations()[i];
if (isRestfulData)
{
method.getTypeParameters();
String contentType = servletRequest.getContentType();
MediaType mediaType = MediaType.valueOf(contentType);
MessageBodyReader reader = factory.getMessageBodyReader(type,
genericType, annotations, mediaType);
if (reader == null)
throw new BadRequestException(
"Could not find message body reader for type: "
+ genericType + " of content type: " + mediaType);
return reader.readFrom(type, genericType, annotations, mediaType,
request.getHttpHeaders().getRequestHeaders(), request
.getInputStream());
}
else if (isCookie)
{
CookieParam cookieParam = (CookieParam) annotation;