raw.jsp revision 1186
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox UserCDDL HEADER START
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark AndrewsThe contents of this file are subject to the terms of the
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark AndrewsCommon Development and Distribution License (the "License").
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark AndrewsYou may not use this file except in compliance with the License.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserSee LICENSE.txt included in this distribution for the specific
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrewslanguage governing permissions and limitations under the License.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserWhen distributing Covered Code, include this CDDL HEADER in each
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrewsfile and include the License file at LICENSE.txt.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserIf applicable, add the following below this CDDL HEADER, with the
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox Userfields enclosed by brackets "[]" replaced with your own identifying
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrewsinformation: Portions Copyright [yyyy] [name of copyright owner]
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserCDDL HEADER END
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserCopyright 2008 Sun Microsystems, Inc. All rights reserved.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserUse is subject to license terms.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserPortions Copyright 2011 Jens Elkner.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User--%><%@page import="
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrewsorg.opensolaris.opengrok.configuration.RuntimeEnvironment,
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User/* ---------------------- raw.jsp start --------------------- */
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User cfg = PageConfig.get(request);
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews String redir = cfg.canProcess();
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews if (redir == null || redir.length() > 0) {
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews if (redir != null) {
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews response.sendError(HttpServletResponse.SC_NOT_FOUND);
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User String revision = cfg.getRequestedRevision();
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews revision = null;
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews InputStream in = null;
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews if (revision != null) {
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews in = HistoryGuru.getInstance().getRevision(f.getParent(),
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews if (request.getDateHeader("If-Modified-Since") >= flast) {
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews in = new FileInputStream(f);
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews response.setDateHeader("Last-Modified", f.lastModified());
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User } catch (Exception e) {
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews response.sendError(HttpServletResponse.SC_NOT_FOUND);
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User String mimeType = getServletContext().getMimeType(f.getAbsolutePath());
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews response.setHeader("content-disposition", "attachment; filename="
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews OutputStream o = response.getOutputStream();
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User byte[] buffer = new byte[8192];
1cefb9df3fa34d08734f29005cfafa6be5cf3e93Mark Andrews while ((nr = in.read(buffer)) > 0) {
o.write(buffer, 0, nr);
o.flush();
o.close();
in.close();
/* ---------------------- raw.jsp end-------------------- */