raw.jsp revision eee3266b4179dae85826d6139b3b540838ea955a
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeCDDL HEADER START
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeThe contents of this file are subject to the terms of the
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeCommon Development and Distribution License (the "License").
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeYou may not use this file except in compliance with the License.
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeSee LICENSE.txt included in this distribution for the specific
ef604281b397eceb0d9f67b87378b7c0b751967dTrond Norbyelanguage governing permissions and limitations under the License.
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeWhen distributing Covered Code, include this CDDL HEADER in each
ef604281b397eceb0d9f67b87378b7c0b751967dTrond Norbyefile and include the License file at LICENSE.txt.
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeIf applicable, add the following below this CDDL HEADER, with the
ef604281b397eceb0d9f67b87378b7c0b751967dTrond Norbyefields enclosed by brackets "[]" replaced with your own identifying
ef604281b397eceb0d9f67b87378b7c0b751967dTrond Norbyeinformation: Portions Copyright [yyyy] [name of copyright owner]
ef604281b397eceb0d9f67b87378b7c0b751967dTrond NorbyeCDDL HEADER END
eee3266b4179dae85826d6139b3b540838ea955aKnut Anders HatlenCopyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
14a41f02433890d19b2f871156271e3388cd0845Jens ElknerPortions Copyright 2011 Jens Elkner.
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner--%><%@page import="
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerorg.opensolaris.opengrok.configuration.RuntimeEnvironment,
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner/* ---------------------- raw.jsp start --------------------- */
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String redir = cfg.canProcess();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (redir == null || redir.length() > 0) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (redir != null) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen response.sendError(HttpServletResponse.SC_NOT_FOUND);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String revision = cfg.getRequestedRevision();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen revision = null;
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen InputStream in = null;
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (revision != null) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen in = HistoryGuru.getInstance().getRevision(f.getParent(),
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (request.getDateHeader("If-Modified-Since") >= flast) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen in = new FileInputStream(f);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen response.setContentLength((int) f.length());
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen response.setDateHeader("Last-Modified", f.lastModified());
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen } catch (Exception e) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen response.sendError(HttpServletResponse.SC_NOT_FOUND);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String mimeType = getServletContext().getMimeType(f.getAbsolutePath());
d8371503c60e1f6933455e25b1cc47e4858a3a43Vladimir Kotal response.setHeader("content-disposition", "attachment; filename="
d8371503c60e1f6933455e25b1cc47e4858a3a43Vladimir Kotal response.setHeader("content-type", "text/plain");
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen OutputStream o = response.getOutputStream();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen byte[] buffer = new byte[8192];
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen while ((nr = in.read(buffer)) > 0) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen o.write(buffer, 0, nr);
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner/* ---------------------- raw.jsp end-------------------- */