public RatpackWebContext(Context ctx, TypedData body, SessionData session) { this.context = ctx; this.session = session; this.request = ctx.getRequest(); if (isFormAvailable(request, body)) { this.form = FormDecoder.parseForm(ctx, body, MultiValueMap.empty()); } else { this.form = new DefaultForm(MultiValueMap.empty(), MultiValueMap.empty()); } }
public void redirect(Context context, String location, int code) { context.getResponse().status(code); String normalizedLocation = generateRedirectLocation(context, context.getRequest(), location); context.getResponse().getHeaders().set(HttpHeaderConstants.LOCATION, normalizedLocation); context.getResponse().send(); }
public void handle(Context context) { invoker.invoke( new HierarchicalRegistry(context.getRequest(), context), GroovyContext.from(context), Closure.DELEGATE_FIRST); }