View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   package org.directdemocracyportal.democracy.web;
6   
7   import java.util.Locale;
8   import java.util.Map;
9   
10  import org.directdemocracyportal.democracy.model.application.User;
11  
12  import thinwire.ui.Application;
13  
14  /***
15   * The Class UserState.
16   */
17  public class UserState
18  {
19  
20      /*** The Constant user. */
21      public final static Application.Local<User> user = new Application.Local<User>();
22  
23      /*** The Constant locale. */
24      public final static Application.Local<Locale> locale = new Application.Local<Locale>();
25  
26      /*** The Constant userSettings. */
27      public final static Application.Local<Map<String, String>> userSettings = new Application.Local<Map<String, String>>();
28  
29      /***
30       * Gets the session id.
31       *
32       * @return the session id
33       */
34      public static String getSessionId() {
35          return userSettings.get().get("HEADER_COOKIE");
36      }
37  
38      /***
39       * Gets the accept language.
40       *
41       * @return the accept language
42       */
43      public static String getAcceptLanguage() {
44          return userSettings.get().get("HEADER_ACCEPT-LANGUAGE");
45      }
46  
47  }