raw.jsp revision 59b6a8c0cc6ef741a7180504b3c371e67c2aa338
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCDDL HEADER START
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweThe contents of this file are subject to the terms of the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCommon Development and Distribution License (the "License").
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweYou may not use this file except in compliance with the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSee LICENSE.txt included in this distribution for the specific
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowelanguage governing permissions and limitations under the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweWhen distributing Covered Code, include this CDDL HEADER in each
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisfile and include the License file at LICENSE.txt.
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'AmoreIf applicable, add the following below this CDDL HEADER, with the
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovfields enclosed by brackets "[]" replaced with your own identifying
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweinformation: Portions Copyright [yyyy] [name of copyright owner]
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovCDDL HEADER END
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovCopyright 2008 Sun Microsystems, Inc. All rights reserved.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovUse is subject to license terms.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovPortions Copyright 2011 Jens Elkner.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov--%><%@page import="
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovorg.opensolaris.opengrok.configuration.RuntimeEnvironment,
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov/* ---------------------- raw.jsp start --------------------- */
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov cfg = PageConfig.get(request);
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov String redir = cfg.canProcess();
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if (redir == null || redir.length() > 0) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if (redir != null) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov response.sendError(HttpServletResponse.SC_NOT_FOUND);
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov String revision = cfg.getRequestedRevision();
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis revision = null;
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov InputStream in = null;
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if (revision != null) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov in = HistoryGuru.getInstance().getRevision(f.getParent(),
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if (request.getDateHeader("If-Modified-Since") >= flast) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov in = new FileInputStream(f);
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov response.setDateHeader("Last-Modified", f.lastModified());
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov } catch (Exception e) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov response.sendError(HttpServletResponse.SC_NOT_FOUND);
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov String mimeType = getServletContext().getMimeType(f.getAbsolutePath());
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov response.setHeader("content-disposition", "attachment; filename="
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov OutputStream o = response.getOutputStream();
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov byte[] buffer = new byte[8192];
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov while ((nr = in.read(buffer)) > 0) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov o.write(buffer, 0, nr);
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov/* ---------------------- raw.jsp end-------------------- */