code: @Override
      public void init(Context context) {
          try {
              // get the cookie that contains session information:
              Cookie cookie = context.request().cookie(applicationCookiePrefix
                      + SESSION_SUFFIX);
  
              // check that the cookie is not empty:
              if (cookie != null && cookie.value() != null
                      && !"".equals(cookie.value().trim())
                      && cookie.value().contains("-")) {
                  String value = cookie.value();
                  // the first substring until "-" is the sign
                  String sign = value.substring(0, value.indexOf('-'));
  
                  // rest from "-" until the end is the payload of the cookie
                  String payload = value.substring(value.indexOf('-') + 1);
  
                  if (CookieDataCodec.safeEquals(sign,
                          crypto.sign(payload))) {
                      CookieDataCodec.decode(data, payload);
                  } else {
                      LOGGER.warn("Invalid session cookie - signature check failed");
                  }
  
                  // Make sure session contains valid timestamp
                  if (!data.containsKey(TIMESTAMP_KEY)) {
                      data.clear();
                  } else {
                      if (Long.parseLong(data.get(TIMESTAMP_KEY))
                              + sessionExpireTimeInMs < System
                              .currentTimeMillis()) {
                          // Session expired
                          sessionDataHasBeenChanged = true;
                          data.clear();
                      }
                  }
  
                  // Everything's alright => prolong session
                  data.put(TIMESTAMP_KEY, Long.toString(System.currentTimeMillis()));
              }
  
          } catch (UnsupportedEncodingException unsupportedEncodingException) {
              LOGGER.error("Encoding exception - this must not happen", unsupportedEncodingException);
          }
      }
docs: Has to be called initially.
  
  @param context the current http context.