sto sviluppando una web app in cui ho un modulo del genereUtilizzando Jersey di leggere i dati dei moduli
<form name="form" action="create-user" method="post">
<input name="accept" type="checkbox"><span>{{acceptLegalTerms}}</span><br>
<input type="submit" value="{{Continue}}" class="primary fright"/>
</form>
Sul lato server, Stiamo usando Jersey (su GAE). Ed ecco quello che sto cercando di usare per leggere i valori POST
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("create-user")
public Response createUser(@FormDataParam("accept") boolean acceptForm) {
return Response.ok().entity(acceptForm).build();
}
Ma non funziona ... Mi torna ...
HTTP ERROR 415
Problem accessing /login/create-user. Reason:
Unsupported Media Type
Tutte le idee? Che cosa sto facendo di sbagliato?
Grazie!
Avrai bisogno anche di [jersey-multipart] (http://search.maven.org/#search|ga|1|a%3A%22jersey-multipart%22). –
@DrewStephens È possibile avere un singolo percorso che serve sia urlencode sia richieste POST multiparto? http://stackoverflow.com/questions/19104413/jersey-switch-on-content-type-dynamically –
C'è un modo per inviare il modulo con 10 campi, ma senza aggiungere 10 linee '@ FormParam' –