Review Board 1.7.22


SQOOP-1089 Sqoop2: Accept Language header default

Review Request #12216 - Created July 2, 2013 and submitted

Abraham Elmahrek
SQOOP-1089
Reviewers
Sqoop
hshreedharan, jarcec
sqoop-sqoop2
commit 1db0513e9ddd4c1f7d3b389f0d4932b2bd96e3ee
Author: Abraham Elmahrek <abraham@elmahrek.com>
Date:   Mon Jul 1 17:18:29 2013 -0700

    SQOOP-1089 Sqoop2: Accept Language header default
    
    Using Locale.getDefault().

:100644 100644 4ed7f58... f65017a... M	server/src/main/java/org/apache/sqoop/server/RequestContext.java
mvn test
curl http://solaris:12000/sqoop/v1/connector/all no longer throws and exception.

Diff revision 2 (Latest)

1 2
1 2

  1. server/src/main/java/org/apache/sqoop/server/RequestContext.java: Loading...
server/src/main/java/org/apache/sqoop/server/RequestContext.java
Revision 4ed7f58b3ac56f3ea0f37d1b1b9ad681d1716f32 New Change
[20] 95 lines
[+20] [+] public String[] getUrlElements() {
96
   * Get locale specified in accept-language HTTP header.
96
   * Get locale specified in accept-language HTTP header.
97
   *
97
   *
98
   * @return First specified locale
98
   * @return First specified locale
99
   */
99
   */
100
  public Locale getAcceptLanguageHeader() {
100
  public Locale getAcceptLanguageHeader() {
101
    return new Locale(request.getHeader("Accept-Language"));
101
    String lang = request.getHeader("Accept-Language");

    
   
102
    if (lang == null) {

    
   
103
      lang = Locale.getDefault().getLanguage();

    
   
104
    }

    
   
105
    return new Locale(lang);
102
  }
106
  }
103

    
   
107

   
104
  /**
108
  /**
105
   * Get username specified by custom username HTTP header.
109
   * Get username specified by custom username HTTP header.
106
   *
110
   *
107
   * @return Name of user sending the request
111
   * @return Name of user sending the request
108
   */
112
   */
109
  public String getUserName() {
113
  public String getUserName() {
110
	return request.getHeader(SqoopProtocolConstants.HEADER_SQOOP_USERNAME);
114
	return request.getHeader(SqoopProtocolConstants.HEADER_SQOOP_USERNAME);
111
  }
115
  }
112
}
116
}
  1. server/src/main/java/org/apache/sqoop/server/RequestContext.java: Loading...