mast.jsp revision 52cdd45a95eb7c48af1c19ea6e401448a97545bf
34c8deaae1fcfa9e7c9db49b5f3a33973e103218Lennart PoetteringCDDL HEADER START
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart PoetteringThe contents of this file are subject to the terms of the
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart PoetteringCommon Development and Distribution License (the "License").
34c8deaae1fcfa9e7c9db49b5f3a33973e103218Lennart PoetteringYou may not use this file except in compliance with the License.
b0734b235f47238148253ace6a887151e3721d29Lennart PoetteringSee LICENSE.txt included in this distribution for the specific
b0734b235f47238148253ace6a887151e3721d29Lennart Poetteringlanguage governing permissions and limitations under the License.
3b63d2d31d0850bd7a81ab9b468218d2c4c461e8Lennart PoetteringWhen distributing Covered Code, include this CDDL HEADER in each
3b63d2d31d0850bd7a81ab9b468218d2c4c461e8Lennart Poetteringfile and include the License file at LICENSE.txt.
3b63d2d31d0850bd7a81ab9b468218d2c4c461e8Lennart PoetteringIf applicable, add the following below this CDDL HEADER, with the
3b63d2d31d0850bd7a81ab9b468218d2c4c461e8Lennart Poetteringfields enclosed by brackets "[]" replaced with your own identifying
3b63d2d31d0850bd7a81ab9b468218d2c4c461e8Lennart Poetteringinformation: Portions Copyright [yyyy] [name of copyright owner]
3b63d2d31d0850bd7a81ab9b468218d2c4c461e8Lennart PoetteringCDDL HEADER END
Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
--%><%@ page import = "javax.servlet.*,
java.io.*,
%><%@ page session="false" %><%@ page errorPage="error.jsp"%><%
if (request.getCharacterEncoding() == null) {
request.setCharacterEncoding("UTF-8");
String context = request.getContextPath();
String servlet = request.getServletPath();
String reqURI = request.getRequestURI();
String path = request.getPathInfo();
RuntimeEnvironment environment = RuntimeEnvironment.getInstance();
String rawSource = environment.getSourceRootPath();
resourcePath = resourceFile.getAbsolutePath();
String basename = resourceFile.getName();
String parentBasename = resourceFile.getParentFile().getName();
IgnoredNames ignoredNames = environment.getIgnoredNames();
String uriEncodedName = Util.URIEncodePath(path);
|| ignoredNames.ignore(path)
|| ignoredNames.ignore(parentBasename)
|| !resourcePath.startsWith(rawSource)) {
response.sendError(404);
if(newFile.canRead()) {
response.sendRedirect(context + servlet + "/on" + uriEncodedName + "/");
response.sendRedirect(context + servlet + "/on" + uriEncodedName);
response.sendError(404);
if (File.separatorChar == '\\') {
path = path.replace('\\','/');
uriEncodedName = Util.URIEncodePath(path);
isDir = resourceFile.isDirectory();
if (isDir && !servlet.startsWith(Constants.xrefP) && !servlet.startsWith(Constants.histP)) { //if it is an existing directory perhaps people wanted directory xref
if(!reqURI.endsWith("/")) {
} if (isDir && !reqURI.endsWith("/")) {
response.sendRedirect(context + servlet + uriEncodedName +"/");
long flast = resourceFile.lastModified();
if (request.getDateHeader("If-Modified-Since") >= flast ) {
response.setDateHeader("Last-Modified", flast);
int lastSlash = path.lastIndexOf('/');
parent = (lastSlash != -1) ? path.substring(0, lastSlash) : "";
int pLastSlash = parent.lastIndexOf('/');
parentBasename = pLastSlash != -1 ? parent.substring(pLastSlash+1) : parent;
noHistory = !HistoryGuru.getInstance().hasHistory(resourceFile);
!HistoryGuru.getInstance().hasAnnotation(resourceFile);
dtag = ef.get(path);
ef.close();
String rev = request.getParameter("r");
} else if (rev.length() > 0) {
String h = request.getParameter("h");
%><%@ include file="httpheader.jspf" %><%//below style is for the fancy always on top search bar%>
<script type="text/javascript">/* <![CDATA[ */
link="<%=context+Constants.xrefP+uriEncodedName%>?a=true<%=rev%>";
window.location=link+hash;
if (!window.location.hash) {
if (h!=null && h!="null") { window.location.hash=h; }
<script type="text/javascript">/* <![CDATA[ */
if (this.className == 'blame') {
this.className = 'blame-hidden';
} else if (this.className == 'blame-hidden') {
this.className = 'blame';
<form action="<%=context+Constants.searchP%>">
<div id="header"><%@ include file="pageheader.jspf" %>
<div id="pagetitle"><b id="filename">Cross Reference: <%=basename%></b><% if (dtag!=null & dtag!="") { %><br/><%=dtag%><% } %></div>
<div id="Masthead"><tt><a href="<%=context+Constants.xrefP%>/">xref</a>: <%=org.opensolaris.opengrok.web.Util.breadcrumbPath(context + Constants.xrefP, path)%></tt></div>
%><a id="history" href="<%=context+Constants.histL+uriEncodedName%>">History</a><%
<a href="#" onclick="javascript:toggle_annotations(); return false;" title="Show or hide line annotation(commit revisions,authors)." >Annotate</a>
<a href="<%=context+Constants.xrefP+uriEncodedName%><%
if (rev.length() > 0) {
<script type="text/javascript">
var toggle_js = document.getElementById('toggle-annotate-by-javascript');
var toggle_ss = document.getElementById('toggle-annotate');
toggle_js.style.display = 'inline';
toggle_ss.style.display = 'none';
%> | <a href="#" onclick="javascript:lntoggle();return false;" title="Show or hide line numbers (might be slower if file has more than 10 000 lines).">Line #</a> | <a href="#" onclick="javascript:lsttoggle();return false;" title="Show or hide symbol list.">Navigate</a><%
String lrev = request.getParameter("r");
if (lrev == null || lrev.equals("")) {
%> | <a id="download" href="<%=context+Constants.rawP+uriEncodedName%>">Download</a><%
%> | <a id="download" href="<%=context+Constants.rawP+uriEncodedName%>?r=<%=lrev%>">Download</a><%
Project proj = Project.getProject(resourceFile);
//if (proj != null || !environment.hasProjects())
%><input type="hidden" name="project" value="<%=proj.getDescription()%>"/><%
if(path.length() > 0) {