list.jsp revision 27
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandCDDL HEADER START
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandThe contents of this file are subject to the terms of the
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandCommon Development and Distribution License (the "License").
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandYou may not use this file except in compliance with the License.
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandSee LICENSE.txt included in this distribution for the specific
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normandlanguage governing permissions and limitations under the License.
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandWhen distributing Covered Code, include this CDDL HEADER in each
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normandfile and include the License file at LICENSE.txt.
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandIf applicable, add the following below this CDDL HEADER, with the
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normandfields enclosed by brackets "[]" replaced with your own identifying
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normandinformation: Portions Copyright [yyyy] [name of copyright owner]
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandCDDL HEADER END
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandCopyright 2005 Sun Microsystems, Inc. All rights reserved.
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel NormandUse is subject to license terms.
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normandident "%Z%%M% %I% %E% SMI"
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand--%><%@ page import = "javax.servlet.*,
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engenorg.opensolaris.opengrok.analysis.FileAnalyzer.Genre,
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen%><%@include file="mast.jsp"%><%
b515981702133b9aaea1aff378493f054c14d46cDwight EngenString rev = null;
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engenif(!isDir && ef != null) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen } catch (IOException e) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen if (isDir) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen// If requesting a Directory listing -------------
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen DirectoryListing dl = new DirectoryListing(IgnoredNames.ignore, ef);
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen String[] files = resourceFile.list();
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand if (files != null) {
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand Arrays.sort(files, String.CASE_INSENSITIVE_ORDER);
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen ArrayList readMes = dl.listTo(resourceFile, out, path, files);
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand if(readMes != null && readMes.size() > 0) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen File xdir = new File(getServletContext().getInitParameter("DATA_ROOT") + "/xref" + path);
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand char[] buf = new char[8192];
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand for(int i = 0; i< readMes.size(); i++) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen BufferedReader br = new BufferedReader(new FileReader(new File(xdir, (String)readMes.get(i))));
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen int len = 0;
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand %><h3><%=(String)readMes.get(i)%></h3><div id="src"><pre><%
96fa1ff0d1aa3e1f3ab96297bfbf3a3613b5fe3bMichel Normand while((len = br.read(buf)) > 0) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen %></pre></div><%
724e753cb0055b84f896522e8c5ec45ad996c195Michel Normand } catch(IOException e) {
b98f7d6ed1b89b6452af4a2b5e27d445e4b3a138Serge Hallyn } else if ((rev = request.getParameter("r")) != null && !rev.equals("")) {
b98f7d6ed1b89b6452af4a2b5e27d445e4b3a138Serge Hallyn// Else if requesting a previous revision -------------
b98f7d6ed1b89b6452af4a2b5e27d445e4b3a138Serge Hallyn if(noHistory) {
b98f7d6ed1b89b6452af4a2b5e27d445e4b3a138Serge Hallyn response.sendError(404, "Revision not found");
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen } else if (rev.matches("^[0-9]+(\\.[0-9]+)*$")) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen Class a = AnalyzerGuru.find(basename);
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen if (g == Genre.PLAIN|| g == Genre.HTML || g == null) {
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen InputStream in = null;
724e753cb0055b84f896522e8c5ec45ad996c195Michel Normand in = HistoryGuru.getInstance().getRevision(resourceFile.getParent(), basename, rev);
724e753cb0055b84f896522e8c5ec45ad996c195Michel Normand } catch (Exception e) {
724e753cb0055b84f896522e8c5ec45ad996c195Michel Normand response.sendError(404, "Revision not found");
ef6e34eec8d5a9f1447462d6080facb674b3ccdbDwight Engen if(in != null) {
b494d2ddf769220da1ef75fd24275ce68cdf297cSerge Hallyn if (g == null) {
%> <div id="src">Binary file [Click <a href="<%=context%>/raw<%=path%>?r=<%=rev%>">here</a> to download] </div><%
if (g == Genre.PLAIN) {
System.setProperty("urlPrefix", context+"/s?");
AnalyzerGuru.writeXref(a, in, out);
} else if (g == Genre.IMAGE) {
} else if (g == Genre.HTML) {
while((len = br.read(buf)) > 0) {
out.write(buf, 0, len);
%> <h3 class="error">IO Error</h3> <p> <%=e.getMessage() %> </p> <%
in.close();
} else if(g == Genre.IMAGE) {
%><div id="src"> Binary file [Click <a href="<%=context%>/raw<%=path%>?r=<%=rev%>">here</a> to download] </div><%
if(xrefFile.exists()) {
while((len = br.read(buf)) > 0) {
out.write(buf, 0, len);
br.close();
Class 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) {
while((len = br.read(buf)) > 0) {
out.write(buf, 0, len);
} else if(g == Genre.PLAIN) {
System.setProperty("urlPrefix", context+"/s?");
AnalyzerGuru.writeXref(a, bin, out);
%><%@include file="foot.html"%><%
ef.close();