You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
I'm not entirely sure if this is an error with Spring or AA, but hopefully there's a fix for this.
The issue I'm having is that I want to replace FormHttpMessageConverter with a custom one, my code is this:
public class CustomFormHttpMessageConverter extends FormHttpMessageConverter
{
public CustomFormHttpMessageConverter()
{
List<MediaType> supportedMediaTypes = new ArrayList<>(getSupportedMediaTypes());
supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
supportedMediaTypes.add(MediaType.MULTIPART_FORM_DATA);
setSupportedMediaTypes(supportedMediaTypes);
List<HttpMessageConverter<?>> partConverters = new ArrayList<>();
partConverters.add(new ByteArrayHttpMessageConverter());
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
stringHttpMessageConverter.setWriteAcceptCharset(false);
partConverters.add(stringHttpMessageConverter);
partConverters.add(new ResourceHttpMessageConverter());
setPartConverters(partConverters);
}
}
But when compiling with these options for the rest template
The attached errors from the stacktrace happens, the only way I get this to work is to add the standard FormHttpMessageConverter after my custom one, then it's working as intended.
13:44:59.335 [Task worker for ':'] WARN o.a.i.p.ModelValidator:88 - Element note invalidated by FieldHandler
13:44:59.335 [Task worker for ':'] ERROR o.a.i.p.ModelValidator:77 - org.androidannotations.rest.spring.annotations.Field annotated method parameter must be in a @Rest annotated interface which uses at least one org.springframework.http.converter.FormHttpMessageConverter (or subtype)
Activity
dodgex commentedon Nov 28, 2017
Yeah. Looks like a bug in RestSpringValidatorHelper as the parameters are in wrong order.
dodgex commentedon Nov 28, 2017
I've openend a PR that should fix the issue