Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigDataViewer_Server_Extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
BigDataViewer_Server_Extension
Commits
f53a3dcc
Commit
f53a3dcc
authored
5 years ago
by
tpietzsch
Browse files
Options
Downloads
Patches
Plain Diff
Add commandline parameter for base url
change urls in datasets etc when running behind a proxy
parent
bb9bff9f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/bdv/server/BigDataServer.java
+23
-4
23 additions, 4 deletions
src/main/java/bdv/server/BigDataServer.java
with
23 additions
and
4 deletions
src/main/java/bdv/server/BigDataServer.java
+
23
−
4
View file @
f53a3dcc
...
...
@@ -68,8 +68,9 @@ public class BigDataServer
hostname
=
"localhost"
;
}
final
String
thumbnailDirectory
=
null
;
final
String
baseUrl
=
null
;
final
boolean
enableManagerContext
=
false
;
return
new
Parameters
(
port
,
hostname
,
new
HashMap
<
String
,
String
>(),
thumbnailDirectory
,
enableManagerContext
);
return
new
Parameters
(
port
,
hostname
,
new
HashMap
<
String
,
String
>(),
thumbnailDirectory
,
baseUrl
,
enableManagerContext
);
}
public
static
void
main
(
final
String
[]
args
)
throws
Exception
...
...
@@ -91,7 +92,8 @@ public class BigDataServer
connector
.
setPort
(
params
.
getPort
()
);
LOG
.
info
(
"Set connectors: "
+
connector
);
server
.
setConnectors
(
new
Connector
[]
{
connector
}
);
final
String
baseURL
=
"http://"
+
server
.
getURI
().
getHost
()
+
":"
+
params
.
getPort
();
final
String
baseURL
=
params
.
getBaseUrl
()
!=
null
?
params
.
getBaseUrl
()
:
"http://"
+
server
.
getURI
().
getHost
()
+
":"
+
params
.
getPort
();
System
.
out
.
println
(
"XXXXXX baseURL = "
+
baseURL
);
// Handler initialization
final
HandlerCollection
handlers
=
new
HandlerCollection
();
...
...
@@ -138,14 +140,17 @@ public class BigDataServer
private
final
String
thumbnailDirectory
;
private
final
String
baseUrl
;
private
final
boolean
enableManagerContext
;
Parameters
(
final
int
port
,
final
String
hostname
,
final
Map
<
String
,
String
>
datasetNameToXml
,
final
String
thumbnailDirectory
,
final
boolean
enableManagerContext
)
Parameters
(
final
int
port
,
final
String
hostname
,
final
Map
<
String
,
String
>
datasetNameToXml
,
final
String
thumbnailDirectory
,
final
String
baseUrl
,
final
boolean
enableManagerContext
)
{
this
.
port
=
port
;
this
.
hostname
=
hostname
;
this
.
datasetNameToXml
=
datasetNameToXml
;
this
.
thumbnailDirectory
=
thumbnailDirectory
;
this
.
baseUrl
=
baseUrl
;
this
.
enableManagerContext
=
enableManagerContext
;
}
...
...
@@ -159,6 +164,11 @@ public class BigDataServer
return
hostname
;
}
public
String
getBaseUrl
()
{
return
baseUrl
;
}
public
String
getThumbnailDirectory
()
{
return
thumbnailDirectory
;
...
...
@@ -217,6 +227,12 @@ public class BigDataServer
.
withArgName
(
"DIRECTORY"
)
.
create
(
"t"
)
);
options
.
addOption
(
OptionBuilder
.
withDescription
(
"Base URL under which the server will be made visible (e.g., if behind a proxy)"
)
.
hasArg
()
.
withArgName
(
"BASEURL"
)
.
create
(
"b"
)
);
if
(
Constants
.
ENABLE_EXPERIMENTAL_FEATURES
)
{
options
.
addOption
(
OptionBuilder
...
...
@@ -239,6 +255,9 @@ public class BigDataServer
// Getting thumbnail directory option
final
String
thumbnailDirectory
=
cmd
.
getOptionValue
(
"t"
,
defaultParameters
.
getThumbnailDirectory
()
);
// Getting base url option
final
String
baseUrl
=
cmd
.
getOptionValue
(
"b"
,
defaultParameters
.
getBaseUrl
()
);
final
HashMap
<
String
,
String
>
datasets
=
new
HashMap
<
String
,
String
>(
defaultParameters
.
getDatasets
()
);
boolean
enableManagerContext
=
false
;
...
...
@@ -294,7 +313,7 @@ public class BigDataServer
if
(
datasets
.
isEmpty
()
)
throw
new
IllegalArgumentException
(
"Dataset list is empty."
);
return
new
Parameters
(
port
,
serverName
,
datasets
,
thumbnailDirectory
,
enableManagerContext
);
return
new
Parameters
(
port
,
serverName
,
datasets
,
thumbnailDirectory
,
baseUrl
,
enableManagerContext
);
}
catch
(
final
ParseException
|
IllegalArgumentException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment