I'm working remotely on an Ignition installation and using WebDev to retrieve some PDFs in an iFrame. The system is running on a Windows server and I don't have access to the OS.
I've got WebDev and the iFrame working on my laptop (Designer and gateway both on the same machine). PDFs appear in the iFrame.
I'm running into 404 errors on the remote machine. I suspect that it may be a Windows permissions problem but I'd like to be sure.
Does WebDev have any error logs? I can't find anything in the gateway | Status | Logs.
If Perspective can read the folder and list the files (indicating that it has permissions) should WebDev be able to deliver files from that same folder?
Pseudocode - URL to Mounted Folder http://host:port/system/webdev/projectname/assets/a.jpg
If I type the URL into the browser address bar I get the 404. (On my development laptop it works fine.) On something like an Apache web server I could examine the logs to see what the problem is.
Ah, no idea. Poke at logger debug levels, perhaps. (I will admit to not using mounted folders--I don't trust publishing anything that gets tossed in a folder.)
Mounted folders have next to no error handling, because there's next to no code in them. We should probably have some debug or trace logging to at least indicate what's being attempted, but a 404 from a mounted folder is pretty basic:
@Override
public void doGet(PathParser path, HttpServletRequest req, HttpServletResponse resp) throws IOException {
// Strip the leading resourcePath from the requested path to ensure that resources within folders are resolved.
String urlPath = StringUtils.replaceOnce(path.getResource(), resourcePath, "");
// Let Path sort out file separators for us. added bonus of toFile()
File f = Path.of(this.filePath, urlPath).toFile();
if (f.isFile() && f.canRead()) {
String contentType = Files.probeContentType(f.toPath());
if (urlPath.endsWith(".js") && contentType == null) {
contentType = "text/javascript";
}
resp.setContentType(contentType);
resp.setContentLength((int) f.length());
FileUtils.copyFile(f, resp.getOutputStream());
} else {
resp.sendError(404);
}
}