Advertisement
psi_mmobile

Untitled

Feb 6th, 2020
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public static String getMainAppPath() {
  2. String currentEnvironment = ContextBean.getCurrent().getEnvironment();
  3. if (currentEnvironment.equalsIgnoreCase("PRODUCTION")) {
  4. return PROD_APP_PATH;
  5. } else if (currentEnvironment.equalsIgnoreCase("STAGING")) {
  6. return STAGING_APP_PATH;
  7. } else {
  8. return LOCAL_APP_PATH;
  9. }
  10. }
  11. public String getEnvironment() {
  12. if (null == environment) {
  13. FacesContext facesContext = FacesContext.getCurrentInstance();
  14. ExternalContext externalContext = facesContext.getExternalContext();
  15. String url = ((HttpServletRequest)externalContext.getRequest()).getRequestURL().toString();
  16. if (url.contains("prod.traxxeo.com"))
  17. environment = "PRODUCTION";
  18. else if (url.contains("staging.traxxeo.com"))
  19. environment = "STAGING";
  20. else
  21. environment = "LOCAL";
  22. }
  23. return environment;
  24. }
  25.  
  26. i mi vadi NPE naContextBean.getCurrent()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement