String requestedFilePathRelativeToApp = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), requestedFile);
if (!requestedFile.isFile())
{
String requestedFilePathRelativeToRoot = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir().getParentFile(), requestedFile);
throw new ContentProcessingException("The requested unbundled resource at '"+requestedFilePathRelativeToRoot+"' does not exist or is not a file.");
}
ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream();
contentAccessor.handleRequest(requestedFilePathRelativeToApp, outputBuffer);
return new BinaryResponseContent( new ByteArrayInputStream(outputBuffer.toByteArray()) );
}
else {
throw new ContentProcessingException("unknown request form '" + contentPath.formName + "'.");
}
}
catch (IOException e)
{
throw new ContentProcessingException(e);
}
}