0
我有兩個@RequestMapping有兩個不同的媒體類型生產=「text/html」& produce =「application/json」,只有一個映射位置都指向value =「style/inbox」。爲什麼我的默認@RequestMapping自動選擇?
爲什麼當我不發送一個http Accept和我的請求一樣,我的應用程序/ json作爲默認值嗎?我如何設置?
使用Spring MVC。
@RequestMapping(params = "stillOhh", value = "security/inbox", produces = "text/html")
@ResponseBody
@Nonnull
public String doingSamlHtmlFeed(
@Nonnull final HttpServletRequest request,
@Nonnull final HttpServletResponse response,
@RequestParam(value = "id", required = true) @Nonnull final String sId,
@RequestParam(value = "spid", required = true) @Nonnull final String spId,
@RequestParam(value = "relays", required = false) @Nullable final String relayS){
//SOME SECURITY STUFF !!! Saml federation and mapping
return federated.getContentString();
}
@RequestMapping(params = "something", value = "security/inbox", produces =
"application/json)
public ResponseEntity<Map<String,String>> doingSamlJsonFeed(
@Nonnull final HttpServletRequest request,
@Nonnull final HttpServletResponse response,
@RequestParam(value = "id", required = true) @Nonnull final String sId,
@RequestParam(value = "spid", required = true) @Nonnull final String spId,
@RequestParam(value = "relays", required = false) @Nullable final
StringrelayS){
//SOME SECURITY STUFF !!! Saml federation and mapping
return new ResponseEntity<Map<String, String>>(jsonMap, HttpStatus.OK)
}
請提供代碼,以便它可以reviwed – Aeseir 2014-10-21 22:25:13
好一點......它的SAML聯盟,所以我做了一些僞代碼來解釋這更好的。 – whatkai 2014-10-22 12:12:13