List of usage examples for org.apache.wicket.request.cycle RequestCycle urlFor
public final <C extends Page> CharSequence urlFor(final Class<C> pageClass, final PageParameters parameters)
From source file:com.example.justaddwater.facebook.FacebookOAuthPage.java
License:Apache License
/** * @return the URL where the user should be directed after successfully authenticating to Facebook, i.e. this page *///w w w . ja v a 2 s . c o m public static String pathToFBOAuthPage() { RequestCycle rc = RequestCycle.get(); return rc.getUrlRenderer().renderFullUrl(Url.parse(rc.urlFor(FacebookOAuthPage.class, null).toString())); }
From source file:de.flapdoodle.wicket.request.cycle.exception.listener.ApplicationHomePageFallbackListener.java
License:Apache License
private RedirectRequestHandler redirectToHomePage(RequestCycle cycle) { return new RedirectRequestHandler( cycle.urlFor(Application.get().getHomePage(), new PageParameters().add("cause", "badThings")) .toString());// ww w.j a va 2s. com }
From source file:org.apache.isis.viewer.wicket.ui.pages.accmngt.EmailVerificationUrlServiceDefault.java
License:Apache License
protected String fullUrlFor(final Class<? extends Page> pageClass, final PageParameters parameters) { final RequestCycle requestCycle = RequestCycle.get(); final CharSequence relativeUrl = requestCycle.urlFor(pageClass, parameters); final UrlRenderer urlRenderer = requestCycle.getUrlRenderer(); final String fullUrl = urlRenderer.renderFullUrl(Url.parse(relativeUrl)); return fullUrl; }
From source file:org.apache.isis.viewer.wicket.viewer.services.DeepLinkServiceWicket.java
License:Apache License
@Programmatic @Override//from ww w.j ava 2 s. c o m public URI deepLinkFor(final Object domainObject) { final AdapterManager adapterManager = getPersistenceSession(); final ObjectAdapter objectAdapter = adapterManager.adapterFor(domainObject); final PageParameters pageParameters = EntityModel.createPageParameters(objectAdapter); PageClassRegistry pageClassRegistry = guiceBeanProvider.lookup(PageClassRegistry.class); final Class<? extends Page> pageClass = pageClassRegistry.getPageClass(PageType.ENTITY); final RequestCycle requestCycle = RequestCycle.get(); final CharSequence urlForPojo = requestCycle.urlFor(pageClass, pageParameters); final String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(Url.parse(urlForPojo)); try { return new URI(fullUrl); } catch (final URISyntaxException ex) { throw new RuntimeException("Cannot create a deep link to domain object: " + domainObject, ex); } }
From source file:org.apache.karaf.webconsole.core.util.LinkUtils.java
License:Apache License
/** * Checks if given link is in active trail. It detects a path only from * bookmarkable links.//from ww w. ja va 2 s. c o m * * @param link Link. * @return True if link path is contained in request path. */ public static boolean isActiveTrail(Link<?> link) { if (link instanceof BookmarkablePageLink) { RequestCycle requestCycle = RequestCycle.get(); String requestPath = requestCycle.getRequest().getUrl().toString(); Class<? extends Page> pageClass = ((BookmarkablePageLink<?>) link).getPageClass(); String linkPath = requestCycle.urlFor(pageClass, null).toString(); return requestPath.contains(RequestUtils.toAbsolutePath(requestPath, linkPath)); } return false; }
From source file:org.apache.openmeetings.web.app.Application.java
License:Apache License
public static String urlForPage(Class<? extends Page> clazz, PageParameters pp) { RequestCycle rc = RequestCycle.get(); return rc.getUrlRenderer() .renderFullUrl(Url.parse(getBean(ConfigurationDao.class).getBaseUrl() + rc.urlFor(clazz, pp))); }
From source file:org.apache.openmeetings.web.util.GroupLogoResourceReference.java
License:Apache License
public static String getUrl(RequestCycle rc, Long groupId) { PageParameters pp = new PageParameters(); if (groupId != null) { pp.add("id", groupId); }//from w w w. ja v a 2 s . co m File img = getGroupLogo(groupId, true); return rc.urlFor(new GroupLogoResourceReference(), pp.add("anticache", img.lastModified())).toString(); }
From source file:org.apache.openmeetings.web.util.ProfileImageResourceReference.java
License:Apache License
public static String getUrl(RequestCycle rc, User u) { String uri = u.getPictureuri(); if (!isAbsolute(uri)) { File img = OmFileHelper.getUserProfilePicture(u.getId(), uri); uri = rc.urlFor(new ProfileImageResourceReference(), new PageParameters().add("id", u.getId()).add("anticache", img.lastModified())).toString(); }//from w w w. ja va2s .c om return uri; }
From source file:org.onehippo.cms7.reports.plugins.ReportPanel.java
License:Apache License
@Override protected void onRenderProperties(JSONObject properties) throws JSONException { super.onRenderProperties(properties); final double columnWidth = config.getAsDouble(CONFIG_WIDTH, DEFAULT_WIDTH); final int width = (int) Math.round(columnWidth * INITIAL_ABSOLUTE_WIDTH); properties.put("columnWidth", columnWidth); properties.put("width", width); properties.put("height", config.getAsInteger(CONFIG_HEIGHT, DEFAULT_HEIGHT)); final TitleColor titleColor = getTitleColor(config); final TitleSize titleSize = getTitleSize(config); properties.put("headerCssClass", "hippo-report-title-" + titleColor.name() + "-" + titleSize); final StringBuilder style = new StringBuilder("padding: 10px; margin: 10px; border-color: #b3b3b3;"); if (config.getAsBoolean(CONFIG_BACKGROUND, DEFAULT_BACKGROUND)) { final RequestCycle rc = RequestCycle.get(); style.append("background: url("); style.append(rc.urlFor(REPORT_PANEL_BG_IMAGE, null)); style.append(") top repeat-x #ededed;"); }// w ww. j ava2s . co m properties.put("style", style.toString()); }
From source file:org.projectforge.web.wicket.WicketUtils.java
License:Open Source License
/** * Examples: https://www.projectforge.org/demo or https://www.acme.com/ProjectForge. * @return Absolute context path of the web application. *///from ww w. j a v a2 s .c o m public static String getAbsoluteContextPath() { if (absoluteContextPath == null) { final RequestCycle requestCycle = RequestCycle.get(); final String url = requestCycle.getUrlRenderer() .renderFullUrl(Url.parse(requestCycle.urlFor(LoginPage.class, null).toString())); final String basePath = "/" + WICKET_APPLICATION_PATH; final int pos = url.indexOf(basePath); if (pos < 0) { log.warn("Couln't get base url of '" + url + "'. Sub string '" + basePath + "' expected."); return url; } absoluteContextPath = url.substring(0, pos); } return absoluteContextPath; }