HTTP Configuration
To create a custom HTTP configuration, use the following code inside declareConfiguration
of your GreenApp:
int port = 8000;
builder.useHTTP1xServer(port);
You can add more configurations by appending them to the last configuration:
int port = 8000;
builder.useHTTP1xServer(port)
.useInsecureServer(); //example adding insecure server (no TLS)
Configurations
setHost(String host)
Specify a custom host address for the server.
Support "*" for subnets is enabled, for example "10.*.*.*"
builder.useHTTP1xServer(port)
.setHost("127.0.0.1");
useInsecureServer()
Disable TLS (HTTPS) for this server.
builder.useHTTP1xServer(port)
.useInsecureServer();
setTLS(TLSCertificates tlsCertificates)
Set a custom TLS certificate object for HTTPS. See here for more information about default TLS certificates.
builder.useHTTP1xServer(port)
.setTLS(new TLSCertificate() {
...
});
setClientAuthRequired(boolean b)
Determines if the client requires correct certificates to be allowed to connect to server.
builder.useHTTP1xServer(port)
.setClientAuthRequired(true);
setConcurrentChannelsPerDecryptUnit(int i)
The number of simultaneous stream of decryption for TLS.
builder.useHTTP1xServer(port)
.setConcurrentChannelsPerDecryptUnit(4);
setConcurrentChannelsPerEncryptUnit(int i)
The number of simultaneous stream of encryption for TLS.
builder.useHTTP1xServer(port)
.setConcurrentChannelsPerEncryptUnit(4);
setDecryptionUnitsPerTrack(int i)
The number of decryption unit required per track. Adjust this higher if e.g. users are sending large files per track.
builder.useHTTP1xServer(port)
.setDecryptionUnitsPerTrack(4);
setEncryptionUnitsPerTrack(int i)
The number of encryption unit required per track. Adjust this higher if more encrypted content is required.
builder.useHTTP1xServer(port)
.setEncryptionUnitsPerTrack(4);
setMaxResponseSize(int i)
The largest response size allowed (in bytes).
builder.useHTTP1xServer(port)
.setMaxResponseSize(1 << 20); //1 MB
setServiceName(String name)
Updates the telemetry graph for debugging purposes.
builder.useHTTP1xServer(port)
.setServiceName("TestingServer");
setDefaultPath(String path)
Set the default relative file path (not folder!) to be served by default (i.e. user connects to 'http://localhost/');
builder.useHTTP1xServer(port)
.setDefaultPath("site.html");
logTraffic(boolean b)
Determines if all requests AND responses should be logged.
builder.useHTTP1xServer(port)
.logTraffic(true);
setTracks(int t)
The number of parallel tracks for multicore performance.
builder.useHTTP1xServer(port)
.setTracks(4);
setMaxConnectionBits(int i)
The number of max connection bits. For example, 12 would be 1 << 12 = 4096 total connections.
builder.useHTTP1xServer(port)
.setMaxConnectionBits(12);
setMinConnections(int i)
The number of maximum users that can be reasonable expected. It will be rounded down or up if necessary to be a power of 2.
builder.useHTTP1xServer(port)
.setMinConnections(1000);
Last updated