2016-04-25 13 views
0

Ich verwende dropwizard und jersey2 Rest Client und ichjersey2 derzeit keine Antwort Objekt

javax.ws.rs.BadRequestException: HTTP 400 Bad Request 

jedoch erhalten zurückzukehren, wenn ich die Protokollierung aktivieren I

DEBUG [2016-04-25 05:17:10,196] org.apache.http.wire: 
http-outgoing-0 << "{"apiVersion":"v1","timestamp":"April 24, 2016, 
10:17 pm","error":{"asiErrorCode":"12002","message":"A 
message","moreInfo":"http:\/\/bar.foo.net"}}" INFO [2016-04-25 
05:17:10,197] unknown.jul.logger: 1 * Client response received on 
thread main 1 < 400 1 < Access-Control-Allow-Headers: Accept, 
Content-Type, Authorization 1 < Access-Control-Allow-Methods: GET, 
POST, PUT, DELETE 1 < Access-Control-Allow-Origin: * 1 < Allow: 
OPTIONS,GET,POST,PUT,DELETE 1 < Cache-Control: no-cache, no-store, 
must-revalidate 1 < Connection: close 1 < Content-Length: 265 1 < 
Content-Type: application/json 1 < Date: Mon, 25 Apr 2016 05:17:10 
GMT 1 < Expires: 0 1 < Pragma: no-cache 1 < Server: Apache/2.4.12 
(Win32) OpenSSL/1.0.1m mod_jk/1.2.40 PHP/5.6.14 
{"apiVersion":"v1","timestamp":"April 24, 2016, 10:17 
pm","error":{"asiErrorCode":"12002","message":"A 
message","moreInfo":"http:\/\/foo.bar.net"}} 

siehe Wie kann ich diese Antwort deserialisieren anstatt nur 400 zu bekommen?

Mein Code sieht aus wie

return client.target(URL).get(AsiAccounts.class); 

Und AsiAccounts im Grunde leer

@JsonIgnoreProperties 
public class AsiAccounts 

} 

Ich habe apiVerson, Zeitstempel und Fehler zu AsiAccounts, aber es funktioniert immer noch nicht. Jede Hilfe wird geschätzt.

Antwort

-1

können Sie auf diese Weise

Response.status(200).entity(asiAccount).build(); 
+0

Dank verwenden, Ihnen etwas ausmachen Details mehr bieten? Ich bin mir nicht sicher, dass ich verstehe – user2395365

+0

besuchen Sie bitte diese: http://kielczewski.eu/2013/05/developing-restful-web-services-using-dropwizard-part-ii/ –