Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class CommunityRestConf extends AbstractLightyModule {
private final DOMActionService domActionService;
private final DOMSchemaService domSchemaService;
private final InetAddress inetAddress;
private final String restconfServletContextPath;
private final int httpPort;
private AbstractLightyWebServer jettyServer;
private LightyJettyServerProvider lightyServerBuilder;
Expand All @@ -59,6 +60,7 @@ public CommunityRestConf(final DOMDataBroker domDataBroker, final DOMRpcService
final DOMSchemaService domSchemaService,
final InetAddress inetAddress,
final int httpPort,
final String restconfServletContextPath,
final LightyJettyServerProvider serverBuilder,
final WebContextSecurer webContextSecurer) {
this.domDataBroker = domDataBroker;
Expand All @@ -70,21 +72,25 @@ public CommunityRestConf(final DOMDataBroker domDataBroker, final DOMRpcService
this.domSchemaService = domSchemaService;
this.inetAddress = inetAddress;
this.httpPort = httpPort;
this.restconfServletContextPath = restconfServletContextPath;
this.webContextSecurer = (webContextSecurer == null) ? new LightyWebContextSecurer() : webContextSecurer;
}

public CommunityRestConf(final DOMDataBroker domDataBroker, final DOMRpcService domRpcService,
final DOMNotificationService domNotificationService, final DOMActionService domActionService,
final DOMMountPointService domMountPointService, final DOMSchemaService domSchemaService,
final InetAddress inetAddress, final int httpPort, final WebContextSecurer webContextSecurer) {
final InetAddress inetAddress, final int httpPort,
final String restconfServletContextPath, final WebContextSecurer webContextSecurer) {
this(domDataBroker, domRpcService, domNotificationService, domActionService,
domMountPointService, domSchemaService, inetAddress, httpPort, null, webContextSecurer);
domMountPointService, domSchemaService, inetAddress, httpPort,
restconfServletContextPath,null, webContextSecurer);
}

@Override
protected boolean initProcedure() throws ServletException {
final Stopwatch stopwatch = Stopwatch.createStarted();
final JaxRsEndpointConfiguration streamsConfiguration = RestConfConfigUtils.getStreamsConfiguration();
final JaxRsEndpointConfiguration streamsConfiguration =
RestConfConfigUtils.getStreamsConfiguration(restconfServletContextPath);

LOG.info("Starting RestconfApplication with configuration {}", streamsConfiguration);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public CommunityRestConf build() {
restconfConfiguration.getDomSchemaService(),
restconfConfiguration.getInetAddress(),
restconfConfiguration.getHttpPort(),
restconfConfiguration.getRestconfServletContextPath(),
lightyServerBuilder,
webContextSecurer
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public void setHttpPort(final int httpPort) {
}

public String getRestconfServletContextPath() {
return this.restconfServletContextPath;
return restconfServletContextPath.startsWith("/")
? this.restconfServletContextPath.substring(1) : this.restconfServletContextPath;
}

public void setRestconfServletContextPath(final String restconfServletContextPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ public static RestConfConfiguration getDefaultRestConfConfiguration() {
return new RestConfConfiguration();
}

public static JaxRsEndpointConfiguration getStreamsConfiguration() {
public static JaxRsEndpointConfiguration getStreamsConfiguration(final String restconfPath) {
return new JaxRsEndpointConfiguration(ErrorTagMapping.RFC8040, PrettyPrintParam.FALSE,
Uint16.valueOf(MAXIMUM_FRAGMENT_LENGTH), Uint32.valueOf(HEARTBEAT_INTERVAL),
RESTCONF_CONFIG_ROOT_ELEMENT_NAME);
Uint16.valueOf(MAXIMUM_FRAGMENT_LENGTH), Uint32.valueOf(HEARTBEAT_INTERVAL), restconfPath);
}
}
Loading