Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
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
Model registry
Operate
Environments
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
croft1
floodlight
Commits
182e49ea
Commit
182e49ea
authored
12 years ago
by
Volkan Yazıcı
Browse files
Options
Downloads
Patches
Plain Diff
Add 'host' parameter to RestServerApi.
parent
bcc62313
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/net/floodlightcontroller/restserver/RestApiServer.java
+18
-3
18 additions, 3 deletions
...va/net/floodlightcontroller/restserver/RestApiServer.java
with
18 additions
and
3 deletions
src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
+
18
−
3
View file @
182e49ea
...
...
@@ -40,6 +40,7 @@ import org.restlet.service.StatusService;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
net.floodlightcontroller.core.FloodlightProvider
;
import
net.floodlightcontroller.core.module.FloodlightModuleContext
;
import
net.floodlightcontroller.core.module.FloodlightModuleException
;
import
net.floodlightcontroller.core.module.IFloodlightModule
;
...
...
@@ -50,6 +51,7 @@ public class RestApiServer
protected
static
Logger
logger
=
LoggerFactory
.
getLogger
(
RestApiServer
.
class
);
protected
List
<
RestletRoutable
>
restlets
;
protected
FloodlightModuleContext
fmlContext
;
protected
String
restHost
=
null
;
protected
int
restPort
=
8080
;
// ***********
...
...
@@ -91,7 +93,7 @@ public class RestApiServer
return
slashFilter
;
}
public
void
run
(
FloodlightModuleContext
fmlContext
,
int
restPort
)
{
public
void
run
(
FloodlightModuleContext
fmlContext
,
String
restHost
,
int
restPort
)
{
setStatusService
(
new
StatusService
()
{
@Override
public
Representation
getRepresentation
(
Status
status
,
...
...
@@ -114,7 +116,11 @@ public class RestApiServer
// Start listening for REST requests
try
{
final
Component
component
=
new
Component
();
component
.
getServers
().
add
(
Protocol
.
HTTP
,
restPort
);
if
(
restHost
==
null
)
{
component
.
getServers
().
add
(
Protocol
.
HTTP
,
restPort
);
}
else
{
component
.
getServers
().
add
(
Protocol
.
HTTP
,
restHost
,
restPort
);
}
component
.
getClients
().
add
(
Protocol
.
CLAP
);
component
.
getDefaultHost
().
attach
(
this
);
component
.
start
();
...
...
@@ -148,7 +154,7 @@ public class RestApiServer
}
RestApplication
restApp
=
new
RestApplication
();
restApp
.
run
(
fmlContext
,
restPort
);
restApp
.
run
(
fmlContext
,
restHost
,
restPort
);
}
// *****************
...
...
@@ -190,6 +196,15 @@ public class RestApiServer
// read our config options
Map
<
String
,
String
>
configOptions
=
context
.
getConfigParams
(
this
);
restHost
=
configOptions
.
get
(
"host"
);
if
(
restHost
==
null
)
{
Map
<
String
,
String
>
providerConfigOptions
=
context
.
getConfigParams
(
FloodlightProvider
.
class
);
restHost
=
providerConfigOptions
.
get
(
"openflowhost"
);
}
if
(
restHost
!=
null
)
{
logger
.
debug
(
"REST host set to {}"
,
restHost
);
}
String
port
=
configOptions
.
get
(
"port"
);
if
(
port
!=
null
)
{
restPort
=
Integer
.
parseInt
(
port
);
...
...
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