All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tinygroup.weblayer.webcontext.parser.ParserWebContext Maven / Gradle / Ivy

The newest version!
/**
 *  Copyright (c) 1997-2013, www.tinygroup.org ([email protected]).
 *
 *  Licensed under the GPL, Version 3.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.gnu.org/licenses/gpl.html
 *
 *  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.tinygroup.weblayer.webcontext.parser;

import org.springframework.beans.PropertyEditorRegistrar;
import org.tinygroup.weblayer.WebContext;
import org.tinygroup.weblayer.webcontext.parser.upload.UploadService;
import org.tinygroup.weblayer.webcontext.parser.valueparser.CookieParser;
import org.tinygroup.weblayer.webcontext.parser.valueparser.ParameterParser;

/**
 * 自动解析request parameters和cookie parameters,并透明地处理upload请求的web context实现。
 *
 * @author renhui
 */
public interface ParserWebContext extends WebContext {
    /** 配置文件属性可选项:不对parameters和cookies的名称进行大小写转换。 */
    String URL_CASE_FOLDING_NONE = "none";

    /** 配置文件属性可选项:将parameters和cookies的名称转换成小写。 */
    String URL_CASE_FOLDING_LOWER = "lower";

    /** 配置文件属性可选项:将parameters和cookies的名称转换成小写加下划线。 */
    String URL_CASE_FOLDING_LOWER_WITH_UNDERSCORES = "lower_with_underscores";

    /** 配置文件属性可选项:将parameters和cookies的名称转换成大写。 */
    String URL_CASE_FOLDING_UPPER = "upper";

    /** 配置文件属性可选项:将parameters和cookies的名称转换成大写加下划线。 */
    String URL_CASE_FOLDING_UPPER_WITH_UNDERSCORES = "upper_with_underscores";

    /** 默认的编码字符集。 */
    String DEFAULT_CHARSET_ENCODING = "ISO-8859-1";

    /** 在parameters中表示upload失败,请求被忽略。 */
    String UPLOAD_FAILED = "upload_failed";

    /** 在parameters中表示upload文件尺寸超过限制值,请求被忽略。 */
    String UPLOAD_SIZE_LIMIT_EXCEEDED = "upload_size_limit_exceeded";

    /** 取得用来转换参数类型的propertyEditor注册器。 */
    PropertyEditorRegistrar getPropertyEditorRegistrar();

    /** 类型转换出现异常时,是否不报错,而是返回默认值。 */
    boolean isConverterQuiet();

    /** 是否自动执行Upload。 */
    boolean isAutoUpload();

    /** 取得代表HTML字段的后缀。 */
    String getHtmlFieldSuffix();

    /** 按照指定的风格转换parameters和cookies的名称,默认为“小写加下划线”。 */
    String getCaseFolding();

    /** 是否对参数进行HTML entities解码,默认为true。 */
    boolean isUnescapeParameters();

    /** 是否使用servlet引擎的parser,默认为false。 */
    boolean isUseServletEngineParser();

    /**
     * 是否以request.setCharacterEncoding所指定的编码来解析query,默认为true。
     * 

* 只有当useServletEngineParser==false时,此选项才有效。 *

*/ boolean isUseBodyEncodingForURI(); /** * 当useServletEngineParser==false并且 * useBodyEncodingForURI=false时,用该编码来解释GET请求的参数。 */ String getURIEncoding(); /** 是否对输入参数进行trimming。默认为true。 */ boolean isTrimming(); /** * 取得所有query参数。第一次执行此方法时,将会解析request,从中取得所有的参数。 * * @return ParameterParser实例 */ ParameterParser getParameters(); /** * 取得所有cookie。第一次执行此方法时,将会解析request,从中取得所有cookies。 * * @return CookieParser实例 */ CookieParser getCookies(); /** * 将指定的字符串根据getCaseFolding()的设置,转换成指定大小写形式。 * * @param str 要转换的字符串 * @return 转换后的字符串 */ String convertCase(String str); /** * 返回上传服务 * @return */ UploadService getUploadService(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy