src/main/java/de/uapcore/lightpit/Functions.java

changeset 47
57cfb94ab99f
parent 45
cc7f082c5ef3
child 74
91d1fc2a3a14
equal deleted inserted replaced
46:1574965c7dc7 47:57cfb94ab99f
64 64
65 public static String fqn(Class<?> clazz, String name) { 65 public static String fqn(Class<?> clazz, String name) {
66 return fqn(clazz.getName(), name); 66 return fqn(clazz.getName(), name);
67 } 67 }
68 68
69 public static String fullPath(LightPITModule module, RequestMapping mapping) { 69 public static String baseHref(HttpServletRequest req) {
70 StringBuilder sb = new StringBuilder(); 70 return String.format("%s://%s:%d%s/",
71 sb.append(module.modulePath()); 71 req.getScheme(),
72 sb.append('/'); 72 req.getServerName(),
73 if (!mapping.requestPath().isEmpty()) { 73 req.getServerPort(),
74 sb.append(mapping.requestPath().isEmpty()); 74 req.getContextPath());
75 sb.append('/');
76 }
77 return sb.toString();
78 } 75 }
79 76
80 public static String fullPath(HttpServletRequest req) { 77 public static String fullPath(HttpServletRequest req) {
81 return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse(""); 78 return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse("");
82 } 79 }

mercurial