added serverPort

This commit is contained in:
Tony Tam
2015-12-30 00:06:24 -08:00
parent 405e09a057
commit 05b0d8f1bf
3 changed files with 12 additions and 2 deletions

View File

@@ -166,6 +166,16 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
if("/".equals(swagger.getBasePath())) {
swagger.setBasePath("");
}
String host = swagger.getHost();
String port = "8080";
if(host != null) {
String[] parts = host.split(":");
if(parts.length > 0) {
port = parts[1];
}
}
this.additionalProperties.put("serverPort", port);
if(swagger != null && swagger.getPaths() != null) {
for(String pathname : swagger.getPaths().keySet()) {
Path path = swagger.getPath(pathname);