当前位置: 首页 > news >正文

虚拟主机网站建设步骤?怎么在网上做推广

虚拟主机网站建设步骤?,怎么在网上做推广,做食品的采购员常用网站,好网站建设公司地址我今天花了很多时间来弄清楚如何在运行在JBoss上的JSF应用程序中#xff08;使用JBoss 7 Final#xff09;强制正确解码编码的字符。 当您有例如通过URL传递中文字符时#xff0c;就会出现此问题。 假设您有指点事件#xff0c;编码为#xff05;E6#xff05;8C#xf… 我今天花了很多时间来弄清楚如何在运行在JBoss上的JSF应用程序中使用JBoss 7 Final强制正确解码编码的字符。 当您有例如通过URL传递中文字符时就会出现此问题。 假设您有指点事件编码为E68C87E4BA8B。 令人惊讶但是这些字符以指事的形式到达服务器端。 服务器使用ISO-8859-1自动解码它们。 因此如果您尝试像这样自己解码则没关系 FacesContext fc FacesContext.getCurrentInstance(); String param fc.getExternalContext().getRequestParameterMap().get(name); String decodedParam java.net.URLDecoder.decode(param, UTF-8); 这无济于事因为字符已经被错误地解码并且您从请求参数映射中获得了已经被错误解码的字符。 如果您在页面上也没有帮助 meta http-equivContent-Type contenttext/html; charsetUTF-8/ 要克服此错误您需要做两件事特殊的字符编码过滤器和JBoss的standalone.xml中的配置。 过滤器应同时为请求和响应设置配置的编码。 public class CharacterEncodingFilter implements Filter {/** The default character encoding to set for request / response. */private String encoding null;/** The filter configuration object. */private FilterConfig filterConfig;/** Should a character encoding specified by the client be ignored? */private boolean ignore true;public void destroy() {encoding null;filterConfig null;}public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,ServletException {// conditionally select and set the character encoding to be usedif ((ignore || (request.getCharacterEncoding() null)) (encoding ! null)) {request.setCharacterEncoding(encoding);response.setCharacterEncoding(encoding);}// pass control on to the next filterchain.doFilter(request, response);}public void init(FilterConfig filterConfig) throws ServletException {this.filterConfig filterConfig;this.encoding filterConfig.getInitParameter(encoding);String value filterConfig.getInitParameter(ignore);this.ignore ((value null) || value.equalsIgnoreCase(true) || value.equalsIgnoreCase(yes));} } 注意如果仅设置请求的编码则无济于事。 您还应该通过response.setCharacterEncodingencoding将其设置为响应。 web.xml中的配置看起来像 filterfilter-nameCharacterEncodingFilter/filter-namefilter-classxyz.mypackage.CharacterEncodingFilter/filter-classinit-paramdescriptionoverride any encodings from client/descriptionparam-nameignore/param-nameparam-valuetrue/param-value/init-paraminit-paramdescriptionthe encoding to use/descriptionparam-nameencoding/param-nameparam-valueUTF-8/param-value/init-param /filter filter-mappingfilter-nameCharacterEncodingFilter/filter-nameurl-pattern*.jsf/url-pattern /filter-mapping 现在您必须在关闭extensions标记之后直接将以下系统属性添加到standalone.xml中 system-propertiesproperty nameorg.apache.catalina.connector.URI_ENCODING valueUTF-8/property nameorg.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING valuetrue/ /system-properties 从文档中 org.apache.catalina.connector.URI_ENCODING指定xx解码URL后用于解码URI字节的字符编码。 如果未指定将使用ISO-8859-1。 org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING指定是否应将contentType中指定的编码用于URI查询参数而不是使用org.apache.catalina.connector.URI_ENCODING。 出现此设置是为了与Tomcat 4.1.x兼容其中在contentType中指定的编码或使用Request.setCharacterEncoding方法显式设置的编码也用于URL中的参数。 默认值为false。 现在JBoss看起来为响应设置了字符编码并使用它来解码URL参数。 希望此信息可以帮助您节省时间。 参考 在JBoss中 我们的JCG合作伙伴 Oleg Varaksin在软件开发博客Thoughts上 对服务器端URL参数的正确解码 。 翻译自: https://www.javacodegeeks.com/2013/07/proper-decoding-of-url-parameters-on-the-server-side-in-jboss.html
http://wiki.neutronadmin.com/news/3635/

相关文章:

  • 上海网站建设代码阿里云怎么创建网站
  • 做网站如何计算工资影视公司名字取名
  • 诸城网站建设费用wordpress前端文章编辑器
  • 宽创国际的展馆设计案例福州短视频seo推荐
  • 统计网站怎么做大连黄页企业名录
  • 小程序网站建设wordpress主题插件下载
  • 庆云网站seo做排行的网站
  • 免费海报模板网站域名已有服务器也有怎么做网站
  • 网站开发语言p网站商城功能模块
  • 网站主页制作教程站长工具查询
  • 湖南省城乡住房建设厅网站小说盗版网站怎么做的
  • 上海公司网站建设价格广东网络建设公司
  • 广东企业网站建设报价信息流广告公司
  • 崇明建设小学网站wordpress上传安装
  • 网站开发所需要的语言为wordpress创建一个ftp
  • 网站风格确定做网站 对方传销
  • 企业网站建设实训体会新余专业的企业网站建设公司
  • 网站刷新新前台是什么意思百度在线
  • 微楼书网站建设最新域名解析网站
  • 个人博客网站制作搭建如何在阿里云主机安装wordpress
  • 好的响应式网站做ppt用的音效网站
  • 企业网站建设方案 完整版上海外贸公司注册
  • 最好的网站制作公司手机怎么创网站免费
  • 学校网站建设的意义wix建站是免费的吗
  • h5手机模板网站衡阳网页定制
  • 大型网站seo方案怎样更新网站文章
  • 网站建设中可能出现的问题作文网高中
  • 网站商城建设公司关键词优化排名技术
  • 网站字体怎么修改网站开发的人李海涛
  • 响应式网站建设外文文献哪些网站是做设计的