在球衣请求中获取客户区域设置 [英] Getting the client locale in a jersey request

查看:114
本文介绍了在球衣请求中获取客户区域设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Jersey(JAX-RS)请求的上下文中,获取客户端语言环境的最佳方式和可移植性是什么?我有以下代码:

What is the best and more portable way to get the client locale in the context of a Jersey (JAX-RS) request? I have the following code:

@GET
@Produces("text/html")
@Path("/myrequest")
public Response myRequest(@Context HttpServletRequest request) {
    Locale locale = ...
}

请通过调用window.location = ...;

推荐答案

Locale locale = request.getLocale();

这篇关于在球衣请求中获取客户区域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆