Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opengrok-web-nbproject/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dist.javadoc.dir=${dist.dir}/javadoc
dist.war=${dist.dir}/${war.name}
endorsed.classpath=
excludes=
j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.2.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat7-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.1.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar
lucene.version=4.6.0
lucene-core.jar=lucene-core-${lucene.version}.jar
lucene-analyzers-common.jar=lucene-analyzers-common-${lucene.version}.jar
Expand Down
4 changes: 2 additions & 2 deletions src/org/opensolaris/opengrok/search/Results.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static void prettyPrint(Writer out, SearchHelper sh, int start,
String morePrefix = sh.contextPath + Prefix.MORE_P;
String xrefPrefixE = ctxE + Prefix.XREF_P;
String histPrefixE = ctxE + Prefix.HIST_L;
String rawPrefixE = ctxE + Prefix.RAW_P;
String downloadPrefixE = ctxE + Prefix.DOWNLOAD_P;
File xrefDataDir = new File(sh.dataRoot, Prefix.XREF_P.toString());

for (Map.Entry<String, ArrayList<Document>> entry :
Expand Down Expand Up @@ -172,7 +172,7 @@ public static void prettyPrint(Writer out, SearchHelper sh, int start,
out.write(xrefPrefixE);
out.write(rpathE);
out.write("?a=true\" title=\"Annotate\">A</a> <a href=\"");
out.write(rawPrefixE);
out.write(downloadPrefixE);
out.write(rpathE);
out.write("\" title=\"Download\">D</a>");
out.write("</td>");
Expand Down
5 changes: 3 additions & 2 deletions src/org/opensolaris/opengrok/web/PageConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@ public String canProcess() {
&& !getRequestedRevision().isEmpty() && !hasHistory()) {
return null;
}
} else if (getPrefix() == Prefix.RAW_P) {
return null;
} else if ((getPrefix() == Prefix.RAW_P) ||
(getPrefix() == Prefix.DOWNLOAD_P)) {
return null;
}
}
return redir == null ? "" : redir;
Expand Down
2 changes: 2 additions & 0 deletions src/org/opensolaris/opengrok/web/Prefix.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public enum Prefix {
/** RSS XML Feed of latest changes (link prefix) */
RSS_P("/rss"),
/** Download file (link prefix) */
DOWNLOAD_P("/download"),
/** Raw file display (link prefix) */
RAW_P("/raw"),
/** full blown search from main page or top bar (link prefix) */
SEARCH_P("/search"),
Expand Down
22 changes: 17 additions & 5 deletions web/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
<jsp-file>/list.jsp</jsp-file>
<init-param>
<param-name>keepgenerated</param-name><param-value>true</param-value>
</init-param>
</init-param>
</servlet>
<servlet>
<servlet-name>diff</servlet-name>
<display-name>Source diffs between revisions</display-name>
<jsp-file>/diff.jsp</jsp-file>
<init-param>
<param-name>keepgenerated</param-name><param-value>true</param-value>
</init-param>
</init-param>
</servlet>
<servlet>
<servlet-name>more</servlet-name>
Expand All @@ -62,23 +62,31 @@
<jsp-file>/rss.jsp</jsp-file>
<init-param>
<param-name>keepgenerated</param-name><param-value>true</param-value>
</init-param>
</init-param>
</servlet>
<servlet>
<servlet-name>opensearch</servlet-name>
<display-name>OpenSearch link for current project</display-name>
<jsp-file>/opensearch.jsp</jsp-file>
<init-param>
<param-name>keepgenerated</param-name><param-value>true</param-value>
</init-param>
</init-param>
</servlet>
<servlet>
<servlet-name>raw</servlet-name>
<display-name>Raw Source lister</display-name>
<jsp-file>/raw.jsp</jsp-file>
<init-param>
<param-name>keepgenerated</param-name><param-value>true</param-value>
</init-param>
</init-param>
</servlet>
<servlet>
<servlet-name>download</servlet-name>
<display-name>Download source</display-name>
<jsp-file>/raw.jsp</jsp-file>
<init-param>
<param-name>keepgenerated</param-name><param-value>true</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>error</servlet-name>
Expand Down Expand Up @@ -116,6 +124,10 @@
<servlet-name>raw</servlet-name>
<url-pattern>/raw/*</url-pattern> <!-- RAW_P -->
</servlet-mapping>
<servlet-mapping>
<servlet-name>download</servlet-name>
<url-pattern>/download/*</url-pattern> <!-- DOWNLOAD_P -->
</servlet-mapping>
<servlet-mapping>
<servlet-name>search</servlet-name>
<url-pattern>/s</url-pattern> <!-- SEARCH_R -->
Expand Down
2 changes: 1 addition & 1 deletion web/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ label {
display: inline-block;
}

#history::before, #bar .annotate::before, #line::before, #defbox::before, #download::before {
#history::before, #bar .annotate::before, #line::before, #defbox::before, #download::before, #raw::before {
content: "|";
padding: 0.5ex;
color: black;
Expand Down
6 changes: 3 additions & 3 deletions web/diff.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ include file="mast.jsp"

} else if (data.genre == Genre.IMAGE) {

String link = request.getContextPath() + Prefix.RAW_P
String link = request.getContextPath() + Prefix.DOWNLOAD_P
+ Util.htmlize(cfg.getPath());
%>
<div id="difftable">
Expand All @@ -88,7 +88,7 @@ include file="mast.jsp"

} else if (data.genre != Genre.PLAIN && data.genre != Genre.HTML) {

String link = request.getContextPath() + Prefix.RAW_P
String link = request.getContextPath() + Prefix.DOWNLOAD_P
+ Util.htmlize(cfg.getPath());
%>
<div id="src">Diffs for binary files cannot be displayed! Files are <a
Expand Down Expand Up @@ -488,4 +488,4 @@ include file="mast.jsp"

include file="foot.jspf"

%>
%>
4 changes: 2 additions & 2 deletions web/list.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ document.pageReady.push(function() { pageReadyList();});
File resourceFile = cfg.getResourceFile();
String path = cfg.getPath();
String basename = resourceFile.getName();
String rawPath = request.getContextPath() + Prefix.RAW_P + path;
String rawPath = request.getContextPath() + Prefix.DOWNLOAD_P + path;
Reader r = null;
if (cfg.isDir()) {
// valid resource is requested
Expand Down Expand Up @@ -273,4 +273,4 @@ Click <a href="<%= rawPath %>">download <%= basename %></a><%

include file="foot.jspf"

%>
%>
9 changes: 7 additions & 2 deletions web/mast.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,14 @@ include file="pageheader.jspf"
title="Show or hide symbol list."><%--
--%><span id="defbox"></span>Navigate</a></li><%
}
%><li><a href="<%= context + Prefix.RAW_P + uriEncodedPath
%>
<li><a href="<%= context + Prefix.RAW_P + uriEncodedPath
+ (rev.length() == 0 ? "" : "?") + rev
%>"><span id="download"></span>Download</a></li><%
%>"><span id="raw"></span>Raw</a></li>
<li><a href="<%= context + Prefix.DOWNLOAD_P + uriEncodedPath
+ (rev.length() == 0 ? "" : "?") + rev
%>"><span id="download"></span>Download</a></li>
<%
}
%><li><input type="text" id="search" name="q" class="q" />
<input type="submit" value="Search" class="submit" /></li><%
Expand Down
4 changes: 2 additions & 2 deletions web/offwhite/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ label {
margin-right: 0;
}

#home, #history, #download { /* menu item icons */
#home, #history, #download, #raw { /* menu item icons */
display: inline-block;
width: 18px;
height: 18px;
Expand All @@ -216,7 +216,7 @@ label {
background-position: -18px 0;
}

#download { /* w.gif */
#download, #raw { /* w.gif */
background-position: -36px 0;
}

Expand Down
4 changes: 2 additions & 2 deletions web/polished/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ label {
margin-right: 1ex;
}

#home, #history, #download { /* menu item icons */
#home, #history, #download, #raw { /* menu item icons */
display: inline-block;
width: 18px;
height: 18px;
Expand All @@ -259,7 +259,7 @@ label {
background-position: -18px 0;
}

#download { /* w.gif */
#download, #raw { /* w.gif */
background-position: -36px 0;
}

Expand Down
14 changes: 10 additions & 4 deletions web/raw.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ java.io.OutputStream,

org.opensolaris.opengrok.configuration.RuntimeEnvironment,
org.opensolaris.opengrok.history.HistoryGuru,
org.opensolaris.opengrok.web.PageConfig"
org.opensolaris.opengrok.web.PageConfig,
org.opensolaris.opengrok.web.Prefix"
%><%@

include file="pageconfig.jspf"
Expand All @@ -58,6 +59,7 @@ include file="pageconfig.jspf"
}
InputStream in = null;
try {
Prefix prefix;
if (revision != null) {
in = HistoryGuru.getInstance().getRevision(f.getParent(),
f.getName(), revision.substring(2));
Expand All @@ -79,8 +81,12 @@ include file="pageconfig.jspf"
response.setContentType(mimeType);

try {
response.setHeader("content-disposition", "attachment; filename="
+ f.getName());
if (cfg.getPrefix() == Prefix.DOWNLOAD_P) {
response.setHeader("content-disposition", "attachment; filename="
+ f.getName());
} else {
response.setHeader("content-type", "text/plain");
}
OutputStream o = response.getOutputStream();
byte[] buffer = new byte[8192];
int nr;
Expand All @@ -94,4 +100,4 @@ include file="pageconfig.jspf"
}
}
/* ---------------------- raw.jsp end-------------------- */
%>
%>