org.apache.wicket.request.Url Java Examples
The following examples show how to use
org.apache.wicket.request.Url.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractMountedMapper.java From Orienteer with Apache License 2.0 | 6 votes |
/** * Ensure that request is for this mapper * @param requestHandler request handler for handle request * @return url if this mapper can handle this request */ @Override public Url mapHandler(IRequestHandler requestHandler) { if (requestHandler instanceof IPageClassRequestHandler) { IPageClassRequestHandler handler = (IPageClassRequestHandler) requestHandler; PageParameters params = null; if (handler instanceof IPageRequestHandler) { IRequestablePage page = ((IPageRequestHandler)handler).getPage(); if (page != null) { params = page.getPageParameters(); } } if (params == null) { params = handler.getPageParameters(); } return isMatch(params) ? super.mapHandler(requestHandler) : null; } else { return super.mapHandler(requestHandler); } }
Example #2
Source File: PathAwareUrl.java From onedev with MIT License | 6 votes |
@Override public String getPath(Charset charset) { StringBuilder path = new StringBuilder(); boolean slash = false; for (String segment : getSegments()) { if (slash) { path.append('/'); } if (segment.indexOf('/') != -1) { Url url = new Url(Splitter.on('/').splitToList(segment), StandardCharsets.UTF_8); path.append(url.getPath()); } else { path.append(UrlEncoder.PATH_INSTANCE.encode(segment, charset)); } slash = true; } return path.toString(); }
Example #3
Source File: DirectBuyRequestCycleListener.java From AppStash with Apache License 2.0 | 6 votes |
@Override public void onBeginRequest(RequestCycle cycle) { StringValue directBuyParameterValue = cycle.getRequest().getRequestParameters().getParameterValue(DIRECT_BUY_PARAMETER); if (!directBuyParameterValue.isEmpty()) { try { ProductInfo productInfo = productService.findByQuery(ProductQuery.create().withUrlname(directBuyParameterValue.toString())); if (productInfo != null) { cart.addItem(productInfo); } else { ShopSession.get().error(String.format("Das Product '%s' konnte nicht gefunden werden.", directBuyParameterValue)); } Url urlWithoutDirectBuy = removeDirectBuyFromUrl(cycle); redirectTo(cycle, urlWithoutDirectBuy); } catch (Exception e) { ShopSession.get().error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE); LOGGER.error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE, e); } } }
Example #4
Source File: DirectBuyRequestCycleListener.java From the-app with Apache License 2.0 | 6 votes |
@Override public void onBeginRequest(RequestCycle cycle) { StringValue directBuyParameterValue = cycle.getRequest().getRequestParameters().getParameterValue(DIRECT_BUY_PARAMETER); if (!directBuyParameterValue.isEmpty()) { try { ProductInfo productInfo = productService.findByQuery(ProductQuery.create().withUrlname(directBuyParameterValue.toString())); if (productInfo != null) { cart.addItem(productInfo); } else { ShopSession.get().error(String.format("Das Product '%s' konnte nicht gefunden werden.", directBuyParameterValue)); } Url urlWithoutDirectBuy = removeDirectBuyFromUrl(cycle); redirectTo(cycle, urlWithoutDirectBuy); } catch (Exception e) { ShopSession.get().error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE); LOGGER.error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE, e); } } }
Example #5
Source File: WicketUtils.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * Examples: https://www.projectforge.org/demo or https://www.acme.com/ProjectForge. * @return Absolute context path of the web application. */ 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; }
Example #6
Source File: LoginPage.java From webanno with Apache License 2.0 | 6 votes |
private void setDefaultResponsePageIfNecessary() { // This does not work because it was Spring Security that intercepted the access, not // Wicket continueToOriginalDestination(); String redirectUrl = getRedirectUrl(); if (redirectUrl == null || redirectUrl.contains(".IBehaviorListener.") || redirectUrl.contains("-logoutPanel-")) { log.debug("Redirecting to welcome page"); setResponsePage(getApplication().getHomePage()); } else { log.debug("Redirecting to saved URL: [{}]", redirectUrl); if (isNotBlank(form.urlfragment) && form.urlfragment.startsWith("!")) { Url url = Url.parse("http://dummy?" + form.urlfragment.substring(1)); UrlRequestParametersAdapter adapter = new UrlRequestParametersAdapter(url); LinkedHashMap<String, StringValue> params = new LinkedHashMap<>(); for (String name : adapter.getParameterNames()) { params.put(name, adapter.getParameterValue(name)); } Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, params); } throw new NonResettingRestartException(redirectUrl); } }
Example #7
Source File: RedirectRequestHandler.java From onedev with MIT License | 6 votes |
/** {@inheritDoc} */ public void respond(final IRequestCycle requestCycle) { String location = requestCycle.getUrlRenderer().renderRelativeUrl(Url.parse(getRedirectUrl())); WebResponse response = (WebResponse)requestCycle.getResponse(); if (status == HttpServletResponse.SC_MOVED_TEMPORARILY) { response.sendRedirect(location); } else { response.setStatus(status); if (((WebRequest)requestCycle.getRequest()).isAjax()) { response.setHeader("Ajax-Location", location); } else { response.setHeader("Location", location); } } }
Example #8
Source File: BasicResourceReferenceMapper.java From onedev with MIT License | 5 votes |
@Override public int getCompatibilityScore(Request request) { Url url = request.getUrl(); int score = -1; if (canBeHandled(url)) { score = 1; } return score; }
Example #9
Source File: RestartResponseAtInterceptPageException.java From onedev with MIT License | 5 votes |
/** * @return the url of the request when the interception happened or {@code null} * or {@code null} if there was no interception yet */ public static Url getOriginalUrl() { Url originalUrl = null; InterceptData data = InterceptData.get(); if (data != null) { originalUrl = data.getOriginalUrl(); } return originalUrl; }
Example #10
Source File: WidgetApplication.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void init() { super.init(); // Configure for Spring injection getComponentInstantiationListeners().add(new SpringComponentInjector(this)); // Don't throw an exception if we are missing a property, just fallback getResourceSettings().setThrowExceptionOnMissingResource(false); // Remove the wicket specific tags from the generated markup getMarkupSettings().setStripWicketTags(true); // Don't add any extra tags around a disabled link (default is <em></em>) getMarkupSettings().setDefaultBeforeDisabledLink(null); getMarkupSettings().setDefaultAfterDisabledLink(null); // On Wicket session timeout, redirect to main page getApplicationSettings().setPageExpiredErrorPage(getHomePage()); // cleanup the HTML getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); // Suppress internal javascript references // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name. // However it is cleaner if we just handle this manually in the page getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js"))); getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js"))); // to put this app into deployment mode, see web.xml }
Example #11
Source File: Application.java From openmeetings with Apache License 2.0 | 5 votes |
@Override public Url mapHandler(IRequestHandler requestHandler) { if (requestHandler instanceof ListenerRequestHandler || requestHandler instanceof BookmarkableListenerRequestHandler) { return null; } else { return super.mapHandler(requestHandler); } }
Example #12
Source File: TransparentParameterPageEncoder.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public Url encodePageParameters(PageParameters pageParameters) { StringValue sv = pageParameters.get(parameter); if (!sv.isEmpty()) { pageParameters.remove(parameter); } Url ret = super.encodePageParameters(pageParameters); if (!sv.isEmpty()) { pageParameters.add(parameter, sv.toString()); } return ret; }
Example #13
Source File: DirectBuyRequestCycleListener.java From AppStash with Apache License 2.0 | 5 votes |
private void redirectTo(RequestCycle cycle, Url urlWithoutDirectBuy) { Url requestUrl = cycle.getRequest().getUrl(); if (!requestUrl.equals(urlWithoutDirectBuy)) { WebResponse response = (WebResponse) cycle.getResponse(); response.reset(); response.sendRedirect(urlWithoutDirectBuy.toString(Url.StringMode.FULL)); } }
Example #14
Source File: SeoBookmarkablePageParametersEncoder.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Url encodePageParameters(final PageParameters pageParameters) { final Url url = new Url(); for (PageParameters.NamedPair pair : pageParameters.getAllNamed()) { encodeSegment(url, pair.getKey(), pair.getValue()); } return url; }
Example #15
Source File: NoVersionMountMapper.java From nextreports-server with Apache License 2.0 | 5 votes |
@Override public Url mapHandler(IRequestHandler requestHandler) { if (requestHandler instanceof ListenerInterfaceRequestHandler || requestHandler instanceof BookmarkableListenerInterfaceRequestHandler) { return null; } else { return super.mapHandler(requestHandler); } }
Example #16
Source File: SeoBookmarkablePageParametersEncoder.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public PageParameters decodePageParameters(final Url url) { final PageParameters parameters = new PageParameters(); String name = null; for (String segment : url.getSegments()) { if (name == null) { name = segment; } else { decodeSegment(parameters, name, segment); name = null; } } // enhance the page parameters to understand which page we are currently on final Set<String> namedKeys = parameters.getNamedKeys(); if (namedKeys.contains(WebParametersKeys.SKU_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.SKU_ID); } else if (namedKeys.contains(WebParametersKeys.PRODUCT_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.PRODUCT_ID); } else if (namedKeys.contains(WebParametersKeys.CONTENT_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.CONTENT_ID); } else if (namedKeys.contains(WebParametersKeys.CATEGORY_ID)) { parameters.set(WebParametersKeys.PAGE_TYPE, WebParametersKeys.CATEGORY_ID); } else { parameters.set(WebParametersKeys.PAGE_TYPE, ""); } return parameters; }
Example #17
Source File: MavenArtifactNotifierApplication.java From artifact-listener with Apache License 2.0 | 5 votes |
@Override public void init() { super.init(); if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) { getComponentPostOnBeforeRenderListeners().add(new StatelessChecker()); } if (RuntimeConfigurationType.DEPLOYMENT.equals(getConfigurationType())) { addResourceReplacement(JQueryResourceReference.get(), new UrlResourceReference(Url.parse("//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"))); } }
Example #18
Source File: ServletWebResponse.java From onedev with MIT License | 5 votes |
@Override public String encodeURL(CharSequence url) { Args.notNull(url, "url"); UrlRenderer urlRenderer = getUrlRenderer(); Url originalUrl = Url.parse(url); /* WICKET-4645 - always pass absolute url to the web container for encoding because when REDIRECT_TO_BUFFER is in use Wicket may render PageB when PageA is actually the requested one and the web container cannot resolve the base url properly */ String fullUrl = urlRenderer.renderFullUrl(originalUrl); String encodedFullUrl = httpServletResponse.encodeURL(fullUrl); final String encodedUrl; if (originalUrl.isFull()) { encodedUrl = encodedFullUrl; } else { if (fullUrl.equals(encodedFullUrl)) { // no encoding happened so just reuse the original url encodedUrl = url.toString(); } else { // get the relative url with the jsessionid encoded in it Url _encoded = Url.parse(encodedFullUrl); encodedUrl = urlRenderer.renderRelativeUrl(_encoded); } } return encodedUrl; }
Example #19
Source File: DirectBuyRequestCycleListener.java From the-app with Apache License 2.0 | 5 votes |
private Url removeDirectBuyFromUrl(RequestCycle cycle) { Url requestUrl = cycle.getRequest().getUrl(); Optional<Url.QueryParameter> directBuyParamter = requestUrl.getQueryParameters() .stream() .filter(p -> DIRECT_BUY_PARAMETER.equals(p.getName())) .findFirst(); if (directBuyParamter.isPresent()) { Url requestUrlWithoutDirectBuy = new Url(requestUrl); //TODO-BERND: make change request for wicket - contextpath is removed in wicket implementation requestUrlWithoutDirectBuy.getSegments().add(0, cycle.getRequest().getContextPath().replaceAll("/", "")); requestUrlWithoutDirectBuy.getQueryParameters().remove(directBuyParamter.get()); return requestUrlWithoutDirectBuy; } return requestUrl; }
Example #20
Source File: Application.java From openmeetings with Apache License 2.0 | 5 votes |
public static String urlForPage(Class<? extends Page> clazz, PageParameters pp, String inBaseUrl) { RequestCycle rc = RequestCycle.get(); String baseUrl = isUrlValid(inBaseUrl) ? inBaseUrl : (isUrlValid(getBaseUrl()) ? getBaseUrl() : ""); if (!Strings.isEmpty(baseUrl) && !baseUrl.endsWith("/")) { baseUrl += "/"; } return rc.getUrlRenderer().renderFullUrl(Url.parse(baseUrl + rc.mapUrlFor(clazz, pp))); }
Example #21
Source File: Application.java From openmeetings with Apache License 2.0 | 5 votes |
private static String getWsUrl(Url reqUrl) { if (!reqUrl.isFull()) { return null; } final boolean insecure = "http".equalsIgnoreCase(reqUrl.getProtocol()); String delim = ":"; String port = reqUrl.getPort() == null || reqUrl.getPort() < 0 ? "" : String.valueOf(reqUrl.getPort()); if (!port.isEmpty() && ((insecure && 80 == reqUrl.getPort()) || (!insecure && 443 == reqUrl.getPort()))) { port = ""; } if (port.isEmpty()) { delim = ""; } return String.format("%s://%s%s%s", insecure ? "ws" : "wss", reqUrl.getHost(), delim, port); }
Example #22
Source File: TestPatcher.java From openmeetings with Apache License 2.0 | 5 votes |
@Test public void test() throws Exception { for (DbType dbType : DbType.values()) { ConnectionProperties props = ConnectionPropertiesPatcher.patch(dbType, HOST, PORT, DB, USER, PASS); assertEquals(dbType, props.getDbType(), "DB type should match"); if (DbType.MYSQL == dbType) { Url url = Url.parse(props.getURL()); PageParameters pp = new PageParametersEncoder().decodePageParameters(url); StringValue tz = pp.get("serverTimezone"); assertEquals(TimeZone.getDefault().getID(), tz.toString(), "serverTimezone parameter is mandatory for MySql"); } } }
Example #23
Source File: MysqlPatcher.java From openmeetings with Apache License 2.0 | 5 votes |
@Override protected String getUrl(String inUrl, String host, String inPort, String inDb) { Url url = Url.parse(inUrl); url.setHost(host); url.setPort((inPort == null) ? 3306 : Integer.valueOf(inPort)); url.getSegments().set(1, (inDb == null) ? DEFAULT_DB_NAME : inDb); PageParameters pp = new PageParametersEncoder().decodePageParameters(url); StringValue tz = pp.get(TZ_PARAM); if (tz.isEmpty()) { url.setQueryParameter(TZ_PARAM, TimeZone.getDefault().getID()); } return url.toString(Url.StringMode.FULL); }
Example #24
Source File: WidgetApplication.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void init() { super.init(); // Configure for Spring injection getComponentInstantiationListeners().add(new SpringComponentInjector(this)); // Don't throw an exception if we are missing a property, just fallback getResourceSettings().setThrowExceptionOnMissingResource(false); // Remove the wicket specific tags from the generated markup getMarkupSettings().setStripWicketTags(true); // Don't add any extra tags around a disabled link (default is <em></em>) getMarkupSettings().setDefaultBeforeDisabledLink(null); getMarkupSettings().setDefaultAfterDisabledLink(null); // On Wicket session timeout, redirect to main page getApplicationSettings().setPageExpiredErrorPage(getHomePage()); // cleanup the HTML getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); // Suppress internal javascript references // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name. // However it is cleaner if we just handle this manually in the page getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js"))); getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js"))); // to put this app into deployment mode, see web.xml }
Example #25
Source File: LoginPage.java From webanno with Apache License 2.0 | 5 votes |
private String getRedirectUrl() { String redirectUrl = null; HttpSession session = ((ServletWebRequest) RequestCycle.get().getRequest()) .getContainerRequest().getSession(false); if (session != null) { SavedRequest savedRequest = (SavedRequest) session .getAttribute("SPRING_SECURITY_SAVED_REQUEST"); if (savedRequest != null) { redirectUrl = savedRequest.getRedirectUrl(); } } // There is some kind of bug that logs the user out again if the redirect page is // the context root and if that does not end in a slash. To avoid this, we add a slash // here. This is rather a hack, but I have no idea why this problem occurs. Figured this // out through trial-and-error rather then by in-depth debugging. String baseUrl = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse("")); if (baseUrl.equals(redirectUrl)) { redirectUrl += "/"; } // In case there was a URL fragment in the original URL, append it again to the redirect // URL. if (redirectUrl != null && isNotBlank(form.urlfragment)) { redirectUrl += "#" + form.urlfragment; } return redirectUrl; }
Example #26
Source File: OLoggerEventDispatcher.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void configure(IOLoggerConfiguration configuration) { super.configure(configuration); if(!Strings.isEmpty(collectorUrl)) { Url url = Url.parse(collectorUrl); if(Strings.isEmpty(url.getPath())) { collectorUrl = collectorUrl+(collectorUrl.endsWith("/")?"":"/")+"resource/ologger"; } } }
Example #27
Source File: WidgetApplication.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void init() { super.init(); // Configure for Spring injection getComponentInstantiationListeners().add(new SpringComponentInjector(this)); // Don't throw an exception if we are missing a property, just fallback getResourceSettings().setThrowExceptionOnMissingResource(false); // Remove the wicket specific tags from the generated markup getMarkupSettings().setStripWicketTags(true); // Don't add any extra tags around a disabled link (default is <em></em>) getMarkupSettings().setDefaultBeforeDisabledLink(null); getMarkupSettings().setDefaultAfterDisabledLink(null); // On Wicket session timeout, redirect to main page getApplicationSettings().setPageExpiredErrorPage(getHomePage()); // cleanup the HTML getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); // Suppress internal javascript references // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name. // However it is cleaner if we just handle this manually in the page getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js"))); getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/myconnections/scripts/wicket/empty.js"))); // to put this app into deployment mode, see web.xml }
Example #28
Source File: WidgetApplication.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void init() { super.init(); // Configure for Spring injection getComponentInstantiationListeners().add(new SpringComponentInjector(this)); // Don't throw an exception if we are missing a property, just fallback getResourceSettings().setThrowExceptionOnMissingResource(false); // Remove the wicket specific tags from the generated markup getMarkupSettings().setStripWicketTags(true); // Don't add any extra tags around a disabled link (default is <em></em>) getMarkupSettings().setDefaultBeforeDisabledLink(null); getMarkupSettings().setDefaultAfterDisabledLink(null); // On Wicket session timeout, redirect to main page getApplicationSettings().setPageExpiredErrorPage(getHomePage()); // cleanup the HTML getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); // Suppress internal javascript references // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name. // However it is cleaner if we just handle this manually in the page getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js"))); getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitemembers/scripts/wicket/empty.js"))); // to put this app into deployment mode, see web.xml }
Example #29
Source File: WidgetApplication.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void init() { super.init(); // Configure for Spring injection getComponentInstantiationListeners().add(new SpringComponentInjector(this)); // Don't throw an exception if we are missing a property, just fallback getResourceSettings().setThrowExceptionOnMissingResource(false); // Remove the wicket specific tags from the generated markup getMarkupSettings().setStripWicketTags(true); // Don't add any extra tags around a disabled link (default is <em></em>) getMarkupSettings().setDefaultBeforeDisabledLink(null); getMarkupSettings().setDefaultAfterDisabledLink(null); // On Wicket session timeout, redirect to main page getApplicationSettings().setPageExpiredErrorPage(getHomePage()); // cleanup the HTML getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); // Suppress internal javascript references // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name. // However it is cleaner if we just handle this manually in the page getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js"))); getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/sitedescription/scripts/wicket/empty.js"))); // to put this app into deployment mode, see web.xml }
Example #30
Source File: WidgetApplication.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void init() { super.init(); // Configure for Spring injection getComponentInstantiationListeners().add(new SpringComponentInjector(this)); // Don't throw an exception if we are missing a property, just fallback getResourceSettings().setThrowExceptionOnMissingResource(false); // Remove the wicket specific tags from the generated markup getMarkupSettings().setStripWicketTags(true); // Don't add any extra tags around a disabled link (default is <em></em>) getMarkupSettings().setDefaultBeforeDisabledLink(null); getMarkupSettings().setDefaultAfterDisabledLink(null); // On Wicket session timeout, redirect to main page getApplicationSettings().setPageExpiredErrorPage(getHomePage()); // cleanup the HTML getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); // Suppress internal javascript references // When rendered inline, the URLs these generate are incorrect - the context path is /page/ instead of the webapp name. // However it is cleaner if we just handle this manually in the page getJavaScriptLibrarySettings().setJQueryReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js"))); getJavaScriptLibrarySettings().setWicketEventReference(new UrlResourceReference(Url.parse("/mycalendar/scripts/wicket/empty.js"))); // to put this app into deployment mode, see web.xml }