Recently, when writing a three-party service interface with the company framework , report errors Can not deserialize instance of java.util.ArrayList out
of VALUE_TRUE token

The service interface is defined as follows :
@Path("healthMonitorService") @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) public interface IHealthMonitorService {
    @POST     @Path("onSilent")     RestFacadeResp onSilent(List<Long>
list,Boolean open); }
Why use it @Consumes(MediaType.APPLICATION_JSON)

@Produces(MediaType.APPLICATION_JSON) And so on , Is to solve the company's internal framework and access to a three party open source framework serialization problem (hession Inconsistent version ).

Then the newly defined interface always reports an error Can not deserialize instance of java.util.ArrayList out of
VALUE_TRUE token,

If you change the interface to

    @POST
    @Path("onSilent")
    RestFacadeResp onSilent(List<Long> list);

You won't make a mistake , Later, we studied the following findings Restful Interface MediaType.APPLICATION_JSON Multiple request parameters are not supported
, Speaking of this, you should understand , Therefore, you can either customize a class package and use the above two parameters as attributes , realization Serializable Interface , Then pass the parameter to the custom class .( Another solution is not to MediaType.APPLICATION_JSON type , Change to form Form mode , Call through form Form submission , Study for yourself )

 

 

Technology