我正在尝试从数据类型为java.util.calendar
的Web服务检索时间值(05:58:41.000)并将其重新发送回服务。
重新发送时,我想知道有一个额外的Z(时区文本)如下所示。
(05:58:41.000Z)
这是日历的预期行为吗?我们有什么方法可以修剪时区文本(Z)?
非常感谢您对此的帮助。
我的代码并不复杂,而且非常直接。
我的POJO课程是:
Class A {
private java.util.Calendar time;
public void setTime(Calendar theTime) {
time = theTime;
}
public Calendar getTime() {
return time;
}
}
映射代码如下所示
class Mapping {
//Invoke a service A and assign the mapping
A.setTime(serviceResponse.getTime());
// from service getting value as 05:58:41.000
//Invoke the service B by resending the time value as such
request.setTime(A.getTime());
// While resending back value in the request shows as 05:58:41.000Z
}
答案 0 :(得分:0)
在request.setTime(A.getTime());
中,取一个局部变量对数据进行必要的更改并将其设置为request.setTime(localVariable);
答案 1 :(得分:0)
是。这是Calendar的预期行为。您的服务应该能够在不删除尾随Z
的情况下使用它