<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      讓tomcat支持中文cookie

      這的確是一個不正常的需求,按照規(guī)范,開發(fā)者需要將cookie進(jìn)行編碼,因?yàn)閠omcat不支持中文cookie。

      但有時候,你不得不面對這樣的情況,比如請求是由他人開發(fā)的軟件,比如,瀏覽器控件發(fā)出的。

      這個時候就需要修改tomcat源碼來支持了。

      直接上源碼

      /*
       * Licensed to the Apache Software Foundation (ASF) under one or more
       * contributor license agreements.  See the NOTICE file distributed with
       * this work for additional information regarding copyright ownership.
       * The ASF licenses this file to You under the Apache License, Version 2.0
       * (the "License"); you may not use this file except in compliance with
       * the License.  You may obtain a copy of the License at
       *
       *      http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */
      package org.apache.tomcat.util.http;
      
      
      /**
       * Static constants for this package.
       */
      public final class CookieSupport {
      
          // --------------------------------------------------------------- Constants
          /**
           * If set to true, we parse cookies strictly according to the servlet,
           * cookie and HTTP specs by default.
           */
          public static final boolean STRICT_SERVLET_COMPLIANCE;
      
          /**
           * If true, cookie values are allowed to contain an equals character without
           * being quoted.
           */
          public static final boolean ALLOW_EQUALS_IN_VALUE;
      
          /**
           * If true, separators that are not explicitly dis-allowed by the v0 cookie
           * spec but are disallowed by the HTTP spec will be allowed in v0 cookie
           * names and values. These characters are: \"()/:<=>?@[\\]{} Note that the
           * inclusion of / depends on the value of {@link #FWD_SLASH_IS_SEPARATOR}.
           */
          public static final boolean ALLOW_HTTP_SEPARATORS_IN_V0;
      
          /**
           * If set to false, we don't use the IE6/7 Max-Age/Expires work around.
           * Default is usually true. If STRICT_SERVLET_COMPLIANCE==true then default
           * is false. Explicitly setting always takes priority.
           */
          public static final boolean ALWAYS_ADD_EXPIRES;
      
          /**
           * If set to true, the <code>/</code> character will be treated as a
           * separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
           * then default is true. Explicitly setting always takes priority.
           */
          public static final boolean FWD_SLASH_IS_SEPARATOR;
      
          /**
           * If true, name only cookies will be permitted.
           */
          public static final boolean ALLOW_NAME_ONLY;
      
          /**
           * If set to true, the cookie header will be preserved. In most cases 
           * except debugging, this is not useful.
           */
          public static final boolean PRESERVE_COOKIE_HEADER;
      
          /**
           * The list of separators that apply to version 0 cookies. To quote the
           * spec, these are comma, semi-colon and white-space. The HTTP spec
           * definition of linear white space is [CRLF] 1*( SP | HT )
           */
          private static final char[] V0_SEPARATORS = {',', ';', ' ', '\t'};
          private static final boolean[] V0_SEPARATOR_FLAGS = new boolean[65536];
      
          /**
           * The list of separators that apply to version 1 cookies. This may or may
           * not include '/' depending on the setting of
           * {@link #FWD_SLASH_IS_SEPARATOR}.
           */
          private static final char[] HTTP_SEPARATORS;
          private static final boolean[] HTTP_SEPARATOR_FLAGS = new boolean[65536];
      
          static {
              STRICT_SERVLET_COMPLIANCE = Boolean.parseBoolean(System.getProperty(
                      "org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
                      "false"));
      
              ALLOW_EQUALS_IN_VALUE = Boolean.parseBoolean(System.getProperty(
                      "org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE",
                      "false"));
      
              ALLOW_HTTP_SEPARATORS_IN_V0 = Boolean.parseBoolean(System.getProperty(
                      "org.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0",
                      "false"));
      
              String alwaysAddExpires = System.getProperty(
              "org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES");
              if (alwaysAddExpires == null) {
                  ALWAYS_ADD_EXPIRES = !STRICT_SERVLET_COMPLIANCE;
              } else {
                  ALWAYS_ADD_EXPIRES = Boolean.parseBoolean(alwaysAddExpires);
              }
      
              String preserveCookieHeader = System.getProperty(
                      "org.apache.tomcat.util.http.ServerCookie.PRESERVE_COOKIE_HEADER");
              if (preserveCookieHeader == null) {
                  PRESERVE_COOKIE_HEADER = STRICT_SERVLET_COMPLIANCE;
              } else {
                  PRESERVE_COOKIE_HEADER = Boolean.parseBoolean(preserveCookieHeader);
              }
      
              String  fwdSlashIsSeparator = System.getProperty(
                      "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
              if (fwdSlashIsSeparator == null) {
                  FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
              } else {
                  FWD_SLASH_IS_SEPARATOR = Boolean.parseBoolean(fwdSlashIsSeparator);
              }
      
              ALLOW_NAME_ONLY = Boolean.parseBoolean(System.getProperty(
                      "org.apache.tomcat.util.http.ServerCookie.ALLOW_NAME_ONLY",
                      "false"));
      
      
              /*
              Excluding the '/' char by default violates the RFC, but
              it looks like a lot of people put '/'
              in unquoted values: '/': ; //47
              '\t':9 ' ':32 '\"':34 '(':40 ')':41 ',':44 ':':58 ';':59 '<':60
              '=':61 '>':62 '?':63 '@':64 '[':91 '\\':92 ']':93 '{':123 '}':125
              */
              if (CookieSupport.FWD_SLASH_IS_SEPARATOR) {
                  HTTP_SEPARATORS = new char[] { '\t', ' ', '\"', '(', ')', ',', '/',
                          ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
              } else {
                  HTTP_SEPARATORS = new char[] { '\t', ' ', '\"', '(', ')', ',',
                          ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
              }
              for (int i = 0; i < 65536; i++) {
                  V0_SEPARATOR_FLAGS[i] = false;
                  HTTP_SEPARATOR_FLAGS[i] = false;
              }
              for (int i = 0; i < V0_SEPARATORS.length; i++) {
                  V0_SEPARATOR_FLAGS[V0_SEPARATORS[i]] = true;
              }
              for (int i = 0; i < HTTP_SEPARATORS.length; i++) {
                  HTTP_SEPARATOR_FLAGS[HTTP_SEPARATORS[i]] = true;
              }
      
          }
      
          // ----------------------------------------------------------------- Methods
      
          /**
           * Returns true if the byte is a separator as defined by V0 of the cookie
           * spec.
           */
          public static final boolean isV0Separator(final char c) {
      //        if (c < 0x20 || c >= 0x7f) {
      //            if (c != 0x09) {
      //                throw new IllegalArgumentException(
      //                        "Control character in cookie value or attribute.");
      //            }
      //        }
      
              return V0_SEPARATOR_FLAGS[c];
          }
      
          public static boolean isV0Token(String value) {
              if( value==null) {
                  return false;
              }
      
              int i = 0;
              int len = value.length();
      
              if (alreadyQuoted(value)) {
                  i++;
                  len--;
              }
      
              for (; i < len; i++) {
                  char c = value.charAt(i);
                  if (isV0Separator(c)) {
                      return true;
                  }
              }
              return false;
          }
      
          /**
           * Returns true if the byte is a separator as defined by V1 of the cookie
           * spec, RFC2109.
           * @throws IllegalArgumentException if a control character was supplied as
           *         input
           */
          public static final boolean isHttpSeparator(final char c) {
      //        if (c < 0x20 || c >= 0x7f) {
      //            if (c != 0x09) {
      //                throw new IllegalArgumentException(
      //                        "Control character in cookie value or attribute.");
      //            }
      //        }
      
              return HTTP_SEPARATOR_FLAGS[c];
          }
      
          public static boolean isHttpToken(String value) {
              if( value==null) {
                  return false;
              }
      
              int i = 0;
              int len = value.length();
      
              if (alreadyQuoted(value)) {
                  i++;
                  len--;
              }
      
              for (; i < len; i++) {
                  char c = value.charAt(i);
      
                  if (isHttpSeparator(c)) {
                      return true;
                  }
              }
              return false;
          }
      
          public static boolean alreadyQuoted (String value) {
              if (value==null || value.length() < 2) {
                  return false;
              }
              return (value.charAt(0)=='\"' && value.charAt(value.length()-1)=='\"');
          }
      
      
          // ------------------------------------------------------------- Constructor
          private CookieSupport() {
              // Utility class. Don't allow instances to be created.
          }
      }
      

        

      posted @ 2016-01-29 15:29  鄭某  閱讀(2234)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 免费人成视频在线视频电影| 亚洲偷自拍另类一区二区| 亚洲一区久久蜜臀av| 国产午夜亚洲精品久久| 中文字字幕在线中文乱码| 国产在线精品中文字幕| 人人做人人澡人人人爽| 亚洲综合中文字幕首页| 九九热爱视频精品| 岛国最新亚洲伦理成人| 十八禁午夜福利免费网站| 六盘水市| 性做久久久久久久| 国产在线乱子伦一区二区| 99久久无色码中文字幕| 亚洲精品一区二区动漫| 国产精品白浆免费视频| AV老司机色爱区综合| 麻豆一区二区中文字幕| 国内揄拍国内精品少妇国语| 一区二区三区放荡人妻| 91中文字幕一区二区| 成人中文在线| 久久精品道一区二区三区| 国产999久久高清免费观看| 欧日韩无套内射变态| 久操热在线视频免费观看| 国产精品国产三级国产试看| 深夜福利啪啪片| 一区二区三区四区国产综合| 国产乱码精品一区二区麻豆| 无码人妻一区二区三区av| 亚洲最大av一区二区| 99久久99这里只有免费费精品| 大尺度国产一区二区视频| 美女人妻激情乱人伦| 高清国产一区二区无遮挡| 国产精品中文av专线| 人成午夜大片免费视频77777| 亚洲国产精久久久久久久春色| 在线看免费无码av天堂|