@Override public void performLogging() { RequestData requestdata = RequestCycle.get().getMetaData(REQUEST_DATA); if (requestdata != null) { // log the request- and sessiondata (the latter can be null) SessionData sessiondata = RequestCycle.get().getMetaData(SESSION_DATA); log(requestdata, sessiondata); } }
@Override public void sessionDestroyed(String sessionId) { RequestCycle requestCycle = RequestCycle.get(); SessionData sessionData = liveSessions.remove(sessionId); if (requestCycle != null) requestCycle.setMetaData(SESSION_DATA, sessionData); }
@Override protected String generateNewSessionId() { ServletWebRequest servletRequest = (ServletWebRequest)RequestCycle.get().getRequest(); HttpServletRequest httpRequest = servletRequest.getContainerRequest(); return httpRequest.changeSessionId(); } }
@Override protected void onRender() { // Configure the response such as headers etc. configureResponse((WebResponse)RequestCycle.get().getResponse()); // The rules if and when to insert an xml decl in the response are a bit tricky. Allow the // user to replace the default per page and per application. renderXmlDecl(); super.onRender(); }
static void continueToOriginalDestination() { InterceptData data = InterceptData.get(); if (data != null) { String url = RequestCycle.get().getUrlRenderer().renderUrl(data.originalUrl); throw new NonResettingRestartException(url); } }
/** * Invalidates this session at the end of the current request. If you need to invalidate the * session immediately, you can do this by calling invalidateNow(), however this will remove all * Wicket components from this session, which means that you will no longer be able to work with * them. */ public void invalidate() { RequestCycle.get().setMetaData(SESSION_INVALIDATED, true); }
private void updateId() { RequestCycle requestCycle = RequestCycle.get(); if (requestCycle != null) { id = getSessionStore().getSessionId(requestCycle.getRequest(), false); } }
/** * @param parameters * page parameters */ public final void onResourceRequested(PageParameters parameters) { bind(); RequestCycle requestCycle = RequestCycle.get(); Attributes attributes = new Attributes(requestCycle.getRequest(), requestCycle.getResponse(), parameters); resource.respond(attributes); }
@Override public void close() { // write the stuff that was actually supposed to be in the header to the // response, which is used by the built-in HtmlHeaderContainer to get // its contents CharSequence headerContent = getContent(headerFilterName); RequestCycle.get().getResponse().write(headerContent); // must make sure our super (and with it, the wrapped response) get closed: super.close(); }
@Override public void decorateResponse(AbstractResource.ResourceResponse response, IStaticCacheableResource resource) { String requestedVersion = RequestCycle.get().getMetaData(URL_VERSION); String calculatedVersion = this.resourceVersion.getVersion(resource); if (calculatedVersion != null && calculatedVersion.equals(requestedVersion)) { response.setCacheDurationToMaximum(); response.setCacheScope(WebResponse.CacheScope.PUBLIC); } }
/** {@inheritDoc} **/ @Override public void onComponentTag(Component component, ComponentTag tag) { // get path final String path = contextRelativePath.getObject(); final String rewritten = UrlUtils.rewriteToContextRelative(path, RequestCycle.get()); tag.put("src", rewritten); }
@Override protected final void onTimer(AjaxRequestTarget target) { stop(target); RequestCycle requestCycle = RequestCycle.get(); IRequestParameters requestParameters = requestCycle.getRequest().getRequestParameters(); WebClientInfo clientInfo = newWebClientInfo(requestCycle); clientInfo.getProperties().read(requestParameters); Session.get().setClientInfo(clientInfo); onClientInfo(target, clientInfo); }
@Override public Iterable<?> getRenderTokens() { return Arrays.asList( "css-" + UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()) + "-" + media); }
protected void render(HeaderItem item, List<HeaderItem> filteredItems) { if (RequestCycle.get().find(IPartialPageRequestHandler.class).isPresent()) { // we're in an ajax request, so we don't filter and separate stuff.... getRealResponse().render(item); return; } filteredItems.add(item); } }
private String getUrl() { IRequestHandler handler = new ResourceReferenceRequestHandler(getReference(), getPageParameters()); return RequestCycle.get().urlFor(handler).toString(); }
@Override public Iterable<?> getRenderTokens() { String url = UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()); if (Strings.isEmpty(getId())) return Collections.singletonList("javascript-" + url); else return Arrays.asList("javascript-" + getId(), "javascript-" + url); }
private String getUrl() { IRequestHandler handler = new ResourceReferenceRequestHandler(getReference(), getPageParameters()); return RequestCycle.get().urlFor(handler).toString(); }
@Override public void render(Response response) { internalRenderCSSReference(response, UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()), getMedia(), getCondition(), getRel()); }
@Override public void render(Response response) { internalRenderJavaScriptReference(response, UrlUtils.rewriteToContextRelative(getUrl(), RequestCycle.get()), getId(), isDefer(), getCharset(), getCondition(), isAsync()); }