브라우저에서 아래의 URL을 사용하여 스프링 웹 서비스를 호출하려고합니다. "myservice"서비스는 XML을 반환해야합니다. 즉, @RequestMapping 주석을 기반으로하면 URL이 정확합니까?스프링 웹 서비스 호출
> http://localhost:8080/mywebapp/myservice/feeds/allFeeds.xml/
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("myservice")
public class TheController {
private TheService TheServiceWS;
public TheController(TheService TheServiceWS) {
this.TheServiceWS = TheServiceWS;
}
@RequestMapping(value = "feeds/allFeeds.xml", produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public String getValues() {
return TheServiceWS.getAllFeeds();
}
}
이것은 응용 프로그램을 배포하는 위치에 따라 다릅니다. 또한, 단지 추측,'allFeeds.xml /'대신'allFeeds.xml'을 시도하십시오 – agibalov
web.xml은 어떻게 구성되어 있습니까? –