在我使用的 Java+Spring 应用程序中,从第三方调用 over RestTemplate,我们在 JSON 中获得错误响应,响应代码为 200。
例如
{
"errors": [{
"reason": "did not like the request",
"error": "BAD_REQUEST"
}]
}
Run Code Online (Sandbox Code Playgroud)
如何转换BAD_REQUEST为 400 个整数表示。Apache HttpStatusinte 似乎没有提供任何接口来这样做。
我正在使用Joda的DateTimeFormatter获取格式化的日期和时间。
DateTimeFormatter hour = DateTimeFormat.forPattern("aa").withLocale(locale);
System.out.println(hour.print(mydateObj));
由于我在区域设置中使用DateTimeFormatter,因此如何知道时间是AM还是PM?
我正在使用 spring 3 + Tomcat 7
在web.xml我已经定义
<error-page>
<error-code>404</error-code>
<location>/filenotfound</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)
但我想重定向到外部 url 说www.google.com而不是/filenotfound. 我怎样才能做到这一点 ?
我如何在 UTC 中获得 java 时间毫秒而忽略分钟和秒。
例如:如果是 2019 年 10 月 10 日凌晨 1:10:59,它应该得到Time2019 年 10 月 10 日凌晨 1 点的或毫秒。