
"See what the national terror alert is currently set to as well as recent terrorism-related headlines in this customized iPhone web app"
jota = Juan Bello
jota = John Beautiful
public function callWrapper():void {
if (ExternalInterface.available) {
var wrapperFunction:String = "getLanguage";
idioma = ExternalInterface.call(wrapperFunction);
//Alert.show(idioma);
} else {
// Defecto
idioma = "es_US";
}
resourceManager.localeChain = [idioma];
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String prefLanguage = req.getHeader("Accept-Language");
// Parsing sarasa..sasaa
System.out.println(prefLanguage);
super.doGet(req, resp);
}
function getLanguage() {
return navigator.language; // Esto no anda, sepanlo!..Aca iria XMLHTTPRequest..get..sarassaaaa
}
import com.opensymphony.oscache.general.GeneralCacheAdministrator;
public class CacheAdmin {
private static GeneralCacheAdministrator theCacheAdmin = null;
private CacheAdmin(){
//
}
public static GeneralCacheAdministrator getInstance(){
if(theCacheAdmin == null){
theCacheAdmin = new GeneralCacheAdministrator();
}
return theCacheAdmin;
}
}
GeneralCacheAdministrator admin = CacheAdmin.getInstance();
package com.miempresa.training.aop.advices;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MiAOPTimer implements MethodInterceptor {
private static Log logger = LogFactory.getLog(MiAOPTimer.class);
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
long t1 = System.currentTimeMillis();
Object retorno = methodInvocation.proceed();
long t2 = System.currentTimeMillis();
logger.info("Método:"+methodInvocation.getMethod().getName()+" ("+(t2-t1)+" ms)");
return retorno;
}
}
<beans>
<aop:config>
<aop:advisor pointcut="execution(* com.miempresa.training..*.*(..))"
advice-ref="MiAOPTimer"/>
</aop:config>
<bean id="usuarioService" class=com.miempresa.training.aop.UsuarioServiceImpl"/>
<bean id="MiAOPTimer" class="com.miempresa.training.aop.advices.MiAOPTimer"/>
</beans>
package com.miempresa.training.aop.advices;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class MiAOPTimer {
private static Log logger = LogFactory.getLog(MiAOPTimer.class);
@Around("execution(* com.miempresa.training..*.*(..))")
public Object cronometro(ProceedingJoinPoint pjp) throws Throwable{
long t1 = System.currentTimeMillis();
Object retorno = pjp.proceed();
long t2 = System.currentTimeMillis();
logger.info("Método: "+pjp.getSignature().getName()+" (" + (t2-t1) + " ms)");
return retorno;
}
}
<beans>
<bean id="usuarioService" class="com.miempresa.training.aop.ServicioImpl"/>
<aop:aspectj-autoproxy/>
<bean id="miAOPTimer" class="com.miempresa.training.aop.advices.MiAOPTimer"/>
</beans>