/** * Returns the URL path for this HistoryToken, that can be parsed by {@link HistoryTokenFactory#parseURL(String)} * <p> * This URL path includes the application context. */ @Override public String toString() { final String url = pattern.printURL(state); final String context = Navigation.getAppContext(); if (!context.isEmpty() && !url.startsWith("/")) { return context + "/" + url; } else { return context + url; } }
/** * Returns the URL path for this HistoryToken, that can be parsed by {@link HistoryTokenFactory#parseURL(String)} * <p> * This URL path includes the application context. */ @Override public String toString() { final String url = pattern.printURL(state); final String context = Navigation.getAppContext(); if (!context.isEmpty() && !url.startsWith("/")) { return context + "/" + url; } else { return context + url; } }
/** * This can be used to generate a HistoryToken from a URL path * * @param url * The typed URL path. If the browser is pushstate-enabled, this will be the URI path, otherwise it will be * the fragment identifier. * @return A HistoryToken with the parsed URL matching information. */ public HistoryToken parseURL(String url) { String context = Navigation.getAppContext(); if (!context.isEmpty() && !url.startsWith("/")) { context = context.substring(1); } if (url.startsWith(context)) { url = url.substring(context.length()); } return patternMatcher.parseURL(url); } }
/** * This can be used to generate a HistoryToken from a URL path * * @param url * The typed URL path. If the browser is pushstate-enabled, this will be the URI path, otherwise it will be * the fragment identifier. * @return A HistoryToken with the parsed URL matching information. */ public HistoryToken parseURL(String url) { String context = Navigation.getAppContext(); if (!context.isEmpty() && !url.startsWith("/")) { context = context.substring(1); } if (url.startsWith(context)) { url = url.substring(context.length()); } return patternMatcher.parseURL(url); } }