Changeset b2263ef


Ignore:
Timestamp:
Sep 2, 2011 5:24:14 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3d33524
Parents:
5f7983ca
Message:

cache user-agent processing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/CSSHelper.java

    r5f7983ca rb2263ef  
    11package net.i2p.router.web;
     2
     3import java.util.Map;
     4import java.util.concurrent.ConcurrentHashMap;
    25
    36/**
     
    69 */
    710public class CSSHelper extends HelperBase {
     11
     12    private static final Map<String, Boolean> _UACache = new ConcurrentHashMap();
     13
    814    public CSSHelper() {}
    915   
     
    7076     */
    7177    public boolean allowIFrame(String ua) {
    72         return ua == null ||
     78        if (ua == null)
     79            return true;
     80        Boolean brv = _UACache.get(ua);
     81        if (brv != null)
     82            return brv.booleanValue();
     83        boolean rv = shouldAllowIFrame(ua);
     84        _UACache.put(ua, Boolean.valueOf(rv));
     85        return rv;
     86    }
     87
     88    private static boolean shouldAllowIFrame(String ua) {
     89        return
    7390                               // text
    7491                             !(ua.startsWith("Lynx") || ua.startsWith("w3m") ||
Note: See TracChangeset for help on using the changeset viewer.