private UrlRenderer getUrlRenderer() { RequestCycle requestCycle = RequestCycle.get(); if (requestCycle == null) { return new UrlRenderer(webRequest); } return requestCycle.getUrlRenderer(); }
private UrlRenderer getUrlRenderer() { RequestCycle requestCycle = RequestCycle.get(); if (requestCycle == null) { return new UrlRenderer(webRequest); } return requestCycle.getUrlRenderer(); }
/** * Gets the base Url. * * @return base Url */ public static Url getBaseUrl() { return RequestCycle.get().getUrlRenderer().getBaseUrl(); }
public CharSequence getBaseUrl() { if (baseUrl.get() == null) { Url _baseUrl = RequestCycle.get().getUrlRenderer().getBaseUrl(); return Strings.escapeMarkup(_baseUrl.toString()); } return baseUrl.get(); }
public CharSequence getBaseUrl() { if (baseUrl.get() == null) { Url _baseUrl = RequestCycle.get().getUrlRenderer().getBaseUrl(); return Strings.escapeMarkup(_baseUrl.toString()); } return baseUrl.get(); }
public static String getBaseURL() { final RequestCycle requestCycle = RequestCycle.get(); final Request request = requestCycle.getRequest(); final String currentPath = request.getUrl().toString(); String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl()); if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) { final int beginPath = fullUrl.lastIndexOf(currentPath); fullUrl = fullUrl.substring(0, beginPath - 1); } final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath()); final Optional<String> filterPath = Optional.ofNullable(requestCycle.getRequest().getFilterPath()); return fullUrl + contextPath.orElse("") + filterPath.orElse(""); }
private String toAbsolutePath(String relativePath) { return getRequestCycle().getUrlRenderer().renderFullUrl(Url.parse(relativePath)); }
public static String getBaseURL() { final RequestCycle requestCycle = RequestCycle.get(); final Request request = requestCycle.getRequest(); final String currentPath = request.getUrl().toString(); String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(request.getUrl()); if (org.apache.commons.lang3.StringUtils.isNotBlank(currentPath)) { final int beginPath = fullUrl.lastIndexOf(currentPath); fullUrl = fullUrl.substring(0, beginPath - 1); } final Optional<String> contextPath = Optional.ofNullable(requestCycle.getRequest().getContextPath()); final Optional<String> filterPath = Optional.ofNullable(requestCycle.getRequest().getFilterPath()); return fullUrl + contextPath.orElse("") + filterPath.orElse(""); }
/** * * @param url * @param requestCycle */ protected void redirectTo(Url url, RequestCycle requestCycle) { bindSessionIfNeeded(); WebResponse response = (WebResponse)requestCycle.getResponse(); String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url); response.sendRedirect(relativeUrl); }
/** * * @param url * @param requestCycle */ protected void redirectTo(Url url, RequestCycle requestCycle) { bindSessionIfNeeded(); WebResponse response = (WebResponse)requestCycle.getResponse(); String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url); response.sendRedirect(relativeUrl); }
static void continueToOriginalDestination() { InterceptData data = InterceptData.get(); if (data != null) { String url = RequestCycle.get().getUrlRenderer().renderUrl(data.originalUrl); throw new NonResettingRestartException(url); } }
public static String relativizeUrl(String url) { if (Url.parse(url).isFull()) return url; else return RequestCycle.get().getUrlRenderer().renderContextRelativeUrl(url); }
static void continueToOriginalDestination() { InterceptData data = InterceptData.get(); if (data != null) { String url = RequestCycle.get().getUrlRenderer().renderUrl(data.originalUrl); throw new NonResettingRestartException(url); } }
/** * Rebuilds {@link ServletWebRequest} used by wicket from the mock request used to build * requests. Sometimes this method is useful when changes need to be checked without processing * a request. */ public void applyRequest() { Request req = newServletWebRequest(); requestCycle.setRequest(req); if (useRequestUrlAsBase) { requestCycle.getUrlRenderer().setBaseUrl(req.getUrl()); } }
/** * Rebuilds {@link ServletWebRequest} used by wicket from the mock request used to build * requests. Sometimes this method is useful when changes need to be checked without processing * a request. */ public void applyRequest() { Request req = newServletWebRequest(); requestCycle.setRequest(req); if (useRequestUrlAsBase) { requestCycle.getUrlRenderer().setBaseUrl(req.getUrl()); } }
private void resetLogin(RequestCycle cycle) { final Url url = cycle.getUrlRenderer().getBaseUrl(); final String redirectURL = url.getProtocol() + "://" + url.getHost() + ":" + url.getPort() + SecurityUtil.getLogoutPath(); throw new RedirectToUrlException(redirectURL); }
private void addAJaxBaseUrl(IHeaderResponse response) { // render ajax base url. It's required by Wicket Ajax support. Url baseUrl = RequestCycle.get().getUrlRenderer().getBaseUrl(); CharSequence ajaxBaseUrl = Strings.escapeMarkup(baseUrl.toString()); response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl + "\";", "wicket-ajax-base-url")); } });
protected static CharSequence urlFor(ResourceReference ref, ODocument document, String field, String contentType, boolean fullUrl) { PageParameters params = new PageParameters(); params.add("rid", document.getIdentity().toString().substring(1)); params.add("field", field); params.add("v", document.getVersion()); if(!Strings.isEmpty(contentType)) params.add("type", contentType); CharSequence url = RequestCycle.get().urlFor(ref, params); if(fullUrl) { url = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(url)); } return url; }
public static String createRegistrationLink(OrienteerUser user) { PageParameters params = new PageParameters(); params.add(PARAMETER_ID, user.getId()); CharSequence url = RequestCycle.get().urlFor(new SharedResourceReference(RES_KEY), params); return RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(url)); }
public static String getLinkForUser(ODocument doc) { String id = doc.field(OrienteerUser.PROP_RESTORE_ID); PageParameters params = new PageParameters(); params.add(PARAMETER_ID, id); CharSequence url = RequestCycle.get().urlFor(new SharedResourceReference(RES_KEY), params); return RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(url)); }