| | |
| | | protected long getLastModified(HttpServletRequest req) {
|
| | | File file = GitBlit.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");
|
| | | if (file.exists()) {
|
| | | return file.lastModified();
|
| | | return Math.max(lastModified, file.lastModified());
|
| | | } else {
|
| | | return lastModified;
|
| | | }
|
| | |
| | | ServletContext context = request.getSession().getServletContext();
|
| | | contentType = context.getMimeType(file.getName());
|
| | | response.setContentLength((int) file.length());
|
| | | response.setDateHeader("Last-Modified", file.lastModified());
|
| | | response.setDateHeader("Last-Modified", Math.max(lastModified, file.lastModified()));
|
| | | is = new FileInputStream(file);
|
| | | } else {
|
| | | // default logo
|
| | |
| | | contentType = "image/png";
|
| | | }
|
| | | response.setContentType(contentType);
|
| | | response.setHeader("Cache-Control", "public, max-age=3600, must-revalidate");
|
| | | OutputStream os = response.getOutputStream();
|
| | | byte[] buf = new byte[4096];
|
| | | int bytesRead = is.read(buf);
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | is.close();
|
| | | if(is != null) {
|
| | | is.close();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|