| | |
| | |
|
| | | /**
|
| | | * Handles requests for logo.png
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class LogoServlet extends HttpServlet {
|
| | | |
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | |
|
| | | private static final long lastModified = System.currentTimeMillis();
|
| | |
|
| | | public LogoServlet() {
|
| | | super();
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | protected long getLastModified(HttpServletRequest req) {
|
| | | File file = GitBlit.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");
|
| | |
| | | return lastModified;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
| | | throws ServletException, IOException {
|
| | |
| | | // default logo
|
| | | response.setDateHeader("Last-Modified", lastModified);
|
| | | is = getClass().getResourceAsStream("/logo.png");
|
| | | } |
| | | }
|
| | | if (contentType == null) {
|
| | | 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);
|