19 package org.turro.elephant.web;
21 import java.util.Collections;
22 import java.util.SortedSet;
23 import java.util.TreeMap;
24 import org.turro.string.Strings;
25 import org.turro.elephant.context.Application;
26 import org.turro.elephant.context.ElephantApplication;
27 import org.turro.elephant.context.IConstructor;
28 import org.turro.elephant.context.IContext;
29 import org.turro.elephant.impl.util.Files;
42 if(constructor !=
null) {
58 if(Strings.isBlank(path) ||
"/".equals(path)) path =
"";
64 .filter(context -> webTag.equals(context.getWebContext().getWebTag()))
65 .findFirst().orElse(
null);
68 public static SortedSet<ElContext>
getContexts(String from,
int level) {
69 String[] levels = from.split(
"\\/");
71 if(levels.length >= level) {
72 for(
int i = 0; i < level; i++)
73 tmp +=
"/" + levels[i];
74 tmp = tmp.replaceAll(
"\\/\\/",
"\\/");
78 return Collections.emptySortedSet();
85 public static void init() {
120 if(path.endsWith(
"/")) path = path.substring(0, path.length() - 1);
128 int p = path.indexOf(
"?");
130 path = path.substring(0, p);
IConstructor getConstructor()
static Application getApplication()
static boolean exists(String path)
static String toExisting(String path)
static ElContext getContextFromWebTag(String webTag)
static ElContext getContext(IContext context)
static ElContext getCurrent()
static ElContext getContext(IConstructor constructor)
static ElContext getRoot()
static String locateRealContext(IConstructor constructor)
static SortedSet< ElContext > getContexts(String from, int level)
static ElContext getContext(String path)
static String extractPath(String path)
static ElContextMap getInstance()
static ElContext addContext(ElContext context)
TreeSet< ElContext > getChildren()
HttpServletRequest getRequest()
ElContext getRenderingContext()