list.jsp revision 1186
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynCDDL HEADER START
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynThe contents of this file are subject to the terms of the
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynCommon Development and Distribution License (the "License").
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynYou may not use this file except in compliance with the License.
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynSee LICENSE.txt included in this distribution for the specific
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallynlanguage governing permissions and limitations under the License.
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynWhen distributing Covered Code, include this CDDL HEADER in each
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallynfile and include the License file at LICENSE.txt.
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynIf applicable, add the following below this CDDL HEADER, with the
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallynfields enclosed by brackets "[]" replaced with your own identifying
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyninformation: Portions Copyright [yyyy] [name of copyright owner]
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynCDDL HEADER END
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynCopyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
198b363fff1de9afcee2f26b9aa847316f589afeSerge HallynPortions Copyright 2011 Jens Elkner.
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn--%><%@page import="
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallynorg.opensolaris.opengrok.analysis.FileAnalyzer.Genre,
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallynorg.opensolaris.opengrok.analysis.FileAnalyzerFactory,
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // need to set it here since requesting parameters
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn cfg = PageConfig.get(request);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn Annotation annotation = cfg.getAnnotation();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (annotation != null) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn + ".blame .r { width: " + (r == 0 ? 6 : r) + "ex; } "
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn + ".blame .a { width: " + (a == 0 ? 6 : a) + "ex; } "
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn + "</style>");
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn%><script type="text/javascript">/* <![CDATA[ */
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyndocument.pageReady.push(function() { pageReadyList();});
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn/* ]]> */</script>
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn/* ---------------------- list.jsp start --------------------- */
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn cfg = PageConfig.get(request);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn File resourceFile = cfg.getResourceFile();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn String path = cfg.getPath();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn String basename = resourceFile.getName();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn String rawPath = request.getContextPath() + Prefix.RAW_P + path;
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn Reader r = null;
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // valid resource is requested
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // mast.jsp assures, that resourceFile is valid and not /
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn Project activeProject = Project.getProject(resourceFile);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn String cookieValue = cfg.getRequestedProjectsAsString();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (activeProject != null) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn Set<String> projects = cfg.getRequestedProjects();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (!projects.contains(activeProject.getDescription())) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // update cookie
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn cookieValue = cookieValue.length() == 0
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn : activeProject.getDescription() + '/' + cookieValue;
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn Cookie cookie = new Cookie("OpenGrokProject", cookieValue);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // TODO hmmm, projects.jspf doesn't set a path
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn cookie.setPath(request.getContextPath() + '/');
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // requesting a directory listing
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn DirectoryListing dl = new DirectoryListing(cfg.getEftarReader());
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn String[] files = cfg.getResourceFileList();
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn List<String> readMes = dl.listTo(resourceFile, out, path, files);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn File[] catfiles = cfg.findDataFiles(readMes);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn for (int i=0; i < catfiles.length; i++) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (catfiles[i] == null) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn%><h3><%= readMes.get(i) %></h3>
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn<div id="src">
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn Util.dump(out, catfiles[i], catfiles[i].getName().endsWith(".gz"));
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn } else if (rev.length() != 0) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // requesting a previous revision
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn FileAnalyzerFactory a = AnalyzerGuru.find(basename);
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn String error = null;
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (g == Genre.PLAIN|| g == Genre.HTML || g == null) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn InputStream in = null;
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn .getRevision(resourceFile.getParent(), basename, rev.substring(2));
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn } catch (Exception e) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn // fall through to error message
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (in != null) {
198b363fff1de9afcee2f26b9aa847316f589afeSerge Hallyn if (g == null) {
rev.substring(2) %></span>
if (g == Genre.PLAIN) {
Annotation annotation = cfg.getAnnotation();
//annotation.writeTooltipMap(out);
AnalyzerGuru.writeXref(a, r, out, defs,
annotation, Project.getProject(resourceFile));
} else if (g == Genre.IMAGE) {
} else if (g == Genre.HTML) {
Util.dump(out, r);
error = e.getMessage();
try { r.close(); in = null;}
try { in.close(); }
} else if (g == Genre.IMAGE) {
if (!cfg.annotate()) {
xrefFile = cfg.findDataFile();
FileAnalyzerFactory a = AnalyzerGuru.find(basename);
Genre g = AnalyzerGuru.getGenre(a);
a = AnalyzerGuru.find(bin);
g = AnalyzerGuru.getGenre(a);
if (g == Genre.IMAGE) {
} else if ( g == Genre.HTML) {
Util.dump(out, r);
} else if (g == Genre.PLAIN) {
Definitions defs = IndexDatabase.getDefinitions(resourceFile);
Annotation annotation = cfg.getAnnotation();
AnalyzerGuru.writeXref(a, r, out, defs, annotation,
Project.getProject(resourceFile));
try { r.close(); bin = null; }
try { bin.close(); }
/* ---------------------- list.jsp end --------------------- */
include file="foot.jspf"