Gle*_*n D 5 java spring spring-mvc spring-boot
我正在使用spring boot,因为我们正在使用第三方身份验证过程,所以我们将index.html页面的权限重定向到POST请求.
当我的spring启动应用程序发出post请求(例如index.html)时,我收到此错误:"不允许方法,不支持请求方法'POST'".
我曾尝试使用RestControllers重定向到GET请求或配置ResourceHttpRequestHandler(supportedMethods属性),但我不能让它工作.
所以要么我需要能够配置spring引导以默认允许POST方法用于静态上下文,或者编写RestController来为HTML页面提供服务.
示例代码非常简单
@SpringBootApplication
public class Example {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Example.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
将任何index.html页面放入resources/static并运行应用程序并尝试使用POST请求而不是GET请求访问该页面.这是为了模拟我的应用程序从提供者上的单一登录POST POST重定向,将SAML或OpenID令牌作为请求有效负载.
谢谢
| 归档时间: |
|
| 查看次数: |
801 次 |
| 最近记录: |