예제 #1
0
 public static SessionCookie parse(String str) {
   SessionCookie scookie = new SessionCookie();
   if (str != null) {
     PARSER.parse(str, scookie);
   }
   return scookie;
 }
예제 #2
0
  static {
    /**
     * The id part of the session cookie is expected to be web escaped Base64 encoded, so uses
     * a-zA-Z0-9_-, instead of a-zA-Z0-9+/
     */
    Chset typeCharSet = Chset.union(Chset.ALNUM, new Chset("_-"));
    Chset idCharSet = Chset.union(Chset.ALNUM, new Chset("_-"));
    Parser<SessionCookie> servertype = typeCharSet.plus().action(new ServerTypeAction());
    Parser<SessionCookie> id = idCharSet.plus().action(new IdAction());
    Parser<SessionCookie> pair = Parser.sequence(servertype, new Chset('='), id);
    pair = Parser.sequence(servertype, pair);
    Parser<SessionCookie> extrapair = Parser.sequence(new Chset(':'), pair);

    PARSER = Parser.sequence(pair, extrapair.star());
  }