mast.jsp revision 53
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncCDDL HEADER START
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncThe contents of this file are subject to the terms of the
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncCommon Development and Distribution License (the "License").
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncYou may not use this file except in compliance with the License.
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncSee LICENSE.txt included in this distribution for the specific
c55c68b6a3324172e9dc207926215845880b0f90vboxsynclanguage governing permissions and limitations under the License.
c55c68b6a3324172e9dc207926215845880b0f90vboxsyncWhen distributing Covered Code, include this CDDL HEADER in each
c55c68b6a3324172e9dc207926215845880b0f90vboxsyncfile and include the License file at LICENSE.txt.
c55c68b6a3324172e9dc207926215845880b0f90vboxsyncIf applicable, add the following below this CDDL HEADER, with the
c55c68b6a3324172e9dc207926215845880b0f90vboxsyncfields enclosed by brackets "[]" replaced with your own identifying
c55c68b6a3324172e9dc207926215845880b0f90vboxsyncinformation: Portions Copyright [yyyy] [name of copyright owner]
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncCDDL HEADER END
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncCopyright 2005 Sun Microsystems, Inc. All rights reserved.
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncUse is subject to license terms.
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncident "%Z%%M% %I% %E% SMI"
59190ecd61435d19ba3515b876272aee7bd12298vboxsync--%><%@ page import = "javax.servlet.*,
59190ecd61435d19ba3515b876272aee7bd12298vboxsync%><%@ page session="false" %><%@ page errorPage="error.jsp"%><%
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString context = request.getContextPath();
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString servlet = request.getServletPath();
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString reqURI = request.getRequestURI();
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString path = request.getPathInfo();
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncif (path == null) path = "";
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString rawSource = getServletContext().getInitParameter("SRC_ROOT");
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString resourcePath = rawSource + path;
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncFile resourceFile = new File(resourcePath);
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncboolean valid = true;
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncboolean noHistory = true;
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString basename = resourceFile.getName();
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncboolean isDir = false;
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncEftarFileReader ef = null;
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString parent = null;
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncString parentBasename = resourceFile.getParentFile().getName();
59190ecd61435d19ba3515b876272aee7bd12298vboxsync|| IgnoredNames.ignore(parentBasename)
59190ecd61435d19ba3515b876272aee7bd12298vboxsync|| !resourcePath.startsWith(rawSource)) {
59190ecd61435d19ba3515b876272aee7bd12298vboxsync valid = false;
59190ecd61435d19ba3515b876272aee7bd12298vboxsync} else if (!resourceFile.canRead() && resourcePath.startsWith(rawSource)) {
59190ecd61435d19ba3515b876272aee7bd12298vboxsync String newPath = rawSource + "/on/" + path;
59190ecd61435d19ba3515b876272aee7bd12298vboxsync File newFile = new File(newPath);
59190ecd61435d19ba3515b876272aee7bd12298vboxsync if(newFile.isDirectory() && servlet.startsWith("/xref") && !path.endsWith("/")) {
59190ecd61435d19ba3515b876272aee7bd12298vboxsync response.sendRedirect(context + servlet + "/on" + path + "/");
59190ecd61435d19ba3515b876272aee7bd12298vboxsync response.sendRedirect(context + servlet + "/on" + path);
59190ecd61435d19ba3515b876272aee7bd12298vboxsync valid = false;
59190ecd61435d19ba3515b876272aee7bd12298vboxsync valid = true;
59190ecd61435d19ba3515b876272aee7bd12298vboxsync if ("".equals(path)) {
59190ecd61435d19ba3515b876272aee7bd12298vboxsync path = "/";
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 = !(isDir || HistoryGuru.getInstance().hasHistory(rawSource + "/" + parent));
ef = new EftarFileReader(getServletContext().getInitParameter("DATA_ROOT") + "/index/dtags.eftar");
dtag = ef.get(path);
if(servlet.startsWith("/xr")) {
ef.close();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link rel="alternate stylesheet" type="text/css" media="all" title="Paper White" href="<%=context%>/print.css"/>
<div id="Masthead"><tt><a href="<%=context%>/xref/">xref</a>: <%=org.opensolaris.opengrok.web.Util.breadcrumbPath(context + "/xref", path)%></tt></div>
if ((!isDir && noHistory) || servlet.startsWith("/hi")) {
if(path.length() > 0) {