use of org.apache.wicket.request.Request in project wicket by apache.
the class CssUrlReplacerTest method newApplication.
@Override
protected WebApplication newApplication() {
return new MockApplication() {
@Override
protected void init() {
super.init();
getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy("=VER=", new MessageDigestResourceVersion()) {
@Override
public void decorateUrl(ResourceUrl url, IStaticCacheableResource resource) {
url.setFileName(url.getFileName() + DECORATION_SUFFIX);
}
});
}
@Override
public Session newSession(Request request, Response response) {
Session newSession = super.newSession(request, response);
newSession.setLocale(Locale.ROOT);
return newSession;
}
};
}
use of org.apache.wicket.request.Request in project wicket by apache.
the class Jetty9PushBuilder method push.
@Override
public void push(HttpServletRequest httpServletRequest, PushItem... pushItems) {
Request request = RequestCycle.get().getRequest();
HttpServletRequest httpRequest = (HttpServletRequest) request.getContainerRequest();
final org.eclipse.jetty.server.PushBuilder pushBuilder = org.eclipse.jetty.server.Request.getBaseRequest(httpRequest).getPushBuilder();
if (pushBuilder != null) {
for (PushItem pushItem : pushItems) {
pushBuilder.path(pushItem.getUrl());
pushItem.getHeaders().entrySet().stream().forEach(pushHeader -> {
String key = pushHeader.getKey();
PushItemHeaderValue value = pushHeader.getValue();
if (value.getOperation() == HeaderOperation.ADD) {
pushBuilder.addHeader(key, value.getValue());
} else {
pushBuilder.setHeader(key, value.getValue());
}
});
pushBuilder.push();
}
} else {
LOG.warn("Attempted to use HTTP2 Push but it is not supported for the current request: {}!", httpRequest);
}
}
use of org.apache.wicket.request.Request in project midpoint by Evolveum.
the class SecurityUtils method getCsrfToken.
public static CsrfToken getCsrfToken() {
Request req = RequestCycle.get().getRequest();
HttpServletRequest httpReq = (HttpServletRequest) req.getContainerRequest();
return (CsrfToken) httpReq.getAttribute("_csrf");
}
Aggregations