/** * @see org.apache.wicket.jmx.RequestCycleSettingsMBean#getResponseRequestEncoding() */ @Override public String getResponseRequestEncoding() { return application.getRequestCycleSettings().getResponseRequestEncoding(); }
/** * Url encodes a string * * @param string * string to be encoded * @return encoded string */ public static String urlEncode(String string) { try { return URLEncoder.encode(string, Application.get().getRequestCycleSettings().getResponseRequestEncoding()); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); return string; } }
/** * Returns a decoded value of the given value * * @param value * @return Decodes the value */ private static String urlDecode(String value) { try { value = URLDecoder.decode(value, Application.get().getRequestCycleSettings().getResponseRequestEncoding()); } catch (UnsupportedEncodingException ex) { log.error("error decoding parameter", ex); } return value; }
/** * Constructor * * @param mimetype the content type */ public AjaxCallbackBehavior(String mimetype) { this(mimetype, Application.get().getRequestCycleSettings().getResponseRequestEncoding()); }
/** * Constructor * * @param mimetype the content type */ public AjaxCallbackBehavior(String mimetype) { this(mimetype, Application.get().getRequestCycleSettings().getResponseRequestEncoding()); }
private static Charset getDefaultCharset() { String charsetName = null; if (Application.exists()) { charsetName = Application.get().getRequestCycleSettings().getResponseRequestEncoding(); } if (Strings.isEmpty(charsetName)) { charsetName = "UTF-8"; } return Charset.forName(charsetName); }
private static Charset getDefaultCharset() { String charsetName = null; if (Application.exists()) { charsetName = Application.get().getRequestCycleSettings().getResponseRequestEncoding(); } if (Strings.isEmpty(charsetName)) { charsetName = "UTF-8"; } return Charset.forName(charsetName); }
@Override public void respond(final IRequestCycle requestCycle) { WebResponse r = (WebResponse)requestCycle.getResponse(); // Determine encoding final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); r.setContentType("text/xml; charset=" + encoding); r.disableCaching(); Iterator<T> comps = getChoices(val); int count = 0; renderer.renderHeader(r); while (comps.hasNext()) { final T comp = comps.next(); renderer.render(comp, r, val); count += 1; } renderer.renderFooter(r, count); } };
@Override protected void configureResponse(WebResponse response) { super.configureResponse(response); String mimeType = getMimeType(getModelObject()); String encoding = Application.get().getRequestCycleSettings().getResponseRequestEncoding(); ((WebResponse) getResponse()).setContentType(mimeType + "; charset=" + encoding); // TODO figure out how to handle last modified for pages. // lastmodified depends on both the page and the tiles, maybe tiles // can contribute lastmodified dates and we take the latest... // response.setLastModifiedTime(Time.valueOf(node.getObject().getLastModified())); }
/** {@inheritDoc} */ @Override public void respond(IRequestCycle requestCycle) { WebResponse response = (WebResponse)requestCycle.getResponse(); final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); // Set content type based on markup type for page response.setContentType("text/xml; charset=" + encoding); // Make sure it is not cached by a client response.disableCaching(); response.write("<?xml version=\"1.0\" encoding=\""); response.write(encoding); response.write("\"?><ajax-response></ajax-response>"); }
/** {@inheritDoc} */ @Override public void respond(IRequestCycle requestCycle) { WebResponse response = (WebResponse)requestCycle.getResponse(); final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); // Set content type based on markup type for page response.setContentType("text/xml; charset=" + encoding); // Make sure it is not cached by a client response.disableCaching(); response.write("<?xml version=\"1.0\" encoding=\""); response.write(encoding); response.write("\"?><ajax-response></ajax-response>"); }
@Override protected ResourceResponse newResourceResponse(final Attributes attributes) { // Determine encoding final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); ResourceResponse response = new ResourceResponse(); response.setContentType("text/html; charset=" + encoding); response.setCacheDuration(Duration.NONE); final String status = getStatus(attributes); response.setWriteCallback(new WriteCallback() { @Override public void writeData(final Attributes attributes) { attributes.getResponse().write("<html><body>|"); attributes.getResponse().write(status); attributes.getResponse().write("|</body></html>"); } }); return response; }
@Override protected ResourceResponse newResourceResponse(final Attributes attributes) { // Determine encoding final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); ResourceResponse response = new ResourceResponse(); response.setContentType("text/html; charset=" + encoding); response.setCacheDuration(Duration.NONE); final String status = getStatus(attributes); response.setWriteCallback(new WriteCallback() { @Override public void writeData(final Attributes attributes) { attributes.getResponse().write("<html><body>|"); attributes.getResponse().write(status); attributes.getResponse().write("|</body></html>"); } }); return response; }
@Override protected ResourceResponse newResourceResponse(final Attributes attributes) { // Determine encoding final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); ResourceResponse response = new ResourceResponse(); response.setContentType("text/html; charset=" + encoding); response.setCacheDuration(Duration.NONE); final String status = getStatus(attributes); response.setWriteCallback(new WriteCallback() { @Override public void writeData(final Attributes attributes) { attributes.getResponse().write("<html><body>|"); attributes.getResponse().write(status); attributes.getResponse().write("|</body></html>"); } }); return response; }
/** * Set-up response with appropriate content type, locale and encoding. The locale is set equal * to the session's locale. The content type header contains information about the markup type * (@see #getMarkupType()) and the encoding. The response (and request) encoding is determined * by an application setting (@see ApplicationSettings#getResponseRequestEncoding()). If null, * no xml decl will be written. * * @param response * The WebResponse object */ protected void configureResponse(final WebResponse response) { // Users may subclass setHeader() to set there own headers setHeaders(response); // The response encoding is an application setting final String encoding = getApplication().getRequestCycleSettings() .getResponseRequestEncoding(); final boolean validEncoding = (Strings.isEmpty(encoding) == false); final String contentType; if (validEncoding) { contentType = getMarkupType().getMimeType() + "; charset=" + encoding; } else { contentType = getMarkupType().getMimeType(); } response.setContentType(contentType); }
/** * Set-up response with appropriate content type, locale and encoding. The locale is set equal * to the session's locale. The content type header contains information about the markup type * (@see #getMarkupType()) and the encoding. The response (and request) encoding is determined * by an application setting (@see ApplicationSettings#getResponseRequestEncoding()). If null, * no xml decl will be written. * * @param response * The WebResponse object */ protected void configureResponse(final WebResponse response) { // Users may subclass setHeader() to set there own headers setHeaders(response); // The response encoding is an application setting final String encoding = getApplication().getRequestCycleSettings() .getResponseRequestEncoding(); final boolean validEncoding = (Strings.isEmpty(encoding) == false); final String contentType; if (validEncoding) { contentType = getMarkupType().getMimeType() + "; charset=" + encoding; } else { contentType = getMarkupType().getMimeType(); } response.setContentType(contentType); }
@Override public void respond(IRequestCycle requestCycle) { String script = ToastrHelper.generateJs(singularException, ToastrType.ERROR, false); WebResponse response = (WebResponse)requestCycle.getResponse(); final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); // Set content type based on markup type for page response.setContentType("text/xml; charset=" + encoding); // Make sure it is not cached by a client response.disableCaching(); response.write("<?xml version=\"1.0\" encoding=\""); response.write(encoding); response.write("\"?>"); response.write("<ajax-response>"); response.write("<evaluate><![CDATA[" + script + "]]></evaluate>"); response.write("</ajax-response>"); }
@Override public void respond(IRequestCycle requestCycle) { String script = ToastrHelper.generateJs(singularException, ToastrType.ERROR, false); WebResponse response = (WebResponse)requestCycle.getResponse(); final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); // Set content type based on markup type for page response.setContentType("text/xml; charset=" + encoding); // Make sure it is not cached by a client response.disableCaching(); response.write("<?xml version=\"1.0\" encoding=\""); response.write(encoding); response.write("\"?>"); response.write("<ajax-response>"); response.write("<evaluate><![CDATA[" + script + "]]></evaluate>"); response.write("</ajax-response>"); }
@Override public void respond(IRequestCycle requestCycle) { String script = ToastrHelper.generateJs(singularException, ToastrType.ERROR, false); WebResponse response = (WebResponse)requestCycle.getResponse(); final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); // Set content type based on markup type for page response.setContentType("text/xml; charset=" + encoding); // Make sure it is not cached by a client response.disableCaching(); response.write("<?xml version=\"1.0\" encoding=\""); response.write(encoding); response.write("\"?>"); response.write("<ajax-response>"); response.write("<evaluate><![CDATA[" + script + "]]></evaluate>"); response.write("</ajax-response>"); }
@Override public void respond(IRequestCycle requestCycle) { String script = ToastrHelper.generateJs(singularException, ToastrType.ERROR, false); WebResponse response = (WebResponse)requestCycle.getResponse(); final String encoding = Application.get() .getRequestCycleSettings() .getResponseRequestEncoding(); // Set content type based on markup type for page response.setContentType("text/xml; charset=" + encoding); // Make sure it is not cached by a client response.disableCaching(); response.write("<?xml version=\"1.0\" encoding=\""); response.write(encoding); response.write("\"?>"); response.write("<ajax-response>"); response.write("<evaluate><![CDATA[" + script + "]]></evaluate>"); response.write("</ajax-response>"); }