Browse Source

Update GanswerHttp.java

tags/v0.1.1
Nick Lin GitHub 6 years ago
parent
commit
2bf7f2965a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 30 deletions
  1. +30
    -30
      src/application/GanswerHttp.java

+ 30
- 30
src/application/GanswerHttp.java View File

@@ -12,42 +12,42 @@ public class GanswerHttp {
static int maxSparqlNum = 3;
static int defaultPort = 9999;
public static void main(String[] args) throws Exception {
//step 1: initialize the server with a given port
if(args.length>0){
for(int k=0;k<args.length;k++){
String[] paras = args[k].split("=");
if(paras[0].startsWith("port")){
try{
defaultPort = Integer.parseInt(paras[1]);
}
catch(Exception e){
System.out.println("Port should be an Integer. Using default port 9999 instead.");
defaultPort = 9999;
}
//step 1: initialize the server with a given port
if(args.length>0){
for(int k=0;k<args.length;k++){
String[] paras = args[k].split("=");
if(paras[0].startsWith("port")){
try{
defaultPort = Integer.parseInt(paras[1]);
}
else if(paras[0].startsWith("maxAnswerNum")){
try{
maxAnswerNum = Integer.parseInt(paras[1]);
}
catch(Exception e){
System.out.println("maxAnswerNum should be an Integer. Using default value 100 instead.");
maxAnswerNum = 100;
}
catch(Exception e){
System.out.println("Port should be an Integer. Using default port 9999 instead.");
defaultPort = 9999;
}
else if(paras[0].startsWith("maxSparqlNum")){
try{
maxSparqlNum = Integer.parseInt(paras[1]);
}
catch(Exception e){
System.out.println("maxSparqlNum should be an Integer. Using default value 3 instead.");
maxSparqlNum = 9999;
}
}
else if(paras[0].startsWith("maxAnswerNum")){
try{
maxAnswerNum = Integer.parseInt(paras[1]);
}
catch(Exception e){
System.out.println("maxAnswerNum should be an Integer. Using default value 100 instead.");
maxAnswerNum = 100;
}
else{
System.out.println("Args "+k+" is not a valid parameter!");
}
else if(paras[0].startsWith("maxSparqlNum")){
try{
maxSparqlNum = Integer.parseInt(paras[1]);
}
catch(Exception e){
System.out.println("maxSparqlNum should be an Integer. Using default value 3 instead.");
maxSparqlNum = 9999;
}
}
else{
System.out.println("Args "+k+" is not a valid parameter!");
}
}
}
Server server = new Server(defaultPort);
//step 2: attach gAnswer function handler to the server


Loading…
Cancel
Save