Solved it myself by supplying the webpages through the API (I use the API as a passthrough):
@Path("/api-docs")
@Produces( "text/html,text/css,text/javascript,image/png" )
public class ApiDocs {
@GET
@Path("/{rest : .+}")
public InputStream getReviews(@PathParam("rest") String rest) {
String error;
String webRootPath = {folder in filesystem where swagger-ui is stored};
try {
FileInputStream fi = new FileInputStream(new File(webRootPath + "\\api-docs\\" + rest));
if ("index.html".equals(rest.toLowerCase())) {
try {
String fileString = inputStream2String(fi);
if (fileString != null && !fileString.isEmpty()) {
if (fileString.contains(PETSTORE)) {
fileString = fileString.replaceFirst(PETSTORE, "https://" + {your API host address} + "/swagger.json");
return new ByteArrayInputStream(fileString.getBytes());
} else {
error = "Could not find: " + PETSTORE + " in index.html";
}
} else {
error = "Empty index.html";
}
}catch(IOException ioException) {
error = "Error while reading index.html: " + ioException.getMessage();
}
} else {
return fi;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
error = e.getMessage();
}
return new ByteArrayInputStream(("Swagger-ui setup is not valid: " + webRootPath + (error != null ? " - " + error : "")).getBytes());
}
@GET
public Response getIndex() {
return Response.temporaryRedirect(URI.create("/api-docs/index.html")).build();
}
public String inputStream2String(InputStream in) throws IOException {
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
for (int i; (i = in.read(b)) != -1;) {
out.append(new String(b, 0, i));
}
return out.toString();
}