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


Java Globals.IS_SECURITY_ENABLED属性代码示例

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


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

示例1: getDeclaredMethods

/**
 * 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,代码行数:19,代码来源:Introspection.java

示例2: forward

/**
 * 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,代码行数:28,代码来源:ApplicationDispatcher.java

示例3: getDeclaredFields

/**
 * Obtain the declared fields for a class taking account of any security
 * manager that may be configured.
 */
public static Field[] getDeclaredFields(final Class<?> clazz) {
    Field[] fields = null;
    if (Globals.IS_SECURITY_ENABLED) {
        fields = AccessController.doPrivileged(
                new PrivilegedAction<Field[]>(){
            @Override
            public Field[] run(){
                return clazz.getDeclaredFields();
            }
        });
    } else {
        fields = clazz.getDeclaredFields();
    }
    return fields;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:19,代码来源:Introspection.java

示例4: check

@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:how2j,项目名称:lazycat,代码行数:18,代码来源:WebappClassLoaderBase.java

示例5: isPackageProtectionEnabled

/**
 * Return the <code>SecurityManager</code> only if Security is enabled AND
 * package protection mechanism is enabled.
 */
public static boolean isPackageProtectionEnabled(){
    if (packageDefinitionEnabled && Globals.IS_SECURITY_ENABLED){
        return true;
    }
    return false;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:SecurityUtil.java

示例6: getParameterNames

@Override
public Enumeration<String> getParameterNames() {

    if (request == null) {
        throw new IllegalStateException(
                        sm.getString("requestFacade.nullRequest"));
    }

    if (Globals.IS_SECURITY_ENABLED){
        return AccessController.doPrivileged(
            new GetParameterNamesPrivilegedAction());
    } else {
        return request.getParameterNames();
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:15,代码来源:RequestFacade.java

示例7: setDateHeader

@Override
public void setDateHeader(String name, long date) {

    if (isCommitted()) {
        return;
    }

    if(Globals.IS_SECURITY_ENABLED) {
        AccessController.doPrivileged(new DateHeaderPrivilegedAction
                                         (name, date, false));
    } else {
        response.setDateHeader(name, date);
    }

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

示例8: doFilter

/**
 * Invoke the next filter in this chain, passing the specified request
 * and response.  If there are no more filters in this chain, invoke
 * the <code>service()</code> method of the servlet itself.
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet exception occurs
 */
public void doFilter(ServletRequest request, ServletResponse response)
    throws IOException, ServletException {

    if( Globals.IS_SECURITY_ENABLED ) {
        final ServletRequest req = request;
        final ServletResponse res = response;
        try {
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedExceptionAction() {
                    public Object run() 
                        throws ServletException, IOException {
                        internalDoFilter(req,res);
                        return null;
                    }
                }
            );
        } catch( PrivilegedActionException pe) {
            Exception e = pe.getException();
            if (e instanceof ServletException)
                throw (ServletException) e;
            else if (e instanceof IOException)
                throw (IOException) e;
            else if (e instanceof RuntimeException)
                throw (RuntimeException) e;
            else
                throw new ServletException(e.getMessage(), e);
        }
    } else {
        internalDoFilter(request,response);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:ApplicationFilterChain.java

示例9: recycle

/**
 * Release all object references, and initialize instance variables, in
 * preparation for reuse of this object.
 */
public void recycle() {

    outputBuffer.recycle();
    usingOutputStream = false;
    usingWriter = false;
    appCommitted = false;
    included = false;
    errorState.set(0);
    isCharacterEncodingSet = false;

    if (Globals.IS_SECURITY_ENABLED || Connector.RECYCLE_FACADES) {
        if (facade != null) {
            facade.clear();
            facade = null;
        }
        if (outputStream != null) {
            outputStream.clear();
            outputStream = null;
        }
        if (writer != null) {
            writer.clear();
            writer = null;
        }
    } else {
        writer.recycle();
    }

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:32,代码来源:Response.java

示例10: getParameterMap

@Override
public Map<String,String[]> getParameterMap() {

    if (request == null) {
        throw new IllegalStateException(
                        sm.getString("requestFacade.nullRequest"));
    }

    if (Globals.IS_SECURITY_ENABLED){
        return AccessController.doPrivileged(
            new GetParameterMapPrivilegedAction());
    } else {
        return request.getParameterMap();
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:15,代码来源:RequestFacade.java

示例11: doFilterEvent

/**
 * Process the event, using the security manager if the option is enabled.
 * 
 * @param event the event to process
 * 
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet exception occurs
 */
@Override
public void doFilterEvent(CometEvent event)
    throws IOException, ServletException {

    if( Globals.IS_SECURITY_ENABLED ) {
        final CometEvent ev = event;
        try {
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedExceptionAction<Void>() {
                    @Override
                    public Void run() 
                        throws ServletException, IOException {
                        internalDoFilterEvent(ev);
                        return null;
                    }
                }
            );
        } catch( PrivilegedActionException pe) {
            Exception e = pe.getException();
            if (e instanceof ServletException)
                throw (ServletException) e;
            else if (e instanceof IOException)
                throw (IOException) e;
            else if (e instanceof RuntimeException)
                throw (RuntimeException) e;
            else
                throw new ServletException(e.getMessage(), e);
        }
    } else {
        internalDoFilterEvent(event);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:40,代码来源:ApplicationFilterChain.java

示例12: getCharacterEncoding

public String getCharacterEncoding() {

        if (request == null) {
            throw new IllegalStateException(
                            sm.getString("requestFacade.nullRequest"));
        }

        if (Globals.IS_SECURITY_ENABLED){
            return (String)AccessController.doPrivileged(
                new GetCharacterEncodingPrivilegedAction());
        } else {
            return request.getCharacterEncoding();
        }         
    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:RequestFacade.java

示例13: setDateHeader

@Override
public void setDateHeader(String name, long date) {

	if (isCommitted()) {
		return;
	}

	if (Globals.IS_SECURITY_ENABLED) {
		AccessController.doPrivileged(new DateHeaderPrivilegedAction(name, date, false));
	} else {
		response.setDateHeader(name, date);
	}

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

示例14: ELContextImpl

public ELContextImpl() {
    this(ELResolverImpl.getDefaultResolver());
    if (Globals.IS_SECURITY_ENABLED) {
        functionMapper = new FunctionMapper() {
            public Method resolveFunction(String prefix, String localName) {
                return null;
            }
        };
    } else {
        functionMapper = NullFunctionMapper;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:ELContextImpl.java

示例15: getCharacterEncoding

@Override
public String getCharacterEncoding() {

    if (request == null) {
        throw new IllegalStateException(
                        sm.getString("requestFacade.nullRequest"));
    }

    if (Globals.IS_SECURITY_ENABLED){
        return AccessController.doPrivileged(
            new GetCharacterEncodingPrivilegedAction());
    } else {
        return request.getCharacterEncoding();
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:15,代码来源:RequestFacade.java


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