public HeaderBufferingWebResponse(WebResponse originalResponse) { this.originalResponse = originalResponse; bufferedResponse = new BufferedWebResponse(originalResponse); }
public HeaderBufferingWebResponse(WebResponse originalResponse) { this.originalResponse = originalResponse; bufferedResponse = new BufferedWebResponse(originalResponse); }
/** * Create a new response object which is used to store the markup generated by the child * objects. * * @param originalResponse * the original web response or {@code null} if it isn't a {@link WebResponse} * * @return Response object. Must not be null */ protected BufferedWebResponse newResponse(final WebResponse originalResponse) { return new BufferedWebResponse(originalResponse); }
/** * Create a new response object which is used to store the markup generated by the child * objects. * * @param originalResponse * the original web response or {@code null} if it isn't a {@link WebResponse} * * @return Response object. Must not be null */ protected BufferedWebResponse newResponse(final WebResponse originalResponse) { return new BufferedWebResponse(originalResponse); }
/** * Create a WebResponse. Subclasses of WebRequest could e.g. encode wicket's default URL and * hide the details from the user. A appropriate WebRequest must be implemented and configured * to decode the encoded URL. * * @param servletResponse * @return a WebResponse object */ protected WebResponse newWebResponse(final HttpServletResponse servletResponse) { return (getRequestCycleSettings().getBufferResponse() ? new BufferedWebResponse( servletResponse) : new WebResponse(servletResponse)); }
/** * Create a WebResponse. Subclasses of WebRequest could e.g. encode wicket's default URL and * hide the details from the user. A appropriate WebRequest must be implemented and configured * to decode the encoded URL. * * @param servletResponse * @return a WebResponse object */ protected WebResponse newWebResponse(final HttpServletResponse servletResponse) { return (getRequestCycleSettings().getBufferResponse() ? new BufferedWebResponse( servletResponse) : new WebResponse(servletResponse)); }
/** * Collects the html generated by rendering a page. * * @param page * supplier of the page * @return the html rendered by the panel */ public CharSequence renderPage(final Supplier<? extends Page> page) { return inThreadContext(() -> { Request request = newRequest(); BufferedWebResponse response = new BufferedWebResponse(null); RequestCycle cycle = application.createRequestCycle(request, response); ThreadContext.setRequestCycle(cycle); page.get().renderPage(); return response.getText(); }); }
/** * Collects the html generated by rendering a page. * * @param page * supplier of the page * @return the html rendered by the panel */ public CharSequence renderPage(final Supplier<? extends Page> page) { return inThreadContext(() -> { Request request = newRequest(); BufferedWebResponse response = new BufferedWebResponse(null); RequestCycle cycle = application.createRequestCycle(request, response); ThreadContext.setRequestCycle(cycle); page.get().renderPage(); return response.getText(); }); }
BufferedWebResponse tempResponse = new BufferedWebResponse(null);
BufferedWebResponse tempResponse = new BufferedWebResponse(null);
/** * Collects the Html generated by the rendering a page. * <p> * Important note: Must be called on a thread bound to an application's {@link ThreadContext}! * * @param pageProvider * the provider of the page class/instance and its parameters * @return the html rendered by a page * * @see ThreadContext */ public static CharSequence renderPage(final PageProvider pageProvider) { Application application = Application.get(); RequestCycle originalRequestCycle = RequestCycle.get(); BufferedWebResponse tempResponse = new BufferedWebResponse(null); RequestCycle tempRequestCycle = application .createRequestCycle(originalRequestCycle.getRequest(), tempResponse); try { ThreadContext.setRequestCycle(tempRequestCycle); pageProvider.getPageInstance().renderPage(); } finally { ThreadContext.setRequestCycle(originalRequestCycle); } return tempResponse.getText(); }
/** * Collects the Html generated by the rendering a page. * <p> * Important note: Must be called on a thread bound to an application's {@link ThreadContext}! * * @param pageProvider * the provider of the page class/instance and its parameters * @return the html rendered by a page * * @see ThreadContext */ public static CharSequence renderPage(final PageProvider pageProvider) { Application application = Application.get(); RequestCycle originalRequestCycle = RequestCycle.get(); BufferedWebResponse tempResponse = new BufferedWebResponse(null); RequestCycle tempRequestCycle = application .createRequestCycle(originalRequestCycle.getRequest(), tempResponse); try { ThreadContext.setRequestCycle(tempRequestCycle); pageProvider.getPageInstance().renderPage(); } finally { ThreadContext.setRequestCycle(originalRequestCycle); } return tempResponse.getText(); }
/** * Mock a request to table component and return its response. * * @param tableComponent * @return */ private BufferedWebResponse doRequest(Component tableComponent) { originalResponse = RequestCycle.get().getResponse(); BufferedWebResponse mockResponse = new BufferedWebResponse(null); RequestCycle.get().setResponse(mockResponse); Application.get().getComponentPreOnBeforeRenderListeners().add(PathSetupListener.INSTANCE); Page page = tableComponent.getPage(); page.startComponentRender(tableComponent); tableComponent.prepareForRender(); tableComponent.render(); return mockResponse; }
BufferedWebResponse response = new BufferedWebResponse(originalResponse);
BufferedWebResponse response = new BufferedWebResponse(originalResponse);