0
私はこのサービスをdbから特定のユーザーに持ち、jsonオブジェクトとして返します。
私は応答を受信し、JSONとしてそれを使用したいが、私は私は私がこれを取得レスポンス印刷する場合は間違って何か原因をしたことはほぼ100%確信している:ResponseEntityがjava.lang.Objectを返す
[Ljava.lang.Object;@69a38065
をこれは、コントローラ:
public Object[] getClienteNomeCognome(String nome, String cognome) throws Exception {
try {
final RestTemplate restTemplate = new RestTemplate();
final String url = "somelink?cognome=%25"+cognome+"%25&nome=%25"+nome+"%25";
//final ResponseEntity<List> response = (ResponseEntity<List>) restTemplate.getForObject(url, List.class);
final ResponseEntity<Object[]> response = restTemplate.getForEntity(url, Object[].class);
Object[] risultati = response.getBody();
LOGGER.info("La richiesta e' stata effettuata con status code: " + response.getStatusCode().toString());
if (risultati != null && risultati.toString().contains("<error>")) {
throw new Exception(String.format(
"[SERVICE] La risposta del servizio contiene degli errori: %s",
risultati));
} else {
LOGGER.debug("[SERVICE] Fine chiamata al servizio di ricerca cliente");
LOGGER.info(response.getBody().toString());
return risultati;
}
} catch (HttpClientErrorException hcee) {
throw new Exception(String.format(
"[SERVICE] Errore durante la chiamata. Error: %s",
hcee.getMessage()));
} catch (Exception e) {
throw new Exception(String.format(
"[SERVICE] Errore generico durante la chiamata al servizio. Error: %s",
e.getMessage()));
}
}
私はサービスが返されますどのような情報についてはよく分からないので、私はクラスを実装したくないと思いますので、私は解決策を必要としますそれは私がjsonオブジェクトで操作できるように、私は角度ngrepeatのようなもので情報を回復することができます... –