【问题标题】:Spring Post: HTTP/1.1 405 Method Not AllowedSpring Post:不允许使用 HTTP/1.1 405 方法
【发布时间】:2016-04-04 12:24:34
【问题描述】:

我正在使用 spring rest API 并且所有 POST 方法都出现 Http 405 错误。

我有以下 POST 方法,

@RequestMapping(value = "/GetPlanByBasicContext/", method = RequestMethod.POST)
public @ResponseBody Plan getPlanByBasicContext(@RequestBody BasicPlanContext basicPlanContext) 
{
  return planService.getPlanByBasicContext(basicPlanContext);
}

我正在使用 fiddler 发布以下请求,

发布 http://localhost:8080/now/Plan/GetPlanByBasicContext

{ "sourceLocation":"",  
  "destinationLocation":"", 
  "modeOfTransport":"car"
  "budget":"any"
}

服务器上的 BasicPlanContext 中存在相同的属性,以及 getter 和 setter。

我尝试了提到的其他解决方案,但没有任何效果。

注意:尚未为 spring 配置安全性。

【问题讨论】:

  • 请把你的 murkup 也放上来。
  • 我正在使用提琴手发出 POST 请求。还没有使用 HTML。

标签: java spring rest post


【解决方案1】:

您发错了URL,您的slash 末尾缺少slash,请尝试发帖到:http:// localhost:8080/now/Plan/GetPlanByBasicContext/

【讨论】:

    猜你喜欢
    • 2018-12-20
    • 2014-03-29
    • 2014-06-21
    • 2014-08-19
    • 2017-10-16
    • 2016-02-15
    • 2014-04-18
    • 2016-03-08
    • 2014-05-23
    相关资源
    最近更新 更多