Package hr.fer.zemris.java.webserver.RequestContext

Examples of hr.fer.zemris.java.webserver.RequestContext.RCCookie


   
    rc.setEncoding(encoding);
    rc.setMimeType("text/plain");
    rc.setStatusCode(205);
    rc.setStatusText("Idemo dalje");
    rc.addRCCookie(new RCCookie("korisnik", "perica", 3600, "127.0.0.1", "/"));
    rc.addRCCookie(new RCCookie("zgrada", "B4", null, null, "/"));
   
    // Only at this point will header be created and written...
    rc.write("Čevapčići i Šiščevapčići.");
    os.close();
  }
View Full Code Here


          if(sessionEntry.validUntil < now.getTime()) {
            sessions.remove(sidCandidate);
            sidCandidate = null;
          } else {
            sessionEntry.validUntil = now.getTime() + sessionTimeout*1000;
            outputCookies.add(new RCCookie("sid", sessionEntry.sid, (int) (sessionTimeout), address.toString(), "/"));
          }
          permParams = sessionEntry.map;
        } else {
          Date now = new Date();
          sessionEntry = new SessionMapEntry(sidCandidate, now.getTime() + sessionTimeout*1000, new ConcurrentHashMap<String, String>());
          sessions.put(sidCandidate, sessionEntry);
          permParams = sessionEntry.map;
          outputCookies.add(new RCCookie("sid", sessionEntry.sid, (int) (sessionTimeout), address.toString(), "/"));
        }
      }
     
      if( sidCandidate == null ) {
        StringBuilder sb = new StringBuilder(20);
        for (int i = 0; i < 20; i++) {
          sb.append((char)(sessionRandom.nextInt(26) + 65));
        }
        SID = sb.toString();
        Date now = new Date();
        SessionMapEntry sessionEntry = new SessionMapEntry(SID, now.getTime() + sessionTimeout*1000, new ConcurrentHashMap<String, String>());
        sessions.put(SID, sessionEntry);
        outputCookies.add(new RCCookie("sid", sessionEntry.sid, (int) (sessionTimeout), address.toString(), "/"));
        permParams = sessionEntry.map;
      }
      return;
    }
View Full Code Here

TOP

Related Classes of hr.fer.zemris.java.webserver.RequestContext.RCCookie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.