Java 是否可以获取用户';JHipster应用程序中的时区?

Java 是否可以获取用户';JHipster应用程序中的时区?,java,spring-mvc,heroku,jodatime,jhipster,Java,Spring Mvc,Heroku,Jodatime,Jhipster,我的JHipster应用程序中有以下代码。当我在笔记本电脑上本地运行时,它为我提供了正确的时区 @RequestMapping(value = "/points-this-week", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<PointsPerWeek> getPointsThisWeek(TimeZone

我的JHipster应用程序中有以下代码。当我在笔记本电脑上本地运行时,它为我提供了正确的时区

@RequestMapping(value = "/points-this-week",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<PointsPerWeek> getPointsThisWeek(TimeZone timeZone) {
    DateTimeZone usersTimeZone = DateTimeZone.forID(timeZone.getID());
    log.debug("Getting points for week with timezone: {}", usersTimeZone);

    // Get current date
    LocalDate now = new LocalDate(usersTimeZone);
@RequestMapping(value=“/points this week”,
method=RequestMethod.GET,
products=MediaType.APPLICATION\u JSON\u值)
@定时
公共响应本周获取点(时区时区){
DateTimeZone usersTimeZone=DateTimeZone.forID(timeZone.getID());
debug(“获取时区为{},usersTimeZone的一周点数);
//获取当前日期
LocalDate now=新的LocalDate(usersTimeZone);

但是,在Heroku上运行时,
timeZone.getID()
是“Etc/UTC”。是否可以在JHipster应用程序中获取客户端的时区?

时区
保存当前服务器的时区而不是客户端时区。您可以轻松获取客户端区域设置,但对于客户端时区,您应该做更多的事情。默认情况下,http标头中不传递时区信息。您可以获取客户端时区从浏览器中删除,并将其存储在请求头或Cookie中,然后在服务器上轻松访问客户端时区。这是一个有用的库