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).

1  
!752
2  
3  
p {
4  
  serveHttp(8888);
5  
}
6  
7  
static NanoHTTPD.Response serve(S uri, NanoHTTPD.Method method,
8  
  Map<S,S> header, Map<S,S> parms, Map<S,S> files) {
9  
  print("Serving HTML.");
10  
  NanoHTTPD.IHTTPSession session = NanoHTTPD.currentSession.get();
11  
  NanoHTTPD.CookieHandler cookies = session.getCookies();
12  
  new StringBuilder buf;
13  
  for (S name : cookies)
14  
    buf.append(name + " = " + cookies.read(name) + "!<br>");
15  
  cookies.set("bla", "" + unixTime(), 1);
16  
  ret serveHTML(buf);
17  
}

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: 806 / 752
Referenced in: [show references]