Source:
public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(WicketWebSocketJQueryResourceReference.get())); PackageTextTemplate webSocketSetupTemplate = new PackageTextTemplate(WicketWebSocketJQueryResourceReference.class, "res/js/wicket-websocket-setup.js.tmpl"); Map<String, Object> variables = Generics.newHashMap(); if (Strings.isEmpty(resourceName)) { int pageId = component.getPage().getPageId(); variables.put("pageId", pageId); variables.put("resourceName", ""); variables.put("resourceToken", ""); } else { variables.put("resourceName", resourceName); variables.put("resourceToken", resourceToken); variables.put("pageId", false); } WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(component.getApplication()); CharSequence baseUrl = getBaseUrl(webSocketSettings); Args.notNull(baseUrl, "baseUrl"); variables.put("baseUrl", baseUrl); Integer port = getPort(webSocketSettings); variables.put("port", port); Integer securePort = getSecurePort(webSocketSettings); variables.put("securePort", securePort); CharSequence contextPath = getContextPath(webSocketSettings); Args.notNull(contextPath, "contextPath"); variables.put("contextPath", contextPath); variables.put("applicationName", component.getApplication().getName()); CharSequence filterPrefix = getFilterPrefix(webSocketSettings); Args.notNull(filterPrefix, "filterPrefix"); variables.put("filterPrefix", filterPrefix); final CharSequence sessionId = getSessionId(component); variables.put("sessionId", sessionId); String webSocketSetupScript = webSocketSetupTemplate.asString(variables); response.render(OnDomReadyHeaderItem.forScript(webSocketSetupScript)); }

Target:
public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(WicketWebSocketJQueryResourceReference.get())); PackageTextTemplate webSocketSetupTemplate = new PackageTextTemplate(WicketWebSocketJQueryResourceReference.class, "res/js/wicket-websocket-setup.js.tmpl"); Map<String, Object> variables = Generics.newHashMap(); if (Strings.isEmpty(resourceName)) { int pageId = component.getPage().getPageId(); variables.put("pageId", pageId); variables.put("resourceName", ""); variables.put("connectionToken", ""); } else { variables.put("resourceName", resourceName); variables.put("connectionToken", connectionToken); variables.put("pageId", false); } WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(component.getApplication()); CharSequence baseUrl = getBaseUrl(webSocketSettings); Args.notNull(baseUrl, "baseUrl"); variables.put("baseUrl", baseUrl); Integer port = getPort(webSocketSettings); variables.put("port", port); Integer securePort = getSecurePort(webSocketSettings); variables.put("securePort", securePort); CharSequence contextPath = getContextPath(webSocketSettings); Args.notNull(contextPath, "contextPath"); variables.put("contextPath", contextPath); variables.put("applicationName", component.getApplication().getName()); CharSequence filterPrefix = getFilterPrefix(webSocketSettings); Args.notNull(filterPrefix, "filterPrefix"); variables.put("filterPrefix", filterPrefix); final CharSequence sessionId = getSessionId(component); variables.put("sessionId", sessionId); String webSocketSetupScript = webSocketSetupTemplate.asString(variables); response.render(OnDomReadyHeaderItem.forScript(webSocketSetupScript)); }