/** * 编码 * * @param attribute */ private void encodeAttribute(AttributeDO attribute) { if (attribute == null) { return; } String value = encodeValue(attribute.getValue(), attribute.getAttributeConfigDO()); if (value == ERROR) { return; } addCookieToResponse(attribute.getAttributeConfigDO(), value, attribute == null); }
@Override public Object getAttribute(AttributeConfigDO ac) { String key = ac.getKey(); // 先从已解析中获取 AttributeDO attribute = attributes.get(key); if (attribute == null) { attribute = getAttributeFromCookies(ac); // 保存到已解析map attributes.put(key, attribute); } return attribute.getValue(); }