diff --git a/src/main/java/ca/openosp/openo/ui/servlet/ImageRenderingServlet.java b/src/main/java/ca/openosp/openo/ui/servlet/ImageRenderingServlet.java index cb3a6242c14..982c0a2bf54 100644 --- a/src/main/java/ca/openosp/openo/ui/servlet/ImageRenderingServlet.java +++ b/src/main/java/ca/openosp/openo/ui/servlet/ImageRenderingServlet.java @@ -44,6 +44,7 @@ import javax.servlet.http.HttpSession; import java.io.*; import java.net.SocketException; +import java.net.URL; /** * This servlet requires a parameter called "source" which should signify where to get the image from. Examples include source=local_client, or source=hnr_client. Depending on the source, you may optionally need more parameters, as examples a local_client @@ -315,7 +316,6 @@ private static void renderSignatureStored(HttpServletRequest request, HttpServle } private static void renderClinicLogoStored(HttpServletRequest request, HttpServletResponse response) throws IOException { - // sec check HttpSession session = request.getSession(); Provider provider = (Provider) session.getAttribute(SessionConstants.LOGGED_IN_PROVIDER); @@ -324,8 +324,18 @@ private static void renderClinicLogoStored(HttpServletRequest request, HttpServl return; } + // Get the default logo from the web resources + URL defaultResourceUrl = session.getServletContext() + .getResource("/WEB-INF/classes/loginResource/openosp_logo.png"); + String defaultClinicLogo = (defaultResourceUrl != null) ? defaultResourceUrl.getPath() : null; + try { - String filename = OscarProperties.getInstance().getProperty("CLINIC_LOGO_FILE"); + // Set the filename from properties or use the default logo + String filename = OscarProperties.getInstance().getProperty("CLINIC_LOGO_FILE", defaultClinicLogo); + if (filename == null || filename.isEmpty()) { + filename = defaultClinicLogo; + } + if (filename != null) { File f = new File(filename); if (f != null && f.exists()) {