forked from loafle/openapi-generator-original
added serverPort
This commit is contained in:
parent
405e09a057
commit
05b0d8f1bf
@ -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);
|
||||
|
@ -16,7 +16,7 @@ mvn clean package jetty:run
|
||||
You can then view the swagger listing here:
|
||||
|
||||
```
|
||||
http://localhost:8080{{contextPath}}/swagger.json
|
||||
http://localhost:{{serverPort}}{{contextPath}}/swagger.json
|
||||
```
|
||||
|
||||
Note that if you have configured the `host` to be something other than localhost, the calls through
|
||||
|
@ -37,7 +37,7 @@
|
||||
<stopPort>8079</stopPort>
|
||||
<stopKey>stopit</stopKey>
|
||||
<httpConnector>
|
||||
<port>8080</port>
|
||||
<port>{{serverPort}}</port>
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
</httpConnector>
|
||||
</configuration>
|
||||
|
Loading…
x
Reference in New Issue
Block a user