list.jsp revision 1142
941cb476bf470040d0a33c397eb85c68d9d82d4djerenkrantzCDDL HEADER START
2a6c49cfaef5979a5a06098f3ce987cd76769409manojThe contents of this file are subject to the terms of the
2a6c49cfaef5979a5a06098f3ce987cd76769409manojCommon Development and Distribution License (the "License").
9a93784d34c322d1996e8a7b794a75230eac81a4wroweYou may not use this file except in compliance with the License.
4bc630d510cef730e37b9207e145267f473b4471strikerSee LICENSE.txt included in this distribution for the specific
a096f8d13bee05fd6ea8b9b50b6c2e818eace7d1strikerlanguage governing permissions and limitations under the License.
dba571e5c5a2586c7e2b382789f3250136ff7577jwoolleyWhen distributing Covered Code, include this CDDL HEADER in each
bf3d1782a29630335a1df535eb395355ab1cd154jwoolleyfile and include the License file at LICENSE.txt.
07847078a10fe4e9229cc08adda5f421cafc0665jwoolleyIf applicable, add the following below this CDDL HEADER, with the
0bd0176ce9f4321eeb506aa372d0bcc84befbf4cstrikerfields enclosed by brackets "[]" replaced with your own identifying
d8028365066fca602bf35d014530a1802114378crbbinformation: Portions Copyright [yyyy] [name of copyright owner]
c25203fdca093d4504c51b4cd974ff60d5aa4fb1wroweCDDL HEADER END
d89c116f82699294ca744125723651c554bc5925wroweCopyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
4214e98fc9045e5010e66f9a967bd6d68f40d342aaron--%><%@ page import = "javax.servlet.*,
a548c09e6a8ca1b059d0e93b5256c6ccb2b3c3cdrbb%><%@include file="mast.jsp"%>
b876b7bcf0ce3d232da723246d709e8dbbfe8762rbb<% if (!isDir) { %>
cf6bf6c34c936e6a6fe731dbce4a5c3c8bf8e9a3gstein<style type="text/css">
35330e0d79ceb8027223bbb8330a381b1f989d6etrawick .sym_list_style {
6f6f4a4bca281779d196acbdd5c017bb90858305trawick position:absolute;
8dd4618c4709236b4ea297d7250d282e463ce2d8rbb top:100px;
09bd86d0db1114ee23eda0a6eb76ca055877a1cftrawick left:100px;
2deb319e6b3de239f45c16a3e9e836d44f1f7108rbb width:100px;
bd929c73ef04789b7183b840d8db6e01d03a4d86rbb height:100px;
70f6f32765cfaadd6da8de6f0fea97ddd72d8fadmanoj overflow:auto;
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj z-index: 10;
af4c982a7cf4515f124935f99a329744035fc699slive border:solid 1px #c0c0c0;
af4c982a7cf4515f124935f99a329744035fc699slive background-color:#ffffcc;
af4c982a7cf4515f124935f99a329744035fc699slive color:#000;
af4c982a7cf4515f124935f99a329744035fc699slive font-size:12px;
af4c982a7cf4515f124935f99a329744035fc699slive font-family:monospace;
af4c982a7cf4515f124935f99a329744035fc699slive padding:5px;
af4c982a7cf4515f124935f99a329744035fc699slive opacity:0.9;
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe filter:alpha(opacity=90)
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe .sym_list_style_hide {
10270f6f94b2069d0d357805c140a9897449b9ccianh display: none;
45b0e1c775c1cfed6473c9e5304179ccb9609f53stoddard<script type="text/javascript">/* <![CDATA[ */
dbec4658981e4f9127e8676457c28d42932be7cdtrawickfunction lntoggle() {
1b7e9aeb9867a1c94e24e8ae491d2dfcd0d225e3jerenkrantz $("a").each(function() {
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz if (this.className == 'l' || this.className == 'hl') {
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe else if (this.className == 'l-hide' || this.className == 'hl-hide') {
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe this.className=this.className.substr(0,this.className.indexOf('-'));
4520f2a938626a879b33dac9fd940072b6c2bd42wrowefunction get_sym_list_contents()
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe var contents = "";
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe //contents += "<input id=\"input_highlight\" name=\"input_highlight\" class=\"q\"/>";
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe //contents += " ";
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe //contents += "<b><a href=\"#\" onclick=\"javascript:add_highlight();return false;\" title=\"Add highlight\">Highlight</a></b><br>";
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe contents += "<a href=\"#\" onclick=\"javascript:lsttoggle();\">[Close]</a><br>"
4520f2a938626a879b33dac9fd940072b6c2bd42wrowe var class_names=[
f95a0b59eb24c631f15bd83e20c6cf823c432d83trawick var type_names=[
f95a0b59eb24c631f15bd83e20c6cf823c432d83trawick "Variable",
f95a0b59eb24c631f15bd83e20c6cf823c432d83trawick "Interface",
cc22a72861c58dda7f3768613aec864e4c4e0353striker "Namespace",
ddafc111b94558ef4e2d7357ceda623315566ce3slive "Function",
ae72c92fd41562d7c0e8627c093fcbbae4ac9ef2coar "Subroutine"];
ddafc111b94558ef4e2d7357ceda623315566ce3slive var class_contents=[
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz $("a").each(
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz for (var i = 0; i < class_names.length; i++)
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz if (this.className == class_names[i])
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz if (fname != "")
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz // Use line number as accurate anchor
13402b2193f52031b2acfbee2b0965e02f3f29b4wrowe var line = this.getAttribute("ln");
82455c2e3b6991846fbcbf0c9e41f57dbc681217brianp class_contents[i] += "<a href=\"#" +
82455c2e3b6991846fbcbf0c9e41f57dbc681217brianp line + "\" class=\"" + class_names[i] + "\">" +
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe var count = 0;
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe for (var i = 0; i < class_names.length; i++)
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe if (class_contents[i] != "")
6362fd5c48f6b2193f5d356a9747172101b24e91jerenkrantz if (count > 0)
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe contents += "<br>"
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe contents += "<b>" + type_names[i] + "</b><br>"
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe contents += class_contents[i];
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe return contents;
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe// Initial value
56b2562cb4041a21bc313fde3204beabdb758800jwoolleyfunction get_sym_div_left()
f881b8be216de36c6b964324c772450bca38a4e6trawick document.sym_div_left = $(window).width() - (document.sym_div_width + document.sym_div_left_margin);
f881b8be216de36c6b964324c772450bca38a4e6trawickfunction get_sym_div_height()
b05930e6008f69bd323abe0c10f81f40ffd27983brianp document.sym_div_height = $(window).height() - document.sym_div_top - document.sym_div_height_margin;
b05930e6008f69bd323abe0c10f81f40ffd27983brianp if (document.sym_div_height > document.sym_div_height_max)
b05930e6008f69bd323abe0c10f81f40ffd27983brianp document.sym_div_height = document.sym_div_height_max;
4c7dab038d90d7feb67ef8ddbfacc77be8c9dbf0jwoolleyfunction get_sym_div_top()
f9b8e29cfca92cf0a996e8ab17fa1a1f447cecc7stoddardfunction get_sym_div_width()
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowefunction lsttoggle()
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe document.sym_div.className = "sym_list_style";
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe document.sym_div.style.width = get_sym_div_width() + "px";
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe document.sym_div.style.height = get_sym_div_height() + "px";
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe document.sym_div.style.top = get_sym_div_top() + "px";
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe document.sym_div.style.left = get_sym_div_left() + "px";
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe document.sym_div.innerHTML = get_sym_list_contents();
638a9edaf48cf003cd40ac25ee8c25f572107414stoddard document.sym_div.className = "sym_list_style_hide";
db2d668e6233d8949b35ee7f9f42f444758f9ce9rbb document.sym_div.style.height = get_sym_div_height() + "px";
db2d668e6233d8949b35ee7f9f42f444758f9ce9rbb document.sym_div.style.width = get_sym_div_width() + "px";
db2d668e6233d8949b35ee7f9f42f444758f9ce9rbb document.sym_div.style.top = get_sym_div_top() + "px";
db2d668e6233d8949b35ee7f9f42f444758f9ce9rbb document.sym_div.style.left = get_sym_div_left() + "px";
1ea5221b240a8b41a07c6fb04aab5a73adcddabfaaron document.sym_div.className = "sym_list_style";
1ea5221b240a8b41a07c6fb04aab5a73adcddabfaaron$(window).resize(
5d12baef135b5d3cb94745e007a1575398469724jerenkrantz document.sym_div.style.left = get_sym_div_left() + "px";
5d12baef135b5d3cb94745e007a1575398469724jerenkrantz document.sym_div.style.height = get_sym_div_height() + "px";
b865daaa4ef731a7066ee6d97e2aae36c7743939jerenkrantz// Highlighting
f881b8be216de36c6b964324c772450bca38a4e6trawick// This will replace link's href contents as well, be careful
f881b8be216de36c6b964324c772450bca38a4e6trawickfunction HighlightKeywordsFullText(keywords)
dc098c7ce5d36179c504d09fc722d190683d0262aaron var el = $("body");
dc098c7ce5d36179c504d09fc722d190683d0262aaron $(keywords).each(
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe var pattern = new RegExp("("+this+")", ["gi"]);
dc098c7ce5d36179c504d09fc722d190683d0262aaron var rs = "<span style='background-color:#FFFF00;font-weight: bold;'>$1</span>";
0bcb1fe39dfaacf9745b6633f5cc9ebc8e2596caaaron//HighlightKeywordsFullText(["nfstcpsock"]);
33f5961d34a8b5390cebad0543b3ebe67830e5d7jerenkrantz// This only changes matching tag's style
33f5961d34a8b5390cebad0543b3ebe67830e5d7jerenkrantzfunction HighlightKeyword(keyword)
33f5961d34a8b5390cebad0543b3ebe67830e5d7jerenkrantz var high_colors=[
54e1babd5a5a56c576eeeace54110150769cc916coar "#cc66ff"];
54e1babd5a5a56c576eeeace54110150769cc916coar var pattern = "a:contains('" + keyword + "')";
54e1babd5a5a56c576eeeace54110150769cc916coar $(pattern).css({
54e1babd5a5a56c576eeeace54110150769cc916coar 'text-decoration' : 'underline',
54e1babd5a5a56c576eeeace54110150769cc916coar 'background-color' : high_colors[document.highlight_count % high_colors.length],
54e1babd5a5a56c576eeeace54110150769cc916coar 'font-weight' : 'bold'
54e1babd5a5a56c576eeeace54110150769cc916coar//HighlightKeyword('timeval');
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowefunction add_highlight()
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe var tbox = document.getElementById('input_highlight');
949aa7bba7f804faa8e6b08cad42a98fc0255d85jerenkrantz HighlightKeyword(tbox.value);
e0427bf8e52a8fb920cb8b6adb5cdb3b6535b7fecoarString rev = null;
07021d9f405849228b859d9fb4b877f20e4fbba3jerenkrantzif(!isDir && ef != null) {
f126ee03179eb54308118f1ec3de5a7b461685d8aaron } catch (IOException e) {
f126ee03179eb54308118f1ec3de5a7b461685d8aaronif (valid) {
f126ee03179eb54308118f1ec3de5a7b461685d8aaron if (isDir) {
f126ee03179eb54308118f1ec3de5a7b461685d8aaron // verify that the current path is part of the selected project
f126ee03179eb54308118f1ec3de5a7b461685d8aaron Project activeProject = Project.getProject(resourceFile);
f126ee03179eb54308118f1ec3de5a7b461685d8aaron//TODO: somehow integrate below with projects.jspf
f126ee03179eb54308118f1ec3de5a7b461685d8aaron if (activeProject != null) {
f126ee03179eb54308118f1ec3de5a7b461685d8aaron final List<String> project = new ArrayList<String>();
109faf633e12ab0bbdd602c7addc795cce59e8addreid Cookie[] cookies = request.getCookies();
109faf633e12ab0bbdd602c7addc795cce59e8addreid if (cookies != null) {
109faf633e12ab0bbdd602c7addc795cce59e8addreid for (Cookie cookie : cookies) {
109faf633e12ab0bbdd602c7addc795cce59e8addreid if (cookie.getName().equals("OpenGrokProject")) {
109faf633e12ab0bbdd602c7addc795cce59e8addreid for (String proj : cookie.getValue().split(",")) {
109faf633e12ab0bbdd602c7addc795cce59e8addreid if (proj != "") {
109faf633e12ab0bbdd602c7addc795cce59e8addreid if (Project.getByDescription(proj) != null) {
4ca13a5e126946272f02637e268a8e09193c553ecoar boolean found = false;
4ca13a5e126946272f02637e268a8e09193c553ecoar for (String proj : project) {
4ca13a5e126946272f02637e268a8e09193c553ecoar if (activeProject.getDescription().equalsIgnoreCase(proj)) {
b3b4e853e4958357ee2d50e2fe41effecfde9eedwrowe found = true;
48c0c81cd6fabac9d3386406d97633780365b839coar// set this in case there is no project selected or current cookie doesn't contain current project from the link, so the rest of search works 100% :)
48c0c81cd6fabac9d3386406d97633780365b839coar if (!found) {
48c0c81cd6fabac9d3386406d97633780365b839coar StringBuffer sproject=new StringBuffer(activeProject.getDescription()+",");
e0427bf8e52a8fb920cb8b6adb5cdb3b6535b7fecoar if (project!=null) {
4ca13a5e126946272f02637e268a8e09193c553ecoar //only save found projects into cookies
b84f66c93f820824b1d5455181f55598b766319cwrowe for (Iterator it = project.iterator(); it.hasNext();) {
7fe18c15b669db9d191859695901dc4fcf3829dawrowe // update the cookie
7fe18c15b669db9d191859695901dc4fcf3829dawrowe Cookie cookie = new Cookie("OpenGrokProject", sproject.toString());
7fe18c15b669db9d191859695901dc4fcf3829dawrowe cookie.setPath(context + "/");
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe // If requesting a Directory listing -------------
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe DirectoryListing dl = new DirectoryListing(ef);
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe String[] files = resourceFile.list();
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe if (files != null) {
f610c7c704235bc327dbe9b62982f5b3f8e30a77wrowe List<String> readMes = dl.listTo(resourceFile, out, path, files);
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe if(readMes != null && readMes.size() > 0) {
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe File xdir = new File(environment.getDataRootPath() + Constants.xrefP + path);
19cbe4d7b7c931723e7249de6829bf965a1fee72stoddard char[] buf = new char[8192];
19cbe4d7b7c931723e7249de6829bf965a1fee72stoddard for (String readme : readMes) {
b187d568e1507d75139ebc13ca945b38fc05d55cstoddard File readmeFile = new File(xdir, readme + ".gz");
b187d568e1507d75139ebc13ca945b38fc05d55cstoddard Reader br = null;
1c6fb1e726ce22694de0e9a957adb67b929e5d4fstoddard if (environment.isCompressXref() && readmeFile.exists()) {
1c6fb1e726ce22694de0e9a957adb67b929e5d4fstoddard br = new InputStreamReader(new GZIPInputStream(new FileInputStream(readmeFile)));
d2f8b010487ffa990a9c268df5a25579e7291bcdrbb readmeFile = new File(xdir, readme);
a5ed555df952c85bc1b179f5981e8a6c54ba16e6stoddard br = new FileReader(readmeFile);
1e585ba09ea32272e63c4c39c35491e975d21d98stoddard if (br != null) {
0bff2f28ef945280c17099c142126178a78e1e54manoj int len = 0;
35330e0d79ceb8027223bbb8330a381b1f989d6etrawick %><h3><%=readme%></h3><div id="src"><pre><%
0bff2f28ef945280c17099c142126178a78e1e54manoj while((len = br.read(buf)) > 0) {
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard out.write(buf, 0, len);
ff849e4163ed879288f0df15f78b6c9d278ec804fanf %></pre></div><%
e0427bf8e52a8fb920cb8b6adb5cdb3b6535b7fecoar } catch(IOException e) {
e0427bf8e52a8fb920cb8b6adb5cdb3b6535b7fecoar OpenGrokLogger.getLogger().log(Level.WARNING, "An error occured while reading/writing readme:", e);
e0427bf8e52a8fb920cb8b6adb5cdb3b6535b7fecoar } finally {
e0427bf8e52a8fb920cb8b6adb5cdb3b6535b7fecoar if (br != null) {
6758b07b4b79f898b0f56375016cea7da0bfb495wrowe } catch (IOException e) {
7fe18c15b669db9d191859695901dc4fcf3829dawrowe OpenGrokLogger.getLogger().log(Level.WARNING, "An error occured while closing file:", e);
79d5106a9b65b956d646f5daae4b94bc79e315b8trawick } else if ((rev = request.getParameter("r")) != null && !rev.equals("")) {
79d5106a9b65b956d646f5daae4b94bc79e315b8trawick // Else if requesting a previous revision -------------
79d5106a9b65b956d646f5daae4b94bc79e315b8trawick if (noHistory) {
cf6bf6c34c936e6a6fe731dbce4a5c3c8bf8e9a3gstein response.sendError(404, "Revision not found");
cf6bf6c34c936e6a6fe731dbce4a5c3c8bf8e9a3gstein FileAnalyzerFactory a = AnalyzerGuru.find(basename);
93c5cba06b623ebe8e4372e886eece12d9a80c3egstein if (g == Genre.PLAIN|| g == Genre.HTML || g == null) {
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgstein InputStream in = null;
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgstein in = HistoryGuru.getInstance().getRevision(resourceFile.getParent(), basename, rev);
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgstein } catch (Exception e) {
14cccaddba3a9263cf0d0ddc311e18f3e3dc9b0fgstein response.sendError(404, "Revision not found");
823c303d33c9e637a83d82208bcbafaf5f532d7bgstein if (in != null) {
e636eba7474e0010b5c7198af1c2fe5ad8652dbbmanoj if (g == null) {
2f728b2e8555fee1b7cc11e886488692f2575fbddougm if (g == Genre.DATA || g == Genre.XREFABLE || g == null) {
2f728b2e8555fee1b7cc11e886488692f2575fbddougm %><div id="src">Binary file [Click <a href="<%=context%>/raw<%=path%>?r=<%=rev%>">here</a> to download] </div><%
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe %><div id="src"><span class="pagetitle"><%=basename%> revision <%=rev%> </span><pre><%
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe // We don't have any way to get definitions
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe // for old revisions currently.
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe Definitions defs = null;
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe Annotation annotation = annotate ? HistoryGuru.getInstance().annotate(resourceFile, rev) : null;
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe //annotation.writeTooltipMap(out); //not needed yet
60d567a0c2aae815ee6fc20c0d65032bea52c92cwrowe Reader r = new InputStreamReader(in);
27757f6699a924d4b493a1b6cceb27df27a43287dreid AnalyzerGuru.writeXref(a, r, out, defs, annotation, Project.getProject(resourceFile));
b3b4e853e4958357ee2d50e2fe41effecfde9eedwrowe } else if (g == Genre.IMAGE) {
27757f6699a924d4b493a1b6cceb27df27a43287dreid %><img src="<%=context+Constants.rawP+path%>?r=<%=rev%>"/><%
21e01f13f717faeca3e498d7d9c9b4d3af98ae27trawick } else if (g == Genre.HTML) {
21e01f13f717faeca3e498d7d9c9b4d3af98ae27trawick char[] buf = new char[8192];
21e01f13f717faeca3e498d7d9c9b4d3af98ae27trawick Reader br = new InputStreamReader(in);
21e01f13f717faeca3e498d7d9c9b4d3af98ae27trawick int len = 0;
21e01f13f717faeca3e498d7d9c9b4d3af98ae27trawick while((len = br.read(buf)) > 0) {
21e01f13f717faeca3e498d7d9c9b4d3af98ae27trawick out.write(buf, 0, len);
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %> Click <a href="<%=context+Constants.rawP+path%>?r=<%=rev%>">download <%=basename%></a><%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe } catch (IOException e) {
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %> <h3 class="error">IO Error</h3> <p> <%=e.getMessage() %> </p> <%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %></pre></div><%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %> <h3 class="error">Error reading file</h3> <%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe } else if(g == Genre.IMAGE) {
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %><div id="src"><img src="<%=context+Constants.rawP+path%>?r=<%=rev%>"/></div><%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %><div id="src"> Binary file [Click <a href="<%=context+Constants.rawP+path%>?r=<%=rev%>">here</a> to download] </div><%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe // requesting cross referenced file -------------
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe File xrefSource = new File(environment.getDataRootFile(), Constants.xrefP);
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe File xrefFile = new File(xrefSource, path + ".gz");
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe Reader fileReader = null;
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe fileReader = new InputStreamReader(new GZIPInputStream(new FileInputStream(xrefFile)));
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe xrefFile = new File(xrefSource, path);
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe fileReader = new FileReader(xrefFile);
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe if (fileReader != null && !annotate) {
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe char[] buf = new char[8192];
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe BufferedReader br = new BufferedReader(fileReader);
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe int len = 0;
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %><div id="src"><pre><%
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe while((len = br.read(buf)) > 0) {
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe out.write(buf, 0, len);
28c4fe67d75f8f26504d75b7aa8dc5d868032888wrowe %></pre></div><%
f881b8be216de36c6b964324c772450bca38a4e6trawick BufferedInputStream bin = new BufferedInputStream(new FileInputStream(resourceFile));
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard FileAnalyzerFactory a = AnalyzerGuru.find(basename);
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard if(g == null) {
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard %><div id="src"><img src="<%=context+Constants.rawP+path%>"/></div><%
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard } else if( g == Genre.HTML) {
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard char[] buf = new char[8192];
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard Reader br = new InputStreamReader(bin);
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard int len = 0;
c408915e2a85fedc520e97e96abda8f61aafc804stoddard while((len = br.read(buf)) > 0) {
c408915e2a85fedc520e97e96abda8f61aafc804stoddard out.write(buf, 0, len);
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard } else if(g == Genre.PLAIN) {
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard %><div id="src"><pre><%
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard // We're generating xref for the latest revision, so we can
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard // find the definitions in the index.
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard Definitions defs = IndexDatabase.getDefinitions(resourceFile);
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard Annotation annotation = annotate ? HistoryGuru.getInstance().annotate(resourceFile, rev) : null;
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard Reader r = new InputStreamReader(bin);
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard AnalyzerGuru.writeXref(a, r, out, defs, annotation, Project.getProject(resourceFile));
ddd44b06b04507cae083c52451e28f54f0bdb5afstoddard %></pre></div><%
a32ddb6cabb635ca29ccff87f8bf5c6af3b78ecfstoddard %> Click <a href="<%=context+Constants.rawP+path%>">download <%=basename%></a><%
a32ddb6cabb635ca29ccff87f8bf5c6af3b78ecfstoddard %><%@include file="foot.jspf"%><%
951342b69609b2b45303f89f91275676d5325217bnicholesif (ef != null) {
951342b69609b2b45303f89f91275676d5325217bnicholes } catch (IOException e) {