0

Spring Web サービスを呼び出そうとしています。ブラウザーで以下の 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();
    }

}
4

2 に答える 2

0

私にとっての問題は次のとおりです。

@RequestMapping アノテーション値「myservice」が正しくありませんでした

「mywebservice」であるべきだった

于 2012-07-12T15:25:28.883 に答える