use of org.apache.wicket.request.Response in project wicket by apache.
the class AjaxBehaviorEnabledTest method before.
/**
*/
@Before
public void before() {
final IAuthorizationStrategy strategy = new CustomStrategy();
tester = new WicketTester(new MockApplication() {
@Override
public Session newSession(Request request, Response response) {
return new WebSession(request) {
private static final long serialVersionUID = 1L;
@Override
public IAuthorizationStrategy getAuthorizationStrategy() {
return strategy;
}
};
}
});
}
use of org.apache.wicket.request.Response in project wicket by apache.
the class ResponseIOExceptionTest method before.
/**
* @throws Exception
*/
@Before
public void before() throws Exception {
tester = new WicketTester() {
@Override
protected Response newServletWebResponse(ServletWebRequest servletWebRequest) {
return new ProblematicResponse(servletWebRequest, getResponse());
}
};
tester.setExposeExceptions(false);
}
use of org.apache.wicket.request.Response in project wicket by apache.
the class PartialPageUpdate method writeHeaderContribution.
/**
* @param response
* the response to write to
* @param component
* to component which will contribute to the header
*/
protected void writeHeaderContribution(final Response response, final Component component) {
headerRendering = true;
// create the htmlheadercontainer if needed
if (header == null) {
header = new PartialHtmlHeaderContainer(this);
page.addOrReplace(header);
}
RequestCycle requestCycle = component.getRequestCycle();
// save old response, set new
Response oldResponse = requestCycle.setResponse(headerBuffer);
try {
headerBuffer.reset();
IHeaderRenderStrategy strategy = AbstractHeaderRenderStrategy.get();
strategy.renderHeader(header, null, component);
} finally {
// revert to old response
requestCycle.setResponse(oldResponse);
}
writeHeaderContribution(response);
headerRendering = false;
}
use of org.apache.wicket.request.Response in project wicket by apache.
the class CookieUtils method getWebResponse.
/**
* Convenience method to get the http response.
*
* @return WebResponse related to the RequestCycle
*/
private WebResponse getWebResponse() {
RequestCycle cycle = RequestCycle.get();
Response response = cycle.getResponse();
if (!(response instanceof WebResponse)) {
response = cycle.getOriginalResponse();
}
return (WebResponse) response;
}
use of org.apache.wicket.request.Response in project wicket by apache.
the class NonResettingRestartException method transferResponseMetaData.
private void transferResponseMetaData() {
RequestCycle cycle = RequestCycle.get();
Response response = cycle.getResponse();
if (response instanceof IMetaDataBufferingWebResponse) {
WebResponse originalResponse = (WebResponse) cycle.getOriginalResponse();
if (originalResponse != response) {
IMetaDataBufferingWebResponse bufferingWebResponse = (IMetaDataBufferingWebResponse) response;
bufferingWebResponse.writeMetaData(originalResponse);
}
}
}
Aggregations