나는이 경고 웹 서비스에서 리소스를 검색하지만 얻으려고 :으로 Restlet이 표현 컨버터 찾을 수 없습니다 : [응용 프로그램/repo.foo + XML]를
WARNING: Unable to find a converter for this representation : [application/repo.foo+xml]
그리고 내 코드를 null 엔티티를 돌려줍니다.
resource.getRequestAttributes().put("org.restlet.http.headers", new MediaType("application", "application/repo.foo+xml"));
resource.setAttribute("Content-Type", "application/repo.foo+xml");
Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));
Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
ClientResource resource = new ClientResource(path);
ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;
ChallengeResponse auth = new ChallengeResponse(scheme, "user", "password");
resource.setChallengeResponse(auth);
Repo entity = resource.get(Repo.class);
System.out.println(entity);
UPDATE
내 시도가 불행하게도 작동하지 않는 것입니다
잭슨이 인식하지 못하는 콘텐츠 유형으로 다시 전송됩니다. 전체 응답은 어떻게 생겼습니까? 그것은 JSON 다음 서버가 그것에 대한 올바른 콘텐츠 유형을 설정해야합니다. – tom
Restlet에서 Content-Type을 어떻게 설정할 수 있습니까? 이 하나의'resource.setAttribute ("Content-Type", "application/repo.foo + xml");은 작동하지 않습니다. – Aaron
클라이언트의 액센트 유형을 설정합니다. 원하는 경우 서버에서 무시할 수 있습니다. – tom