Skip to content

Commit

Permalink
Add command line arg --redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
xnbox committed Sep 11, 2021
1 parent 3b962b0 commit 2c05cd0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,20 @@ Latest release: <a href="https://github.com/xnbox/tommy/releases/download/v10.0.
<li>Embedded WAR / ZIP files and directories</li>
</ul>

<h2>Command line:</h2>
<h2>Usage:</h2>


```text
java -jar tommy.jar [options] [custom arg1] [custom arg2] ...
java -jar tommy.jar [options] [custom arg]...
Options:
--help print help message
--app <file | dir | URL> run app from ZIP (or WAR) archive, directory or URL
--port TCP port number, default: 8080
--contextPath context path, default: /
--password <password> provide password (for encrypted ZIP (or WAR) archive)
--help print help message
--app <file|dir|URL> run app from ZIP or WAR archive, directory or URL
--port <number> HTTP TCP port number, default: 8080
--port-ssl <number> HTTPS TCP port number, default: 8443
--redirect redirect HTTP to HTTPS
--context-path <string> context path, default: /
--password <string> provide password (for encrypted ZIP (or WAR) archive)
```


Expand Down
1 change: 0 additions & 1 deletion src/org/tommy/common/utils/CommonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ of this software and associated documentation files (the "Software"), to deal

package org.tommy.common.utils;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand Down
25 changes: 12 additions & 13 deletions src/org/tommy/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class Main {
private static final String ARGS_PORT_OPTION = "--port";
private static final String ARGS_PORT_SSL_OPTION = "--port-ssl";
private static final String ARGS_REDIRECT_OPTION = "--redirect";
private static final String ARGS_CONTEXT_PATH_OPTION = "--contextPath";
private static final String ARGS_CONTEXT_PATH_OPTION = "--context-path";

public static void main(String[] args) throws Throwable {
ManifestUtils.extractBuildDataFromManifest(logger);
Expand Down Expand Up @@ -136,24 +136,23 @@ else if (args[i].equals(ARGS_HELP_OPTION))
if (help) {
StringBuilder sb = new StringBuilder();
sb.append("\n");
sb.append(" 🟩 Tommy Web Server " + System.getProperty("build.version") + '\n');
sb.append(" 🟩 Tommy Web Server " + System.getProperty("build.version") + ". Build: " + System.getProperty("build.timestamp") + '\n');
sb.append("\n");
sb.append(" Build: " + System.getProperty("build.timestamp") + '\n');
sb.append(" OS: " + SystemProperties.OS_NAME + " (" + SystemProperties.OS_ARCH + ")" + '\n');
sb.append(" JVM: " + SystemProperties.JAVA_JAVA_VM_NAME + " (" + SystemProperties.JAVA_JAVA_VERSION + ")\n");
sb.append(" OS: " + SystemProperties.OS_NAME + " (" + SystemProperties.OS_ARCH + ")" + '\n');
sb.append(" JVM: " + SystemProperties.JAVA_JAVA_VM_NAME + " (" + SystemProperties.JAVA_JAVA_VERSION + ")\n");
sb.append("\n");
sb.append(" Usage:\n");
sb.append("\n");
sb.append(" java -jar tommy.jar [options] [custom arg1] [custom arg2] ...\n");
sb.append(" java -jar tommy.jar [options] [custom arg]...\n");
sb.append("\n");
sb.append(" Options:\n");
sb.append(" --help print help message\n");
sb.append(" --app <file|dir|URL> run app from ZIP (or WAR) archive, directory or URL\n");
sb.append(" --port TCP port number (http), default: 8080\n");
sb.append(" --port-ssl TCP port number (https), default: 8443\n");
sb.append(" --redirect redirect http to https\n");
sb.append(" --contextPath context path, default: /\n");
sb.append(" --password <password> provide password (for encrypted ZIP (or WAR) archive)\n");
sb.append(" --help print help message\n");
sb.append(" --app <file|dir|URL> run app from ZIP or WAR archive, directory or URL\n");
sb.append(" --port <number> HTTP TCP port number, default: 8080\n");
sb.append(" --port-ssl <number> HTTPS TCP port number, default: 8443\n");
sb.append(" --redirect redirect HTTP to HTTPS\n");
sb.append(" --context-path <string> context path, default: /\n");
sb.append(" --password <string> provide password for encrypted ZIP or WAR archive\n");
System.out.println(sb);
System.exit(0);
}
Expand Down

0 comments on commit 2c05cd0

Please sign in to comment.