초보자는 여기에 있습니다.JerseyClient webResource와 관련된 문제
@Path("") //what should go here?
public class AaRestCall
public static String subTrackNum (String trackNum) throws IOException {
try {
Client client = Client.create();
WebResource webResource = client.
resource("https://url/rest/request/" + trackNum);
ClientResponse response = webResource.
accept("application/json").get(ClientResponse.class);
String output = response.getEntity(String.class);
return output;
}
catch some stuff here
}
나는 몇 가지 질문이 있습니다 :
이1) 무엇 간다
@GET
@PATH("/{id}/headerinfo")
@Produces({ JSON, XML})
public Response getRequestHEADER(@PathParam("id") long id) {
Request result = em.find(Request.class, id);
...
return Response.ok(entity).build();
여기 나에게 문제를주고 그것에 내 전화는이다 :이처럼 보이는 REST 서비스가 @Path 매개 변수에?
2) webResource에서 webResource.accept로 호출 할 때 해결할 수없는 오류가 발생했습니다. 나는 왜 불분명하다.
3) 저의 첫 번째 REST 호출이고 저지를 처음 사용하기 때문에 추가 팁이 있으면 감사하겠습니다.
이 pathparam의 예를 들어이 참조입니다 REST에 사용되는 프레임 워크 중 하나를 확인할 수 있습니다 : [http://stackoverflow.com/questions/24994599/expected-output-is-not -displaying/24994861 # 24994861] (http://stackoverflow.com/questions/24994599/expected-output-is-not-displaying/24994861#24994861) –