Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo
Commits
6c340a44
Commit
6c340a44
authored
Nov 29, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12044
parent
728d4f68
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
pom.xml
pom.xml
+9
-2
src/main/java/org/b3log/solo/Starter.java
src/main/java/org/b3log/solo/Starter.java
+23
-7
No files found.
pom.xml
View file @
6c340a44
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: Solo POM.
Version: 2.
7.1.8, Nov 18
, 2015
Version: 2.
8.1.8, Nov 29
, 2015
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -105,7 +105,7 @@
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<org.b3log.latke.version>
1.3.
6
</org.b3log.latke.version>
<org.b3log.latke.version>
1.3.
7
</org.b3log.latke.version>
<servlet.version>
3.1.0
</servlet.version>
<slf4j.version>
1.7.5
</slf4j.version>
...
...
@@ -114,6 +114,7 @@
<markdownpapers-core.version>
1.4.2
</markdownpapers-core.version>
<qiniu.version>
7.0.4.1
</qiniu.version>
<jetty.version>
9.2.13.v20150730
</jetty.version>
<commons-cli.version>
1.3.1
</commons-cli.version>
<!-- maven plugin -->
<maven-compiler-plugin.version>
3.3
</maven-compiler-plugin.version>
...
...
@@ -207,6 +208,12 @@
<version>
${jetty.version}
</version>
</dependency>
<dependency>
<groupId>
commons-cli
</groupId>
<artifactId>
commons-cli
</artifactId>
<version>
${commons-cli.version}
</version>
</dependency>
<!-- BEGIN: GAE related dependencies just for testing -->
<dependency>
<groupId>
org.b3log
</groupId>
...
...
src/main/java/org/b3log/solo/Starter.java
View file @
6c340a44
...
...
@@ -19,6 +19,10 @@ import java.awt.Desktop;
import
java.io.File
;
import
java.net.URI
;
import
java.util.ResourceBundle
;
import
org.apache.commons.cli.CommandLine
;
import
org.apache.commons.cli.CommandLineParser
;
import
org.apache.commons.cli.DefaultParser
;
import
org.apache.commons.cli.Options
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.util.Strings
;
import
org.eclipse.jetty.server.Server
;
...
...
@@ -35,7 +39,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
* </ul>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
2, Oct 31
, 2015
* @version 1.0.0.
3, Nov 29
, 2015
* @since 1.2.0
*/
public
final
class
Starter
{
...
...
@@ -57,18 +61,29 @@ public final class Starter {
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
final
Logger
logger
=
Logger
.
getLogger
(
Starter
.
class
);
final
Options
options
=
new
Options
();
options
.
addOption
(
"p"
,
"port"
,
true
,
"listen port"
);
final
CommandLineParser
commandLineParser
=
new
DefaultParser
();
final
CommandLine
commandLine
=
commandLineParser
.
parse
(
options
,
args
);
String
portArg
=
commandLine
.
getOptionValue
(
"p"
);
if
(!
Strings
.
isNumeric
(
portArg
))
{
portArg
=
"9090"
;
}
logger
.
info
(
"Standalone mode, see [https://github.com/b3log/solo/wiki/standalone_mode] for more details."
);
String
webappDirLocation
=
"src/main/webapp/"
;
// POM structure in dev env
final
File
file
=
new
File
(
webappDirLocation
);
if
(!
file
.
exists
())
{
webappDirLocation
=
"."
;
// prod
env
webappDirLocation
=
"."
;
// prod
uction environment
}
final
ResourceBundle
latke
=
ResourceBundle
.
getBundle
(
"latke"
);
final
int
port
=
Integer
.
valueOf
(
portArg
);
final
int
port
=
Integer
.
valueOf
(
latke
.
getString
(
"serverPort"
)
);
final
ResourceBundle
latke
=
ResourceBundle
.
getBundle
(
"latke"
);
String
contextPath
=
latke
.
getString
(
"contextPath"
);
if
(
Strings
.
isEmptyOrNull
(
contextPath
))
{
contextPath
=
"/"
;
...
...
@@ -89,9 +104,10 @@ public final class Starter {
final
String
host
=
latke
.
getString
(
"serverHost"
);
try
{
Desktop
.
getDesktop
().
browse
(
new
URI
(
scheme
+
"://"
+
host
+
":"
+
port
+
contextPath
));
final
int
visitPort
=
Integer
.
valueOf
(
latke
.
getString
(
"serverPort"
));
Desktop
.
getDesktop
().
browse
(
new
URI
(
scheme
+
"://"
+
host
+
":"
+
visitPort
+
contextPath
));
}
catch
(
final
Throwable
e
)
{
e
.
printStackTrace
();
// Ignored
}
server
.
join
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment