/**
* reuse an existing session if possible
*/
public static <V> V withRequest(WebApplication webApplication, IMockRequestCallback<V> callback) {
Session oldSession = ThreadContext.exists() ? ThreadContext.getSession() : null;
ThreadContext oldContext = ThreadContext.detach();
try {
ThreadContext.setApplication(webApplication);
ThreadContext.setSession(oldSession);