从spring控制器中的http上下文读取变量

从spring控制器中的http上下文读取变量,spring,http,spring-mvc,Spring,Http,Spring Mvc,我想从http上下文中检索一些信息。在我的thymeleaf页面中,我使用了如下内容: <span th:text="${#httpServletRequest.getHeader('Accept-Language')}"></span> String language = arguments.getContext().getLocale().getLanguage(); String country = arguments.getContext().getLocale

我想从http上下文中检索一些信息。在我的thymeleaf页面中,我使用了如下内容:

<span th:text="${#httpServletRequest.getHeader('Accept-Language')}"></span>
String language = arguments.getContext().getLocale().getLanguage();
String country = arguments.getContext().getLocale().getCountry();
如何在我的spring控制器中重试相同的信息,实现方式如下

  @RequestMapping("/insert_texto/{page}")
  public ModelAndView insert_texto(Model model, @PathVariable("page") String id)    {
    ...
  }

我会直接在控制器中注释servlet请求或上下文:

@Autowired
ServletContext context;

@RequestMapping("/insert_texto/{page}")
public ModelAndView insert_texto(Model model, @PathVariable("page") String id)  
{
    // use context
}
或者,如果愿意,将
ServletContext
作为变量传递给方法:

@RequestMapping("/insert_texto/{page}")
public ModelAndView insert_texto(Model model, @PathVariable("page") String id, ServletContext context)  
{
    // use context
}

它工作了,但是你知道我应该读哪个属性来获得我想要的值(接受语言)吗?我的意思是,context.getAttribute(“…”)的哪个参数-如果这是获得所需内容的方法。