Example usage for org.apache.wicket Application createRequestCycle

List of usage examples for org.apache.wicket Application createRequestCycle

Introduction

In this page you can find the example usage for org.apache.wicket Application createRequestCycle.

Prototype

public final RequestCycle createRequestCycle(final Request request, final Response response) 

Source Link

Usage

From source file:com.mastfrog.acteur.wicket.WicketActeur.java

License:Open Source License

@Inject
WicketActeur(HttpEvent evt, Application application, PathFactory pf, Charset charset, WicketConfig config,
        ByteBufAllocator alloc, Settings settings, ReentrantScope scope) {
    RequestAdapter request = new RequestAdapter(evt, config.locale(), charset, settings);
    ResponseAdapter response = new ResponseAdapter(response(), charset, alloc, pf);
    try (QuietAutoCloseable closeScope = scope.enter(request, response, response())) {
        ThreadContext.setApplication(application);
        RequestCycle requestCycle = application.createRequestCycle(request, response);
        ThreadContext.setRequestCycle(requestCycle);
        boolean processed = requestCycle.processRequestAndDetach();
        if (!processed) {
            reject();/*from   w w w .ja  v a2 s .  com*/
        } else {
            HttpResponseStatus status = response.status();
            reply(status == null ? OK : status);
        }
    } finally {
        ThreadContext.detach();
    }
}