我的Spring boot 1.4应用程序具有此POST方法来创建资源。根据要求,它应该吐出一个位置标头,以指定新创建的资源的URL(https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)。我只是想知道是否有比手动构造URL并将其添加到响应中更好的方法。
任何帮助/线索深表感谢
我们有一个webservices应用程序,它总是以UTC格式输入时间
2012-12-06T05:00:00.000Z
这是将日期解析为java util Date对象的代码
private static final Pattern PATTERN = Pattern.compile(
"(\\d{4})(?:-(\\d{2}))?(?:-(\\d{2}))?(?:[Tt](?:(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(?:\\.(\\d{3}))?)?([Zz])?(?:([+-])(\\d{2}):(\\d{2}))?");
Matcher m = PATTERN.matcher(dateString);
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
int hoff = 0, moff = 0, doff = -1;
if (m.group(9) != null) {
doff = m.group(9).equals("-") ? 1 : -1;
hoff = doff * (m.group(10) != null ? Integer.parseInt(m.group(10)) : 0);
moff = doff * (m.group(11) != null ? Integer.parseInt(m.group(11)) : 0);
}
c.set(Calendar.YEAR, Integer.parseInt(m.group(1)));
c.set(Calendar.MONTH, m.group(2) != null ? Integer.parseInt(m.group(2))-1 : 0);
c.set(Calendar.DATE, m.group(3) != null …Run Code Online (Sandbox Code Playgroud)