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


Java Globals类代码示例

本文整理汇总了Java中org.apache.catalina.Globals的典型用法代码示例。如果您正苦于以下问题:Java Globals类的具体用法?Java Globals怎么用?Java Globals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addElement

import org.apache.catalina.Globals; //导入依赖的package包/类
@Override
public void addElement(StringBuilder buf, Date date, Request request, Response response, long time) {
	// Don't need to flush since trigger for log message is after the
	// response has been committed
	long length = response.getBytesWritten(false);
	if (length <= 0) {
		// Protect against nulls and unexpected types as these values
		// may be set by untrusted applications
		Object start = request.getAttribute(Globals.SENDFILE_FILE_START_ATTR);
		if (start instanceof Long) {
			Object end = request.getAttribute(Globals.SENDFILE_FILE_END_ATTR);
			if (end instanceof Long) {
				length = ((Long) end).longValue() - ((Long) start).longValue();
			}
		}
	}
	if (length <= 0 && conversion) {
		buf.append('-');
	} else {
		buf.append(length);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:23,代码来源:AccessLogValve.java

示例2: getRequestCertificates

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Look for the X509 certificate chain in the Request under the key
 * <code>javax.servlet.request.X509Certificate</code>. If not found, trigger
 * extracting the certificate chain from the Coyote request.
 *
 * @param request   Request to be processed
 *
 * @return          The X509 certificate chain if found, <code>null</code>
 *                  otherwise.
 */
protected X509Certificate[] getRequestCertificates(final Request request)
        throws IllegalStateException {

    X509Certificate certs[] =
            (X509Certificate[]) request.getAttribute(Globals.CERTIFICATES_ATTR);

    if ((certs == null) || (certs.length < 1)) {
        try {
            request.getCoyoteRequest().action(ActionCode.REQ_SSL_CERTIFICATE, null);
            certs = (X509Certificate[]) request.getAttribute(Globals.CERTIFICATES_ATTR);
        } catch (IllegalStateException ise) {
            // Request body was too large for save buffer
            // Return null which will trigger an auth failure
        }
    }

    return certs;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:AuthenticatorBase.java

示例3: validateGlobalXsltFile

import org.apache.catalina.Globals; //导入依赖的package包/类
private File validateGlobalXsltFile() {
    
    File result = null;
    String base = System.getProperty(Globals.CATALINA_BASE_PROP);
    
    if (base != null) {
        File baseConf = new File(base, "conf");
        result = validateGlobalXsltFile(baseConf);
    }
    
    if (result == null) {
        String home = System.getProperty(Globals.CATALINA_HOME_PROP);
        if (home != null && !home.equals(base)) {
            File homeConf = new File(home, "conf");
            result = validateGlobalXsltFile(homeConf);
        }
    }

    return result;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:DefaultServlet.java

示例4: startInternal

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

    try {
        CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
        if (this.context == null) this.context = new ReplApplContext(this);
        if ( catclust != null ) {
            ReplicatedMap<String,Object> map =
                    new ReplicatedMap<String,Object>(this,
                            catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
                            getName(),getClassLoaders());
            map.setChannelSendOptions(mapSendOptions);
            ((ReplApplContext)this.context).setAttributeMap(map);
            if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
        }
        super.startInternal();
    }  catch ( Exception x ) {
        log.error("Unable to start ReplicatedContext",x);
        throw new LifecycleException("Failed to start ReplicatedContext",x);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:ReplicatedContext.java

示例5: check

import org.apache.catalina.Globals; //导入依赖的package包/类
@Override
public boolean check(Permission permission) {
    if (!Globals.IS_SECURITY_ENABLED) {
        return true;
    }
    Policy currentPolicy = Policy.getPolicy();
    if (currentPolicy != null) {
        ResourceEntry entry = findResourceInternal("/", "/", false);
        if (entry != null) {
            CodeSource cs = new CodeSource(
                    entry.codeBase, (java.security.cert.Certificate[]) null);
            PermissionCollection pc = currentPolicy.getPermissions(cs);
            if (pc.implies(permission)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:20,代码来源:WebappClassLoaderBase.java

示例6: getInitParameter

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Return the value of the specified initialization parameter, or
 * <code>null</code> if this parameter does not exist.
 *
 * @param name
 *            Name of the initialization parameter to retrieve
 */
@Override
public String getInitParameter(final String name) {
	// Special handling for XML settings as the context setting must
	// always override anything that might have been set by an application.
	if (Globals.JASPER_XML_VALIDATION_TLD_INIT_PARAM.equals(name) && context.getTldValidation()) {
		return "true";
	}
	if (Globals.JASPER_XML_VALIDATION_INIT_PARAM.equals(name) && context.getXmlValidation()) {
		return "true";
	}
	if (Globals.JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM.equals(name)) {
		if (!context.getXmlBlockExternal()) {
			// System admin has explicitly changed the default
			return "false";
		}
	}
	return parameters.get(name);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:ApplicationContext.java

示例7: setCatalinaHome

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * 设置catalina.home属性,如果用户未设置则使用当前的工作目录
 * Set the <code>catalina.home</code> System property to the current
 * working directory if it has not been set.
 */
private void setCatalinaHome() {

    if (System.getProperty(Globals.CATALINA_HOME_PROP) != null)
        return;
    File bootstrapJar =
        new File(System.getProperty("user.dir"), "bootstrap.jar");
    if (bootstrapJar.exists()) {
        try {
            System.setProperty
                (Globals.CATALINA_HOME_PROP,
                 (new File(System.getProperty("user.dir"), ".."))
                 .getCanonicalPath());
        } catch (Exception e) {
            // Ignore
            System.setProperty(Globals.CATALINA_HOME_PROP,
                               System.getProperty("user.dir"));
        }
    } else {
        System.setProperty(Globals.CATALINA_HOME_PROP,
                           System.getProperty("user.dir"));
    }

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

示例8: invoke

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Invoke the next Valve in the sequence. When the invoke returns, check
 * the response state, and output an error report is necessary.
 *
 * @param request The servlet request to be processed
 * @param response The servlet response to be created
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
public void invoke(Request request, Response response)
    throws IOException, ServletException {

    // Perform the request
    getNext().invoke(request, response);

    Throwable throwable =
        (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR);

    if (response.isCommitted()) {
        return;
    }

    if (throwable != null) {

        // The response is an error
        response.setError();

        // Reset the response (if possible)
        try {
            response.reset();
        } catch (IllegalStateException e) {
            ;
        }

        response.sendError
            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

    }

    response.setSuspended(false);

    try {
        report(request, response, throwable);
    } catch (Throwable tt) {
        ;
    }

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

示例9: forward

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Forward this request and response to another resource for processing.
 * Any runtime exception, IOException, or ServletException thrown by the
 * called servlet will be propogated to the caller.
 *
 * @param request The servlet request to be forwarded
 * @param response The servlet response to be forwarded
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet exception occurs
 */
public void forward(ServletRequest request, ServletResponse response)
    throws ServletException, IOException
{
    if (Globals.IS_SECURITY_ENABLED) {
        try {
            PrivilegedForward dp = new PrivilegedForward(request,response);
            AccessController.doPrivileged(dp);
        } catch (PrivilegedActionException pe) {
            Exception e = pe.getException();
            if (e instanceof ServletException)
                throw (ServletException) e;
            throw (IOException) e;
        }
    } else {
        doForward(request,response);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:ApplicationDispatcher.java

示例10: addElement

import org.apache.catalina.Globals; //导入依赖的package包/类
@Override
public void addElement(StringBuilder buf, Date date, Request request,
        Response response, long time) {
    // Don't need to flush since trigger for log message is after the
    // response has been committed
    long length = response.getBytesWritten(false);
    if (length <= 0) {
        // Protect against nulls and unexpected types as these values
        // may be set by untrusted applications
        Object start = request.getAttribute(
                Globals.SENDFILE_FILE_START_ATTR);
        if (start instanceof Long) {
            Object end = request.getAttribute(
                    Globals.SENDFILE_FILE_END_ATTR);
            if (end instanceof Long) {
                length = ((Long) end).longValue() -
                        ((Long) start).longValue();
            }
        }
    }
    if (length <= 0 && conversion) {
        buf.append('-');
    } else {
        buf.append(length);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:AccessLogValve.java

示例11: setAttribute

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Override the <code>setAttribute()</code> method of the wrapped request.
 *
 * @param name
 *            Name of the attribute to set
 * @param value
 *            Value of the attribute to set
 */
@Override
public void setAttribute(String name, Object value) {

	if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
		dispatcherType = (DispatcherType) value;
		return;
	} else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
		requestDispatcherPath = value;
		return;
	}

	if (!setSpecial(name, value)) {
		getRequest().setAttribute(name, value);
	}

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

示例12: getDeclaredMethods

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Obtain the declared methods for a class taking account of any security
 * manager that may be configured.
 */
public static Method[] getDeclaredMethods(final Class<?> clazz) {
    Method[] methods = null;
    if (Globals.IS_SECURITY_ENABLED) {
        methods = AccessController.doPrivileged(
                new PrivilegedAction<Method[]>(){
            @Override
            public Method[] run(){
                return clazz.getDeclaredMethods();
            }
        });
    } else {
        methods = clazz.getDeclaredMethods();
    }
    return methods;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:20,代码来源:Introspection.java

示例13: getResource

import org.apache.catalina.Globals; //导入依赖的package包/类
@Override
public URL getResource(String path)
    throws MalformedURLException {
    if (Globals.IS_SECURITY_ENABLED) {
        try {
            return (URL) invokeMethod(context, "getResource", 
                                      new Object[]{path});
        } catch(Throwable t) {
            ExceptionUtils.handleThrowable(t);
            if (t instanceof MalformedURLException){
                throw (MalformedURLException)t;
            }
            return null;
        }
    } else {
        return context.getResource(path);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:ApplicationContextFacade.java

示例14: getInitParameter

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Return the value of the specified initialization parameter, or
 * <code>null</code> if this parameter does not exist.
 *
 * @param name Name of the initialization parameter to retrieve
 */
@Override
public String getInitParameter(final String name) {
    // Special handling for XML settings as the context setting must
    // always override anything that might have been set by an application.
    if (Globals.JASPER_XML_VALIDATION_TLD_INIT_PARAM.equals(name) &&
            context.getTldValidation()) {
        return "true";
    }
    if (Globals.JASPER_XML_VALIDATION_INIT_PARAM.equals(name) &&
            context.getXmlValidation()) {
        return "true";
    }
    if (Globals.JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM.equals(name)) {
        if (!context.getXmlBlockExternal()) {
            // System admin has explicitly changed the default
            return "false";
        }
    }
    return parameters.get(name);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:ApplicationContext.java

示例15: getInitParameterNames

import org.apache.catalina.Globals; //导入依赖的package包/类
/**
 * Return the names of the context's initialization parameters, or an
 * empty enumeration if the context has no initialization parameters.
 */
@Override
public Enumeration<String> getInitParameterNames() {
    Set<String> names = new HashSet<String>();
    names.addAll(parameters.keySet());
    // Special handling for XML settings as these attributes will always be
    // available if they have been set on the context
    if (context.getTldValidation()) {
        names.add(Globals.JASPER_XML_VALIDATION_TLD_INIT_PARAM);
    }
    if (context.getXmlValidation()) {
        names.add(Globals.JASPER_XML_VALIDATION_INIT_PARAM);
    }
    if (!context.getXmlBlockExternal()) {
        names.add(Globals.JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM);
    }
    return Collections.enumeration(names);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:ApplicationContext.java


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