当前位置: 首页>>代码示例>>Java>>正文


Java Constants.PRECOMPILE属性代码示例

本文整理汇总了Java中org.apache.jasper.Constants.PRECOMPILE属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.PRECOMPILE属性的具体用法?Java Constants.PRECOMPILE怎么用?Java Constants.PRECOMPILE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.jasper.Constants的用法示例。


在下文中一共展示了Constants.PRECOMPILE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preCompile

/**
 * <p>Look for a <em>precompilation request</em> as described in
 * Section 8.4.2 of the JSP 1.2 Specification.  <strong>WARNING</strong> -
 * we cannot use <code>request.getParameter()</code> for this, because
 * that will trigger parsing all of the request parameters, and not give
 * a servlet the opportunity to call
 * <code>request.setCharacterEncoding()</code> first.</p>
 *
 * @param request The servlet request we are processing
 *
 * @exception ServletException if an invalid parameter value for the
 *  <code>jsp_precompile</code> parameter name is specified
 */
boolean preCompile(HttpServletRequest request) throws ServletException {

    String queryString = request.getQueryString();
    if (queryString == null) {
        return (false);
    }
    int start = queryString.indexOf(Constants.PRECOMPILE);
    if (start < 0) {
        return (false);
    }
    queryString =
        queryString.substring(start + Constants.PRECOMPILE.length());
    if (queryString.length() == 0) {
        return (true);             // ?jsp_precompile
    }
    if (queryString.startsWith("&")) {
        return (true);             // ?jsp_precompile&foo=bar...
    }
    if (!queryString.startsWith("=")) {
        return (false);            // part of some other name or value
    }
    int limit = queryString.length();
    int ampersand = queryString.indexOf('&');
    if (ampersand > 0) {
        limit = ampersand;
    }
    String value = queryString.substring(1, limit);
    if (value.equals("true")) {
        return (true);             // ?jsp_precompile=true
    } else if (value.equals("false")) {
        // Spec says if jsp_precompile=false, the request should not
        // be delivered to the JSP page; the easiest way to implement
        // this is to set the flag to true, and precompile the page anyway.
        // This still conforms to the spec, since it says the
        // precompilation request can be ignored.
        return (true);             // ?jsp_precompile=false
    } else {
        throw new ServletException("Cannot have request parameter " +
                                   Constants.PRECOMPILE + " set to " +
                                   value);
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:56,代码来源:JspServlet.java

示例2: preCompile

/**
 * <p>Look for a <em>precompilation request</em> as described in
 * Section 8.4.2 of the JSP 1.2 Specification.  <strong>WARNING</strong> -
 * we cannot use <code>request.getParameter()</code> for this, because
 * that will trigger parsing all of the request parameters, and not give
 * a servlet the opportunity to call
 * <code>request.setCharacterEncoding()</code> first.</p>
 *
 * @param request The servlet requset we are processing
 *
 * @exception ServletException if an invalid parameter value for the
 *  <code>jsp_precompile</code> parameter name is specified
 */
boolean preCompile(HttpServletRequest request) throws ServletException {

    String queryString = request.getQueryString();
    if (queryString == null) {
        return (false);
    }
    int start = queryString.indexOf(Constants.PRECOMPILE);
    if (start < 0) {
        return (false);
    }
    queryString =
        queryString.substring(start + Constants.PRECOMPILE.length());
    if (queryString.length() == 0) {
        return (true);             // ?jsp_precompile
    }
    if (queryString.startsWith("&")) {
        return (true);             // ?jsp_precompile&foo=bar...
    }
    if (!queryString.startsWith("=")) {
        return (false);            // part of some other name or value
    }
    int limit = queryString.length();
    int ampersand = queryString.indexOf("&");
    if (ampersand > 0) {
        limit = ampersand;
    }
    String value = queryString.substring(1, limit);
    if (value.equals("true")) {
        return (true);             // ?jsp_precompile=true
    } else if (value.equals("false")) {
 // Spec says if jsp_precompile=false, the request should not
 // be delivered to the JSP page; the easiest way to implement
 // this is to set the flag to true, and precompile the page anyway.
 // This still conforms to the spec, since it says the
 // precompilation request can be ignored.
        return (true);             // ?jsp_precompile=false
    } else {
        throw new ServletException("Cannot have request parameter " +
                                   Constants.PRECOMPILE + " set to " +
                                   value);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:56,代码来源:JspServlet.java

示例3: preCompile

/**
 * <p>
 * Look for a <em>precompilation request</em> as described in Section 8.4.2
 * of the JSP 1.2 Specification. <strong>WARNING</strong> - we cannot use
 * <code>request.getParameter()</code> for this, because that will trigger
 * parsing all of the request parameters, and not give a servlet the
 * opportunity to call <code>request.setCharacterEncoding()</code> first.
 * </p>
 *
 * @param request
 *            The servlet request we are processing
 *
 * @exception ServletException
 *                if an invalid parameter value for the
 *                <code>jsp_precompile</code> parameter name is specified
 */
boolean preCompile(HttpServletRequest request) throws ServletException {

	String queryString = request.getQueryString();
	if (queryString == null) {
		return (false);
	}
	int start = queryString.indexOf(Constants.PRECOMPILE);
	if (start < 0) {
		return (false);
	}
	queryString = queryString.substring(start + Constants.PRECOMPILE.length());
	if (queryString.length() == 0) {
		return (true); // ?jsp_precompile
	}
	if (queryString.startsWith("&")) {
		return (true); // ?jsp_precompile&foo=bar...
	}
	if (!queryString.startsWith("=")) {
		return (false); // part of some other name or value
	}
	int limit = queryString.length();
	int ampersand = queryString.indexOf('&');
	if (ampersand > 0) {
		limit = ampersand;
	}
	String value = queryString.substring(1, limit);
	if (value.equals("true")) {
		return (true); // ?jsp_precompile=true
	} else if (value.equals("false")) {
		// Spec says if jsp_precompile=false, the request should not
		// be delivered to the JSP page; the easiest way to implement
		// this is to set the flag to true, and precompile the page anyway.
		// This still conforms to the spec, since it says the
		// precompilation request can be ignored.
		return (true); // ?jsp_precompile=false
	} else {
		throw new ServletException("Cannot have request parameter " + Constants.PRECOMPILE + " set to " + value);
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:56,代码来源:JspServlet.java


注:本文中的org.apache.jasper.Constants.PRECOMPILE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。