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 (32046L/191K).

!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   

Travelled to 4 computer(s): cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, tvejysmllsmz

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: b117c041065d6d4ede038db9842781ba
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: 1139 / 25003
Version history: 437 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1021679 & http://1021679.tinybrain.de