mast.jsp revision 958ccc55e275549e16df57f5ba425dce5d1c2b7b
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensCDDL HEADER START
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensThe contents of this file are subject to the terms of the
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensCommon Development and Distribution License (the "License").
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensYou may not use this file except in compliance with the License.
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensSee LICENSE.txt included in this distribution for the specific
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrenslanguage governing permissions and limitations under the License.
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensWhen distributing Covered Code, include this CDDL HEADER in each
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensfile and include the License file at LICENSE.txt.
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensIf applicable, add the following below this CDDL HEADER, with the
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensfields enclosed by brackets "[]" replaced with your own identifying
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensinformation: Portions Copyright [yyyy] [name of copyright owner]
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensCDDL HEADER END
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensCopyright 2009 Sun Microsystems, Inc. All rights reserved.
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensUse is subject to license terms.
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens--%><%@ page import = "javax.servlet.*,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens org.opensolaris.opengrok.web.EftarFileReader,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens %><%@ page session="false" %><%@ page errorPage="error.jsp"%><%
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensString context = request.getContextPath();
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensString servlet = request.getServletPath();
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensString reqURI = request.getRequestURI();
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensif (path == null) path = "";
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensRuntimeEnvironment environment = RuntimeEnvironment.getInstance();
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensString rawSource = environment.getSourceRootPath();
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensString resourcePath = rawSource + path;
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensFile resourceFile = new File(resourcePath);
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensresourcePath = resourceFile.getAbsolutePath();
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensboolean valid = true;
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensboolean noHistory = true;
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensboolean noAnnotation = true;
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensboolean annotate = false;
148434217c040ea38dc844384f6ba68d9b325906Matthew AhrensString 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" + path + "/");
response.sendRedirect(context + servlet + "/on" + path);
response.sendError(404);
if (File.separatorChar == '\\') {
path = path.replace('\\','/');
isDir = resourceFile.isDirectory();
if (isDir && !servlet.startsWith("/xref") && !servlet.startsWith("/hist")) { //if it is an existing directory perhaps people wanted directory xref
if(!reqURI.endsWith("/")) {
response.sendRedirect(context + "/xref" + path + "/");
response.sendRedirect(context + "/xref" + path);
} if (isDir && !reqURI.endsWith("/")) {
response.sendRedirect(context + servlet + path +"/");
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);
if(servlet.startsWith("/xr")) {
ef.close();
%><%@ include file="httpheader.jspf" %><%//below style is for the fancy always on top search bar%>
<script type="text/javascript">/* <![CDATA[ */
if (!window.location.hash) {$('#content').focus();}
<script type="text/javascript">/* <![CDATA[ */
if (this.className == 'blame') {
this.className = 'blame-hidden';
} else if (this.className == 'blame-hidden') {
this.className = 'blame';
<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%>/xref/">xref</a>: <%=org.opensolaris.opengrok.web.Util.breadcrumbPath(context + "/xref", path)%></tt></div>
if (noHistory || servlet.startsWith("/hi")) {
String rev = request.getParameter("r");
} else if (rev.length() > 0) {
<a href="#" onclick="javascript:toggle_annotations(); return false;" title="Show or hide line annotation(commit revisions,authors)." >Annotate</a>
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';
if ( servlet.startsWith("/xr") ) {
%> | <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><%
String rev = request.getParameter("r");
if (rev == null || rev.equals("")) {
Project proj = Project.getProject(resourceFile);
if (proj != null || !environment.hasProjects()) {
%><input type="hidden" name="project" value="<%=proj.getDescription()%>"/><%
if(path.length() > 0) {