2015-05-28 17 views
7

Ciao io sto usando Resto cliente cioè postino per inviare la richiesta REST ma ottenere errore:Operazioni non supportato errore tipo di supporto

{ 
    "timestamp": 1432829209385, 
    "status": 415, 
    "error": "Unsupported Media Type", 
    "exception": "org.springframework.web.HttpMediaTypeNotSupportedException", 
    "message": "Content type 'text/plain;charset=UTF-8' not supported", 
    "path": "/api/v1/user" 
} 

mio controller è:

@RequestMapping(value = "/user", method = RequestMethod.PUT, produces = "application/json") 
    public Map<String,Object> updateUser(@RequestBody @Valid User user) { 
//  userService.updateUser(user); 
     return ResponseHandler.generateResponse("", HttpStatus.ACCEPTED, false, null); 
    } 

sto trasmettendo la richiesta come mostrato in figura tramite client REST.

enter image description here

risposta

25

Cambia la tua Content-Type in Postman a application/json. Fare clic sul pulsante Intestazioni per farlo.

Inoltre non si sta producendo JSON nel metodo. Rimuovi il produces="application/json" dall'annotazione

+0

Intendi, cambia l'intestazione 'Accept'. –

Problemi correlati