You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuDataAccessConfigDbo.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package com.luticate.utils.dbo;
  2. import android.util.Base64;
  3. import org.json.JSONException;
  4. import org.json.JSONObject;
  5. import java.util.HashMap;
  6. import java.util.Map;
  7. /**
  8. *
  9. * Created by robin on 11/28/15.
  10. */
  11. public class LuDataAccessConfigDbo extends LuDbo {
  12. protected String _baseUrl;
  13. protected String _httpUsername;
  14. protected String _httpPassword;
  15. public String getBaseUrl() {
  16. return _baseUrl;
  17. }
  18. public void setBaseUrl(String baseUrl) {
  19. _baseUrl = baseUrl;
  20. }
  21. public String getHttpUsername() {
  22. return _httpUsername;
  23. }
  24. public void setHttpUsername(String httpUsername) {
  25. _httpUsername = httpUsername;
  26. }
  27. public String getHttpPassword() {
  28. return _httpPassword;
  29. }
  30. public void setHttpPassword(String httpPassword) {
  31. _httpPassword = httpPassword;
  32. }
  33. public Map<String, String> getHeaders()
  34. {
  35. Map<String, String> map = new HashMap<>();
  36. if (_httpUsername != null) {
  37. map.put("Authorization", "Basic " + Base64.encodeToString(
  38. String.format("%s:%s", _httpUsername, _httpPassword).getBytes(), Base64.NO_WRAP));
  39. }
  40. return map;
  41. }
  42. }