super.beforeRender(context);
/** * @see org.apache.wicket.behavior.AbstractBehavior#beforeRender(org.apache.wicket.Component) */ @Override public void beforeRender(Component component) { super.beforeRender(component); final RequestCycle requestCycle = RequestCycle.get(); // Temporarily replace the web response with a String response webResponse = requestCycle.getResponse(); // Determine encoding final String encoding = Application.exists() ? Application.get() .getRequestCycleSettings() .getResponseRequestEncoding() : "UTF-8"; // Set content type based on markup type for page webResponse.setContentType("text/" + getMarkupType(component) + "; charset=" + encoding); // Create a new response object final Response response = newResponse(); if (response == null) { throw new IllegalStateException("newResponse() must not return null"); } // and make it the current one requestCycle.setResponse(response); }