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

27
LINES

< > BotCompany Repo | #1021679 // Gazelle Web Server [LIVE at http://gazelle.botcompany.de, Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (32638L/194K).

!7

!include #1022531 // DynGazelleWebServer

// we want our own structure() because of DynamicObject
module GazelleWebServer > DynGazelleWebServer {
  Request newRequest() { ret new Request; }
  
  class Request extends DynGazelleWebServer.Request {
    O serve(S uri, SS params) {
      S domain = serveHttp_domainName();
      if (swicOneOf(domain, "ontology.", "monkey.")) {
        // TODO: only works with text/html
        S answer = (S) callF(dm_get('ontologyWebServer, 'serveFunction), uri, params);
        if (answer != null) ret answer;
      }
      
      if (!swic(domain, "gazelle.")) {
        print("FREAK domain: " + domain);
        try object spamTest();
        ret serveRedirect("https://BotCompany.de");
      }
        
      ret super.serve(uri, params);
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021679
Snippet name: Gazelle Web Server [LIVE at http://gazelle.botcompany.de, Dyn Module]
Eternal ID of this version: #1021679/438
Text MD5: 3b709c22ac56b3b1e2d4bf30b6748a7a
Transpilation MD5: f5be9e78575522ce5ce283e478825d42
Author: stefan
Category: javax / stefan's os / a.i. / web
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-25 21:29:38
Source code size: 818 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 1372 / 46275
Version history: 437 change(s)
Referenced in: #1021844 - Gazelle Web Server v1 [backup]
#1021960 - Gazelle Web Server backup
#1022531 - DynGazelleWebServer