0
get 요청이 내 서버에 호출 될 때 XML 파일을 응답으로 보내려고합니다.XML 파일을 읽고 restlet에서 응답으로 보내는 방법
@Get
public Representation getRootDeviceXML() throws IOException {
File xmlFile = new File("rootdevices.xml");
if (!xmlFile.exists())
throw new ResourceException(Status.SERVER_ERROR_INTERNAL);
SaxRepresentation result;
try {
InputStream inputStream = new FileInputStream(xmlFile);
InputSource inputSource = new InputSource(new InputStreamReader(
inputStream));
result = new SaxRepresentation(MediaType.TEXT_XML, inputSource);
} catch (IOException e) {
throw new IOException(e.toString());
}
Writer writer = new OutputStreamWriter(System.out);
result.write(writer);
return result;
}
그러나 아무것도 실제로 클라이언트 측에서 응답으로까지 보여주지는 (아니 (404), 헤더가 제대로 콘텐츠 형식으로 전송됩니다 텍스트/XML을; 문자셋 = UTF-8). 내가 도대체 뭘 잘못하고있는 겁니까?