本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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;
}
}
示例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();
}
}