}
////////////////////////////////////////////////////////
import java.lang.reflect.Method;
importorg.springframework.aop.AfterReturningAdvice;
public class WeakKeyCheckAdviceimplements AfterReturningAdvice { public void afterReturning(ObjectreturnValue, Method method,
Object[] args, Object target)throws Throwable {
if ((target instanceofKeyGenerator)
&&("getKey".equals(method.getName()))) {
long key = ((Long)returnValue).longValue();
if (key == KeyGenerator.WEAK_KEY){
throw new SecurityException(
"Key Generator generated aweak key. Try again");
}
}
}
}
////////////////////////////////////////////////////////
importorg.springframework.aop.framework.ProxyFactory;
public class Example {
public static void main(String[]args) {
KeyGenerator keyGen =getKeyGenerator();
for(int x = 0; x < 10; x++) {
try {
long key = keyGen.getKey();
System.out.println("Key:" + key);
} catch(SecurityException ex) {
System.out.println("Weak KeyGenerated!");
}
}
}
private static KeyGeneratorgetKeyGenerator() {
KeyGenerator target = newKeyGenerator();
ProxyFactory factory = newProxyFactory();
factory.setTarget(target);
factory.addAdvice(newWeakKeyCheckAdvice());
return(KeyGenerator)factory.getProxy();
}
}
答案. A
在Spring 的AOP 框架中,()对于处理事务,抛出异常非常有效。
A. BeforeAdvice。
B. AfterAdvice。
ATA试题_j2ee下_多选2-5单... 6页 5财富值 ATA试题 j2ee下 单选9-12单... 15页 5财富值 ATA试题 j2ee下 单选7-8单... 17页 5财富值 ATA试题 ...
ATA试题 j2ee下 单选7-8... ATA试题 j2ee下 单选9-1......答案. ABC 第十二章 J2EE 客户端访问 EJB,可以分为以下()过程。 A. 通过 ...
ATA试题 j2ee下 单选2-6单... 9页 5财富值 ATA试题_j2ee下_多选2-5单... 6页 5财富值 ATA试题 j2ee下 单选9-12单... 15页 5财富值 ATA试题 ...
ATA试题 j2ee下 单选2-6单... 9页 5财富值 ATA试题_j2ee下_多选2-5单...(BCD) A .SOA B .UDDI C .WSDL D .SOAP 第 12 单元 OAS 对 J2EE 的...
ATA试题_j2ee下_多选2-5... 6页 2下载券 ATA试题 j2ee下 单选9-1......1. 容器设置定制了由 J2EE 服务器提供的底层支持,以下()一般不由容器提供服务...
ATA试题_j2ee下_多选2-5单元_IT认证_资格考试/认证_教育专区。第二章目前,JDK 包含以下()三种版本。 A. J2ME B. J2EE。 C. J2SE。 D. J2SDK。 答案. ...
ATA试题 j2ee下 单选9-12单... 15页 5财富值 J2EE 应用开发(下)模拟题 ...答案. ABCD 事务表示一个逻辑工作单元,包括一系列的操作。事务包括以下()基本...
ATA试题_j2ee下_多选2-5... 6页 2下载券 ATA试题 j2ee下 单选9-1......答案. ABCD 事务表示一个逻辑工作单元,包括一系列的操作。事务包括以下() 基本...
ATA 考试上机题库J2EE_计算机软件及应用_IT/计算机_专业资料。截屏一: 1.(B...支持应用的编辑于调试这一套只录了49题,单选1到29题 1.( D)是Java标准版...
热门文档