Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1002152 // NanoHTTPD Session Test

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2471L/19K/50K).

!752

p {
  serveHttp(8888);
}

static NanoHTTPD.Response serve(S uri, NanoHTTPD.Method method,
  Map<S,S> header, Map<S,S> parms, Map<S,S> files) {
  print("Serving HTML.");
  NanoHTTPD.IHTTPSession session = NanoHTTPD.currentSession.get();
  NanoHTTPD.CookieHandler cookies = session.getCookies();
  new StringBuilder buf;
  for (S name : cookies)
    buf.append(name + " = " + cookies.read(name) + "!<br>");
  cookies.set("bla", "" + unixTime(), 1);
  ret serveHTML(buf);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002152
Snippet name: NanoHTTPD Session Test
Eternal ID of this version: #1002152/1
Text MD5: 0fb6f11076c9b9fe54d173c8f87374a1
Transpilation MD5: 3a9dca3b9181df8e7a4461533419c712
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-22 02:28:13
Source code size: 492 bytes / 17 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 805 / 751
Referenced in: [show references]