Merge branch 'stable-2.6' into master
* stable-2.6: Allow HTTP plugins to change static or docs prefixes Add 'Misc' sections to Gerrit 2.6 release notes Update 'Documentation' section in Gerrit 2.6 release notes Add 'REST API' sections to the Gerrit 2.6 release notes Update 'Git' sections in Gerrit 2.6 release notes Add 'Dev' section to Gerrit 2.6 release notes Describe project dashboards in Gerrit 2.6 release notes Update 'Plugins' sections in Gerrit 2.6 release notes Update 'Upgrades' section in Gerrit 2.6 release notes Make ProjectInfo and fields public Make ListProjects.apply() more friendly for programmatic use ListProjects: Move @Option to public setters Update 'Web UI' sections in Gerrit 2.6 release notes Change-Id: If4b83a77d4154b152d76f0c45039a2d3cfd923c7
This commit is contained in:
@@ -880,6 +880,7 @@ non-blocked rules as they wish. This gives best of both worlds:
|
||||
* Project owners can manage access rights of their projects without a danger
|
||||
of violating a site wide policy
|
||||
|
||||
[[block]]
|
||||
'BLOCK' access rule
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ beyond simple spacing issues. Blame it on our short attention
|
||||
spans, we really do want your code.
|
||||
|
||||
|
||||
[[commit-message]]
|
||||
Commit Message
|
||||
--------------
|
||||
|
||||
@@ -258,6 +259,7 @@ especially if changing one without the other will break something!
|
||||
and it also makes "git revert" more useful.
|
||||
* Use topic branches to link your separate changes together.
|
||||
|
||||
[[process]]
|
||||
Process
|
||||
-------
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Java 6 or later SDK is also required to run GWT's compiler and
|
||||
runtime debugging environment.
|
||||
|
||||
|
||||
[[maven]]
|
||||
Maven Plugin
|
||||
------------
|
||||
|
||||
|
||||
@@ -385,10 +385,13 @@ If a plugin does not register a filter or servlet to handle URLs
|
||||
automatically export these resources over HTTP from the plugin JAR.
|
||||
|
||||
Static resources under `static/` directory in the JAR will be
|
||||
available as `/plugins/helloworld/static/resource`.
|
||||
available as `/plugins/helloworld/static/resource`. This prefix is
|
||||
configurable by setting the `Gerrit-HttpStaticPrefix` attribute.
|
||||
|
||||
Documentation files under `Documentation/` directory in the JAR
|
||||
will be available as `/plugins/helloworld/Documentation/resource`.
|
||||
will be available as `/plugins/helloworld/Documentation/resource`. This
|
||||
prefix is configurable by setting the `Gerrit-HttpDocumentationPrefix`
|
||||
attribute.
|
||||
|
||||
Documentation may be written in
|
||||
link:http://daringfireball.net/projects/markdown/[Markdown] style
|
||||
|
||||
@@ -130,6 +130,7 @@ using an administrator user account:
|
||||
----
|
||||
|
||||
|
||||
[[debug-javascript]]
|
||||
Debugging JavaScript
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ Here are some guidelines on release approaches depending on the
|
||||
type of release you want to make (`stable-fix`, `stable`, `RC0`,
|
||||
`RC1`...).
|
||||
|
||||
[[stable]]
|
||||
Stable
|
||||
~~~~~~
|
||||
|
||||
@@ -62,6 +63,7 @@ updates.
|
||||
objectives are met
|
||||
|
||||
|
||||
[[security]]
|
||||
Security-Fix
|
||||
~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ cherry-pick mode. Submitters must remember to submit changes in
|
||||
the right order since inter-change dependencies will not be
|
||||
enforced for them.
|
||||
|
||||
[[rebase_if_necessary]]
|
||||
* Rebase If Necessary
|
||||
+
|
||||
If the change being submitted is a strict superset of the destination
|
||||
|
||||
@@ -40,6 +40,7 @@ rebased to address reviewer comments since its initial inception.
|
||||
To avoid confusion with commit names, Change-Ids are typically prefixed with
|
||||
an uppercase `I`.
|
||||
|
||||
[[creation]]
|
||||
Creation
|
||||
--------
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ to changes for the current user:
|
||||
----
|
||||
|
||||
|
||||
[[project-dashboards]]
|
||||
Project Dashboards
|
||||
------------------
|
||||
|
||||
@@ -132,6 +133,7 @@ section.<name>.query::
|
||||
The change query that should be used to populate the section with the
|
||||
given name.
|
||||
|
||||
[[project-default-dashboard]]
|
||||
Project Default Dashboard
|
||||
-------------------------
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ by the uploading user.
|
||||
Gerrit supports two methods of authenticating the uploading user. SSH
|
||||
public key, and HTTP/HTTPS.
|
||||
|
||||
[[http]]
|
||||
HTTP/HTTPS
|
||||
----------
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.httpd.plugins;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.cache.Cache;
|
||||
@@ -257,8 +258,11 @@ class HttpPluginServlet extends HttpServlet
|
||||
}
|
||||
|
||||
if ("".equals(file)) {
|
||||
res.sendRedirect(uri + "Documentation/index.html");
|
||||
} else if (file.startsWith("static/")) {
|
||||
res.sendRedirect(uri + holder.docPrefix + "index.html");
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.startsWith(holder.staticPrefix)) {
|
||||
JarFile jar = holder.plugin.getJarFile();
|
||||
JarEntry entry = jar.getJarEntry(file);
|
||||
if (exists(entry)) {
|
||||
@@ -267,11 +271,12 @@ class HttpPluginServlet extends HttpServlet
|
||||
resourceCache.put(key, Resource.NOT_FOUND);
|
||||
Resource.NOT_FOUND.send(req, res);
|
||||
}
|
||||
} else if (file.equals("Documentation")) {
|
||||
} else if (file.equals(
|
||||
holder.docPrefix.substring(0, holder.docPrefix.length() - 1))) {
|
||||
res.sendRedirect(uri + "/index.html");
|
||||
} else if (file.startsWith("Documentation/") && file.endsWith("/")) {
|
||||
} else if (file.startsWith(holder.docPrefix) && file.endsWith("/")) {
|
||||
res.sendRedirect(uri + "index.html");
|
||||
} else if (file.startsWith("Documentation/")) {
|
||||
} else if (file.startsWith(holder.docPrefix)) {
|
||||
JarFile jar = holder.plugin.getJarFile();
|
||||
JarEntry entry = jar.getJarEntry(file);
|
||||
if (!exists(entry)) {
|
||||
@@ -574,10 +579,32 @@ class HttpPluginServlet extends HttpServlet
|
||||
private static class PluginHolder {
|
||||
final Plugin plugin;
|
||||
final GuiceFilter filter;
|
||||
final String staticPrefix;
|
||||
final String docPrefix;
|
||||
|
||||
PluginHolder(Plugin plugin, GuiceFilter filter) {
|
||||
this.plugin = plugin;
|
||||
this.filter = filter;
|
||||
this.staticPrefix =
|
||||
getPrefix(plugin, "Gerrit-HttpStaticPrefix", "static/");
|
||||
this.docPrefix =
|
||||
getPrefix(plugin, "Gerrit-HttpDocumentationPrefix", "Documentation/");
|
||||
}
|
||||
|
||||
private static String getPrefix(Plugin plugin, String attr, String def) {
|
||||
try {
|
||||
String prefix = plugin.getJarFile().getManifest().getMainAttributes()
|
||||
.getValue(attr);
|
||||
if (prefix != null) {
|
||||
return CharMatcher.is('/').trimFrom(prefix) + "/";
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn(String.format("Error getting %s for plugin %s, using default",
|
||||
attr, plugin.getName()), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user