I am having problem with below code saying 415 unsupported MEDIA type and The server refused this request because the request entity is in a format not supported
The problem is your method parameter type MultivaluedHashMap
public Activity createActivityParams(MultivaluedHashMap<String, String> formse){
The provider that handle application/x-www-form-urlencoded
and MultivaluedMap
, only supports MultivaluedMap
or MultivaluedMap<String, String>
injections. You can see in the source code
@Override
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
// Only allow types MultivaluedMap<String, String> and MultivaluedMap.
return type == MultivaluedMap.class
&& (type == genericType || mapType.equals(genericType));
}
So just change the method parameter to MultivaluedMap<String, String>