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

29
LINES

< > BotCompany Repo | #1026245 // imager.site

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

Uses 911K of libraries. Click here for Pure Java version (6775L/38K).

!7

cmodule ImagerSite extends DynPrintLogAndEnabled {
  switchable int httpPort = 80;
  switchable int httpsPort = 443;
  transient autoDispose MyHTTPD server;
  transient autoDispose MyHTTPD secureServer;
  
  start {
    if (!enabled) ret;
    server = new MyHTTPD(httpPort);
    server.enter = lambda0 enter;
    server.serveFunction = func(S uri, SS parms) { serve(uri, parms) };
    server.start();
    print("HTTP server started on port " + server.getPort());
    
    if (httpsPort == 0) ret;
    secureServer = new MyHTTPD(httpsPort);
    secureServer.makeSecure(serveHttps_makeSSLSocketFactory(javaxSecretDir("imager.site.keystore.pkcs12"), "botcompany"));
    secureServer.serveFunction = func(S uri, SS parms) { serve(uri, parms) };
    secureServer.start();
    print("HTTPS server started on port " + secureServer.getPort());
  }
  
  O serve(S uri, SS params) enter {
    ret hhtml(hhead_title("imager.site - the imaging chat bot")
      + hbody(hWebChatBot(#1026248)));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026245
Snippet name: imager.site
Eternal ID of this version: #1026245/13
Text MD5: 5537f6985cb7fa6b5f4e45642c53a2af
Transpilation MD5: b0a92dd666ec35deef05c83826e1cbd8
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-12-19 12:04:05
Source code size: 1019 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 225 / 587
Version history: 12 change(s)
Referenced in: #1027628 - HTTP+HTTPS Server Include for DynModules