use of org.apache.wicket.request.Request in project wicket by apache.
the class CryptoMapper method getCompatibilityScore.
/**
* {@inheritDoc}
* <p>
* This implementation decrypts the URL and passes the decrypted URL to the wrapped mapper.
* </p>
* @param request
* The request for which to get a compatibility score.
*
* @return The compatibility score.
*/
@Override
public int getCompatibilityScore(final Request request) {
Url decryptedUrl = decryptUrl(request, request.getUrl());
if (decryptedUrl == null) {
return 0;
}
Request decryptedRequest = request.cloneWithUrl(decryptedUrl);
return wrappedMapper.getCompatibilityScore(decryptedRequest);
}
use of org.apache.wicket.request.Request in project wicket by apache.
the class CryptoMapper method mapRequest.
@Override
public IRequestHandler mapRequest(final Request request) {
Url url = decryptUrl(request, request.getUrl());
if (url == null) {
return null;
}
Request decryptedRequest = request.cloneWithUrl(url);
IRequestHandler handler = wrappedMapper.mapRequest(decryptedRequest);
if (handler != null) {
handler = new RequestSettingRequestHandler(decryptedRequest, handler);
}
return handler;
}
use of org.apache.wicket.request.Request in project wicket by apache.
the class ResourceMapper method getCompatibilityScore.
@Override
public int getCompatibilityScore(Request request) {
Url originalUrl = new Url(request.getUrl());
PageParameters parameters = extractPageParameters(request, mountSegments.length, parametersEncoder);
if (parameters != null) {
parameters.setLocale(resolveLocale());
}
removeCachingDecoration(originalUrl, parameters);
Request requestWithoutDecoration = request.cloneWithUrl(originalUrl);
int score = super.getCompatibilityScore(requestWithoutDecoration);
if (score > 0) {
// pages always have priority over resources
score--;
} else {
score = -1;
}
return score;
}
use of org.apache.wicket.request.Request in project wicket by apache.
the class SessionSizeModelTest method testToleranceOnProblematicSessions.
/**
* @see <a href="https://issues.apache.org/jira/browse/WICKET-3355">WICKET-3355</a>
*/
@Test
public void testToleranceOnProblematicSessions() {
new WicketTester(new MockApplication() {
@Override
public Session newSession(final Request request, final Response response) {
return new TestSession(request);
}
});
SessionSizeModel model = new SessionSizeModel();
assertEquals(null, model.getObject());
}
use of org.apache.wicket.request.Request in project webanno by webanno.
the class LogoutPanel method getAutoLogoutTime.
/**
* Checks if auto-logout is enabled. For Winstone, we get a max session length of 0, so here it
* is disabled.
*/
private int getAutoLogoutTime() {
int duration = 0;
Request request = RequestCycle.get().getRequest();
if (request instanceof ServletWebRequest) {
HttpSession session = ((ServletWebRequest) request).getContainerRequest().getSession();
if (session != null) {
duration = session.getMaxInactiveInterval();
}
}
return duration;
}
Aggregations