test_class.declarator: httpHeaders1
test_class.modifier: private
test_class.original_string: private javax.ws.rs.core.HttpHeaders httpHeaders1;
test_class.type: javax.ws.rs.core.HttpHeaders
test_class.var_name: httpHeaders1
test_class.declarator: httpHeaders2
test_class.modifier: private
test_class.original_string: private javax.ws.rs.core.HttpHeaders httpHeaders2;
test_class.type: javax.ws.rs.core.HttpHeaders
test_class.var_name: httpHeaders2
test_class.file: core/src/test/java/org/wso2/msf4j/internal/HttpHeadersImplTest.java
test_class.identifier: HttpHeadersImplTest
test_case.body: @Test
      public void testGetAcceptableLanguages() throws Exception {
          List<Locale> locales = httpHeaders1.getAcceptableLanguages();
          assertEquals(locales.size(), 3);
          assertEquals(locales.get(0).getLanguage(), "da");
          assertEquals(locales.get(1).getLanguage(), "en-gb");
          assertEquals(locales.get(2).getLanguage(), "en");
  
          locales = httpHeaders2.getAcceptableLanguages();
          assertEquals(locales.size(), 1);
          assertEquals(locales.get(0).getLanguage(), "*");
      }
test_case.class_method_signature: HttpHeadersImplTest.testGetAcceptableLanguages()
test_case.full_signature: @Test public void testGetAcceptableLanguages()
test_case.identifier: testGetAcceptableLanguages
test_case.invocations: getAcceptableLanguages assertEquals size assertEquals getLanguage get assertEquals getLanguage get assertEquals getLanguage get getAcceptableLanguages assertEquals size assertEquals getLanguage get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetAcceptableLanguages()
focal_class.declarator: DATE_FORMAT_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz"
focal_class.modifier: private static final
focal_class.original_string: private static final String DATE_FORMAT_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";
focal_class.type: String
focal_class.var_name: DATE_FORMAT_PATTERN
focal_class.declarator: GMT_TIMEZONE = "GMT"
focal_class.modifier: private static final
focal_class.original_string: private static final String GMT_TIMEZONE = "GMT";
focal_class.type: String
focal_class.var_name: GMT_TIMEZONE
focal_class.declarator: nettyHttpHeaders
focal_class.modifier: private final
focal_class.original_string: private final io.netty.handler.codec.http.HttpHeaders nettyHttpHeaders;
focal_class.type: io.netty.handler.codec.http.HttpHeaders
focal_class.var_name: nettyHttpHeaders
focal_class.declarator: log = LoggerFactory.getLogger(HttpHeadersImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(HttpHeadersImpl.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.file: core/src/main/java/org/wso2/msf4j/internal/HttpHeadersImpl.java
focal_class.identifier: HttpHeadersImpl
focal_class.interfaces: implements HttpHeaders
focal_class.class_method_signature: HttpHeadersImpl.HttpHeadersImpl(io.netty.handler.codec.http.HttpHeaders httpHeaders)
focal_class.full_signature: public  HttpHeadersImpl(io.netty.handler.codec.http.HttpHeaders httpHeaders)
focal_class.identifier: HttpHeadersImpl
focal_class.modifiers: public
focal_class.parameters: (io.netty.handler.codec.http.HttpHeaders httpHeaders)
focal_class.signature:  HttpHeadersImpl(io.netty.handler.codec.http.HttpHeaders httpHeaders)
focal_class.class_method_signature: HttpHeadersImpl.getRequestHeader(String name)
focal_class.full_signature: @Override public List<String> getRequestHeader(String name)
focal_class.identifier: getRequestHeader
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: List<String>
focal_class.signature: List<String> getRequestHeader(String name)
focal_class.class_method_signature: HttpHeadersImpl.getHeaderString(String name)
focal_class.full_signature: @Override public String getHeaderString(String name)
focal_class.identifier: getHeaderString
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: String
focal_class.signature: String getHeaderString(String name)
focal_class.class_method_signature: HttpHeadersImpl.getRequestHeaders()
focal_class.full_signature: @Override public MultivaluedMap<String, String> getRequestHeaders()
focal_class.identifier: getRequestHeaders
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: MultivaluedMap<String, String>
focal_class.signature: MultivaluedMap<String, String> getRequestHeaders()
focal_class.class_method_signature: HttpHeadersImpl.getAcceptableMediaTypes()
focal_class.full_signature: @Override public List<MediaType> getAcceptableMediaTypes()
focal_class.identifier: getAcceptableMediaTypes
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<MediaType>
focal_class.signature: List<MediaType> getAcceptableMediaTypes()
focal_class.class_method_signature: HttpHeadersImpl.getAcceptableLanguages()
focal_class.full_signature: @Override public List<Locale> getAcceptableLanguages()
focal_class.identifier: getAcceptableLanguages
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<Locale>
focal_class.signature: List<Locale> getAcceptableLanguages()
focal_class.class_method_signature: HttpHeadersImpl.getLanguageQualityFactor(String q)
focal_class.full_signature: private float getLanguageQualityFactor(String q)
focal_class.identifier: getLanguageQualityFactor
focal_class.modifiers: private
focal_class.parameters: (String q)
focal_class.return: float
focal_class.signature: float getLanguageQualityFactor(String q)
focal_class.class_method_signature: HttpHeadersImpl.getMediaType()
focal_class.full_signature: @Override public MediaType getMediaType()
focal_class.identifier: getMediaType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: MediaType
focal_class.signature: MediaType getMediaType()
focal_class.class_method_signature: HttpHeadersImpl.getLanguage()
focal_class.full_signature: @Override public Locale getLanguage()
focal_class.identifier: getLanguage
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Locale
focal_class.signature: Locale getLanguage()
focal_class.class_method_signature: HttpHeadersImpl.getCookies()
focal_class.full_signature: @Override public Map<String, Cookie> getCookies()
focal_class.identifier: getCookies
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Map<String, Cookie>
focal_class.signature: Map<String, Cookie> getCookies()
focal_class.class_method_signature: HttpHeadersImpl.getDate()
focal_class.full_signature: @Override public Date getDate()
focal_class.identifier: getDate
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Date
focal_class.signature: Date getDate()
focal_class.class_method_signature: HttpHeadersImpl.getLength()
focal_class.full_signature: @Override public int getLength()
focal_class.identifier: getLength
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getLength()
focal_method.body: @Override
      public List<Locale> getAcceptableLanguages() {
          // Accept-Language: da
          // Accept-Language: en-gb;q=0.8
          List<String> values = nettyHttpHeaders.getAll(HttpHeaders.ACCEPT_LANGUAGE);
          if (values.isEmpty()) {
              return Collections.singletonList(new Locale("*"));
          }
  
          List<Locale> localeValues = new ArrayList<>();
          Map<Locale, Float> prefs = new HashMap<>();
          // derive preferences from Accept-Language and sort languages according to the preferences.
          for (String value : values) {
              String[] pair = value != null ? value.split(";") : new String[0];
              Locale locale = new Locale(pair[0].trim());
              localeValues.add(locale);
              if (pair.length > 1) {
                  String[] pair2 = pair[1] != null ? pair[1].split("=") : new String[0];
                  if (pair2.length > 1) {
                      prefs.put(locale, getLanguageQualityFactor(pair2[1].trim()));
                  } else {
                      prefs.put(locale, 1F);
                  }
              } else {
                  prefs.put(locale, 1F);
              }
          }
  
          if (localeValues.size() <= 1) {
              return localeValues;
          }
          localeValues.sort(new AcceptLanguageComparator(prefs));
          return localeValues;
      }
focal_method.class_method_signature: HttpHeadersImpl.getAcceptableLanguages()
focal_method.full_signature: @Override public List<Locale> getAcceptableLanguages()
focal_method.identifier: getAcceptableLanguages
focal_method.invocations: getAll isEmpty singletonList split trim add split put getLanguageQualityFactor trim put put size sort
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: List<Locale>
focal_method.signature: List<Locale> getAcceptableLanguages()