• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SecurityUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: load

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public void load() throws ClassNotFoundException, IOException {
    if (SecurityUtil.isPackageProtectionEnabled()){
        try{
            AccessController.doPrivileged( new PrivilegedDoLoad() );
        } catch (PrivilegedActionException ex){
            Exception exception = ex.getException();
            if (exception instanceof ClassNotFoundException) {
                throw (ClassNotFoundException)exception;
            } else if (exception instanceof IOException) {
                throw (IOException)exception;
            }
            if (log.isDebugEnabled()) {
                log.debug("Unreported exception in load() ", exception);
            }
        }
    } else {
        doLoad();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:StandardManager.java


示例2: removeSession

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Remove this Session from the active Sessions for this Manager,
 * and from the Store.
 *
 * @param id Session's id to be removed
 */    
protected void removeSession(String id){
    try {
        if (SecurityUtil.isPackageProtectionEnabled()){
            try{
                AccessController.doPrivileged(new PrivilegedStoreRemove(id));
            }catch(PrivilegedActionException ex){
                Exception exception = ex.getException();
                log.error("Exception in the Store during removeSession: "
                          + exception, exception);
            }
        } else {
             store.remove(id);
        }               
    } catch (IOException e) {
        log.error("Exception removing session  " + e.getMessage(), e);
    }        
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:PersistentManagerBase.java


示例3: getSession

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Return the <code>HttpSession</code> for which this object
 * is the facade.
 */
@Override
public HttpSession getSession() {

    if (facade == null){
        if (SecurityUtil.isPackageProtectionEnabled()){
            final StandardSession fsession = this;
            facade = AccessController.doPrivileged(
                    new PrivilegedAction<StandardSessionFacade>(){
                @Override
                public StandardSessionFacade run(){
                    return new StandardSessionFacade(fsession);
                }
            });
        } else {
            facade = new StandardSessionFacade(this);
        }
    }
    return (facade);

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


示例4: clearStore

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Clear all sessions from the Store.
 */
public void clearStore() {

    if (store == null)
        return;

    try {     
        if (SecurityUtil.isPackageProtectionEnabled()){
            try{
                AccessController.doPrivileged(new PrivilegedStoreClear());
            }catch(PrivilegedActionException ex){
                Exception exception = ex.getException();
                log.error("Exception clearing the Store: " + exception,
                        exception);
            }
        } else {
            store.clear();
        }
    } catch (IOException e) {
        log.error("Exception clearing the Store: " + e, e);
    }

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


示例5: generateCookieString

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
public StringBuffer generateCookieString(final Cookie cookie) {
    final StringBuffer sb = new StringBuffer();
    //web application code can receive a IllegalArgumentException
    //from the appendCookieValue invocation
    if (SecurityUtil.isPackageProtectionEnabled()) {
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
            @Override
            public Void run(){
                ServerCookie.appendCookieValue
                    (sb, cookie.getVersion(), cookie.getName(),
                     cookie.getValue(), cookie.getPath(),
                     cookie.getDomain(), cookie.getComment(),
                     cookie.getMaxAge(), cookie.getSecure(),
                     cookie.isHttpOnly());
                return null;
            }
        });
    } else {
        ServerCookie.appendCookieValue
            (sb, cookie.getVersion(), cookie.getName(), cookie.getValue(),
                 cookie.getPath(), cookie.getDomain(), cookie.getComment(),
                 cookie.getMaxAge(), cookie.getSecure(),
                 cookie.isHttpOnly());
    }
    return sb;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:Response.java


示例6: doPrivileged

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public <T extends Servlet> T createServlet(Class<T> c) throws ServletException {
	if (SecurityUtil.isPackageProtectionEnabled()) {
		try {
			return (T) invokeMethod(context, "createServlet", new Object[] { c });
		} catch (Throwable t) {
			ExceptionUtils.handleThrowable(t);
			if (t instanceof ServletException) {
				throw (ServletException) t;
			}
			return null;
		}
	} else {
		return context.createServlet(c);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:18,代码来源:ApplicationContextFacade.java


示例7: getServlet

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * @deprecated As of Java Servlet API 2.1, with no direct replacement.
 */
@Override
@Deprecated
public Servlet getServlet(String name)
    throws ServletException {
    if (SecurityUtil.isPackageProtectionEnabled()) {
        try {
            return (Servlet) invokeMethod(context, "getServlet", 
                                          new Object[]{name});
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            if (t instanceof ServletException) {
                throw (ServletException) t;
            }
            return null;
        }
    } else {
        return context.getServlet(name);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:ApplicationContextFacade.java


示例8: getParameterValues

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public String[] getParameterValues(String name) {

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

	String[] ret = null;

	/*
	 * Clone the returned array only if there is a security manager in
	 * place, so that performance won't suffer in the non-secure case
	 */
	if (SecurityUtil.isPackageProtectionEnabled()) {
		ret = AccessController.doPrivileged(new GetParameterValuePrivilegedAction(name));
		if (ret != null) {
			ret = ret.clone();
		}
	} else {
		ret = request.getParameterValues(name);
	}

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


示例9: doPrivileged

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public <T extends Servlet> T createServlet(Class<T> c)
throws ServletException {
    if (SecurityUtil.isPackageProtectionEnabled()) {
        try {
            return (T) invokeMethod(context, "createServlet", 
                                          new Object[]{c});
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            if (t instanceof ServletException) {
                throw (ServletException) t;
            }
            return null;
        }
    } else {
        return context.createServlet(c);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:20,代码来源:ApplicationContextFacade.java


示例10: doPrivileged

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public <T extends Filter> T createFilter(Class<T> c)
throws ServletException {
    if (SecurityUtil.isPackageProtectionEnabled()) {
        try {
            return (T) invokeMethod(context, "createFilter", 
                                          new Object[]{c});
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            if (t instanceof ServletException) {
                throw (ServletException) t;
            }
            return null;
        }
    } else {
        return context.createFilter(c);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:20,代码来源:ApplicationContextFacade.java


示例11: getCookies

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public Cookie[] getCookies() {

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

    Cookie[] ret = null;

    /*
     * Clone the returned array only if there is a security manager
     * in place, so that performance won't suffer in the non-secure case
     */
    if (SecurityUtil.isPackageProtectionEnabled()){
        ret = AccessController.doPrivileged(
            new GetCookiesPrivilegedAction());
        if (ret != null) {
            ret = ret.clone();
        }
    } else {
        ret = request.getCookies();
    }

    return ret;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:27,代码来源:RequestFacade.java


示例12: clearStore

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Clear all sessions from the Store.
 */
public void clearStore() {

	if (store == null)
		return;

	try {
		if (SecurityUtil.isPackageProtectionEnabled()) {
			try {
				AccessController.doPrivileged(new PrivilegedStoreClear());
			} catch (PrivilegedActionException ex) {
				Exception exception = ex.getException();
				log.error("Exception clearing the Store: " + exception, exception);
			}
		} else {
			store.clear();
		}
	} catch (IOException e) {
		log.error("Exception clearing the Store: " + e, e);
	}

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


示例13: removeSession

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Remove this Session from the active Sessions for this Manager,
 * and from the Store.
 *
 * @param id Session's id to be removed
 */    
protected void removeSession(String id){
    try {
        if (SecurityUtil.isPackageProtectionEnabled()){
            try{
                AccessController.doPrivileged(new PrivilegedStoreRemove(id));
            }catch(PrivilegedActionException ex){
                Exception exception = ex.getException();
                log.error("Exception in the Store during removeSession: "
                          + exception);
                exception.printStackTrace();                        
            }
        } else {
             store.remove(id);
        }               
    } catch (IOException e) {
        log.error("Exception removing session  " + e.getMessage());
        e.printStackTrace();
    }        
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PersistentManagerBase.java


示例14: getSession

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Return the <code>HttpSession</code> for which this object
 * is the facade.
 */
public HttpSession getSession() {

    if (facade == null){
        if (SecurityUtil.isPackageProtectionEnabled()){
            final StandardSession fsession = this;
            facade = (StandardSessionFacade)AccessController.doPrivileged(new PrivilegedAction(){
                public Object run(){
                    return new StandardSessionFacade(fsession);
                }
            });
        } else {
            facade = new StandardSessionFacade(this);
        }
    }
    return (facade);

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


示例15: release

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Release the Filter instance associated with this FilterConfig,
 * if there is one.
 */
void release() {

    if (this.filter != null)
    {
        if (Globals.IS_SECURITY_ENABLED) {
            try {
                SecurityUtil.doAsPrivilege("destroy", filter);
            } catch(java.lang.Exception ex){
                context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
            }
            SecurityUtil.remove(filter);
        } else {
            filter.destroy();
        }
        if (!context.getIgnoreAnnotations()) {
            try {
                ((StandardContext) context).getInstanceManager().destroyInstance(this.filter);
            } catch (Exception e) {
                context.getLogger().error("ApplicationFilterConfig.preDestroy", e);
            }
        }
    }
    this.filter = null;

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


示例16: executeMethod

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
/**
 * Executes the method of the specified <code>ApplicationContext</code>
 * @param method The method object to be invoked.
 * @param context The AppliationContext object on which the method
 *                   will be invoked
 * @param params The arguments passed to the called method.
 */
private Object executeMethod(final Method method, 
                             final ApplicationContext context,
                             final Object[] params) 
        throws PrivilegedActionException, 
               IllegalAccessException,
               InvocationTargetException {
                                 
    if (SecurityUtil.isPackageProtectionEnabled()){
       return AccessController.doPrivileged(new PrivilegedExceptionAction(){
            public Object run() throws IllegalAccessException, InvocationTargetException{
                return method.invoke(context,  params);
            }
        });
    } else {
        return method.invoke(context, params);
    }        
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:ApplicationContextFacade.java


示例17: available

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public int available() throws IOException {

    if (SecurityUtil.isPackageProtectionEnabled()){
        try{
            Integer result =
                AccessController.doPrivileged(
                    new PrivilegedExceptionAction<Integer>(){

                        @Override
                        public Integer run() throws IOException{
                            Integer integer = Integer.valueOf(ib.available());
                            return integer;
                        }

            });
            return result.intValue();
        } catch(PrivilegedActionException pae){
            Exception e = pae.getException();
            if (e instanceof IOException){
                throw (IOException)e;
            } else {
                throw new RuntimeException(e.getMessage(), e);
            }
        }
    } else {
       return ib.available();
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:30,代码来源:CoyoteInputStream.java


示例18: setContentType

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public void setContentType(String type) {

    if (isCommitted()) {
        return;
    }

    if (SecurityUtil.isPackageProtectionEnabled()){
        AccessController.doPrivileged(new SetContentTypePrivilegedAction(type));
    } else {
        response.setContentType(type);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:ResponseFacade.java


示例19: flushBuffer

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public void flushBuffer()
    throws IOException {

    if (isFinished()) {
        //            throw new IllegalStateException
        //                (/*sm.getString("responseFacade.finished")*/);
        return;
    }

    if (SecurityUtil.isPackageProtectionEnabled()){
        try{
            AccessController.doPrivileged(
                    new PrivilegedExceptionAction<Void>(){

                @Override
                public Void run() throws IOException{
                    response.setAppCommitted(true);

                    response.flushBuffer();
                    return null;
                }
            });
        } catch(PrivilegedActionException e){
            Exception ex = e.getException();
            if (ex instanceof IOException){
                throw (IOException)ex;
            }
        }
    } else {
        response.setAppCommitted(true);

        response.flushBuffer();
    }

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


示例20: read

import org.apache.catalina.security.SecurityUtil; //导入依赖的package包/类
@Override
public int read()
    throws IOException {
    if (SecurityUtil.isPackageProtectionEnabled()){

        try{
            Integer result =
                AccessController.doPrivileged(
                    new PrivilegedExceptionAction<Integer>(){

                        @Override
                        public Integer run() throws IOException{
                            Integer integer = Integer.valueOf(ib.readByte());
                            return integer;
                        }

            });
            return result.intValue();
        } catch(PrivilegedActionException pae){
            Exception e = pae.getException();
            if (e instanceof IOException){
                throw (IOException)e;
            } else {
                throw new RuntimeException(e.getMessage(), e);
            }
        }
    } else {
        return ib.readByte();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:CoyoteInputStream.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RegistrationClient类代码示例发布时间:2022-05-22
下一篇:
Java LocalResourceStatus类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap