mast.jsp revision 6fd168587048fe0e2cb37acdcc9ae9764c83b2d2
a4e76a630ea69c04f89c6c1bf0b7d15e655c97c2Evan HuntCDDL HEADER START
See LICENSE.txt included in this distribution for the specific
file and include the License file at LICENSE.txt.
--%><%@ page import = "javax.servlet.*,
java.io.*,
%><%@ page session="false" %><%@ page errorPage="error.jsp"%><%
String context = request.getContextPath();
String servlet = request.getServletPath();
String reqURI = request.getRequestURI();
String path = request.getPathInfo();
path = URLDecoder.decode(path, "ISO-8859-1");
RuntimeEnvironment environment = RuntimeEnvironment.getInstance();
environment.setUrlPrefix(context + "/s?");
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" + 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" %>
<div id="header"><%@ include file="pageheader.jspf" %>
<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) {
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';
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.getId()%>"/><%
if(path.length() > 0) {