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

26
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 (31658L/189K).

!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);
        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/437
Text MD5: 6aaa48fb861bd4eefeb08e254d4ba108
Transpilation MD5: 4870b2621993ee85a7d262c89c0dac54
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-09-11 14:15:33
Source code size: 786 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 1099 / 17227
Version history: 436 change(s)
Referenced in: [show references]