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

13
LINES

< > BotCompany Repo | #1004436 // serveRedirect

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (11756L/70K).

// 302 = "Moved temporarily"
static NanoHTTPD.Response serveRedirect(S url, S contentType default NanoHTTPD.MIME_PLAINTEXT) {
  NanoHTTPD.IStatus status = new NanoHTTPD.IStatus() {
    public String getDescription() { ret "302 Moved temporarily"; }
    public int getRequestStatus() { ret 302; }
  };
  
  NanoHTTPD.Response r = NanoHTTPD.newFixedLengthResponse(
    status,
    contentType, "");
  r.addHeader("Location", url);
  ret r;
}

Author comment

Began life as a copy of #1001852

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004436
Snippet name: serveRedirect
Eternal ID of this version: #1004436/2
Text MD5: b3717a9323bb39c7ef275513895472b5
Transpilation MD5: e2be679b722d320e5ee548e35970c1ab
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-07 06:53:09
Source code size: 451 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 544 / 605
Version history: 1 change(s)
Referenced in: [show references]