From 41e3a130bb9956975102012e6c003af1db75dfba Mon Sep 17 00:00:00 2001 From: suren Date: Fri, 31 Aug 2018 10:21:55 +0800 Subject: [PATCH] modify git ignore --- .gitignore | 8 +++- .../plugins/localization/I18nDispatcher.java | 1 + .../localization/I18nRequestDispatcher.java | 22 ++++++++++- .../localization/LocalizationFacet.java | 7 +++- .../plugins/localization/abcDispatcher.java | 10 +++++ .../AbstractProject/help-concurrentBuild.html | 39 +++++++++++++++++++ .../model/FreeStyleProject/help_zh_CN.html | 1 + 7 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 src/main/java/hudson/plugins/localization/abcDispatcher.java create mode 100644 src/main/resources/hudson/model/AbstractProject/help-concurrentBuild.html create mode 100644 src/main/resources/hudson/model/FreeStyleProject/help_zh_CN.html diff --git a/.gitignore b/.gitignore index 57e314d..acf9c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ **/*.iml -idea +.idea +.DS_Store + +# maven stuff target + +# jenkins stuff +work diff --git a/src/main/java/hudson/plugins/localization/I18nDispatcher.java b/src/main/java/hudson/plugins/localization/I18nDispatcher.java index b67322c..24ef503 100644 --- a/src/main/java/hudson/plugins/localization/I18nDispatcher.java +++ b/src/main/java/hudson/plugins/localization/I18nDispatcher.java @@ -12,6 +12,7 @@ public class I18nDispatcher extends Dispatcher { @Override public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException, IllegalAccessException, InvocationTargetException { if(req.getOriginalRequestURI().endsWith("help")) { +// new I18nRequestDispatcher().forward(req.getRequest(), rsp.getResponse()); return true; } diff --git a/src/main/java/hudson/plugins/localization/I18nRequestDispatcher.java b/src/main/java/hudson/plugins/localization/I18nRequestDispatcher.java index d33d60d..b696c2a 100644 --- a/src/main/java/hudson/plugins/localization/I18nRequestDispatcher.java +++ b/src/main/java/hudson/plugins/localization/I18nRequestDispatcher.java @@ -1,5 +1,8 @@ package hudson.plugins.localization; +import org.kohsuke.stapler.RequestImpl; +import org.kohsuke.stapler.lang.Klass; + import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.ServletRequest; @@ -7,9 +10,26 @@ import javax.servlet.ServletResponse; import java.io.IOException; public class I18nRequestDispatcher implements RequestDispatcher { + private RequestImpl request; + private Klass type; + private Object it; + private String viewName; + public I18nRequestDispatcher(RequestImpl request, Klass type, Object it, String viewName) { + this.request = request; + this.type = type; + this.it = it; + this.viewName = viewName; + } + @Override - public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { + public void forward(ServletRequest req, ServletResponse servletResponse) throws ServletException, IOException { System.out.println("forward"); + String path = this.request.getOriginalRestOfPath(); + String uri = this.request.getOriginalRequestURI(); + +// this.getClass().getResource("/hudson/model/FreeStyleProject/help_zh_CN.html").openStream() == null + servletResponse.getWriter().println("sff"); +// /jenkins/descriptor/hudson.model.FreeStyleProject/help/concurrentBuild } @Override diff --git a/src/main/java/hudson/plugins/localization/LocalizationFacet.java b/src/main/java/hudson/plugins/localization/LocalizationFacet.java index 697b531..afe4103 100644 --- a/src/main/java/hudson/plugins/localization/LocalizationFacet.java +++ b/src/main/java/hudson/plugins/localization/LocalizationFacet.java @@ -17,7 +17,12 @@ public class LocalizationFacet extends Facet { @Override public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass type, Object it, String viewName) throws IOException { - return super.createRequestDispatcher(request, type, it, viewName); + RequestDispatcher dispatcher = super.createRequestDispatcher(request, type, it, viewName); + if(dispatcher == null) { +// dispatcher = new I18nRequestDispatcher(request, type, it, viewName); + } + + return dispatcher; } @Override diff --git a/src/main/java/hudson/plugins/localization/abcDispatcher.java b/src/main/java/hudson/plugins/localization/abcDispatcher.java new file mode 100644 index 0000000..ab2748b --- /dev/null +++ b/src/main/java/hudson/plugins/localization/abcDispatcher.java @@ -0,0 +1,10 @@ +//package hudson.plugins.localization; +// +//import org.apache.commons.jelly.Script; +//import org.kohsuke.stapler.jelly.JellyRequestDispatcher; +// +//public class abcDispatcher extends JellyRequestDispatcher { +// public abcDispatcher(Object it, Script script) { +// super(it, script); +// } +//} diff --git a/src/main/resources/hudson/model/AbstractProject/help-concurrentBuild.html b/src/main/resources/hudson/model/AbstractProject/help-concurrentBuild.html new file mode 100644 index 0000000..2d100ac --- /dev/null +++ b/src/main/resources/hudson/model/AbstractProject/help-concurrentBuild.html @@ -0,0 +1,39 @@ +111 +
+ When this option is checked, multiple builds of this project may be executed + in parallel. +

+ By default, only a single build of a project is executed at a time — any + other requests to start building that project will remain in the build queue + until the first build is complete.
+ This is a safe default, as projects can often require exclusive access to + certain resources, such as a database, or a piece of hardware. +

+ But with this option enabled, if there are enough build executors available + that can handle this project, then multiple builds of this project will take + place in parallel. If there are not enough available executors at any point, + any further build requests will be held in the build queue as normal. +

+ Enabling concurrent builds is useful for projects that execute lengthy test + suites, as it allows each build to contain a smaller number of changes, while + the total turnaround time decreases as subsequent builds do not need to wait + for previous test runs to complete.
+ This feature is also useful for parameterized projects, whose individual build + executions — depending on the parameters used — can be + completely independent from one another. +

+ Each concurrently executed build occurs in its own build workspace, isolated + from any other builds. By default, Jenkins appends "@<num>" to + the workspace directory name, e.g. "@2".
+ The separator "@" can be changed by setting the + hudson.slaves.WorkspaceList Java system property when starting + Jenkins. For example, "hudson.slaves.WorkspaceList=-" would change + the separator to a hyphen.
+ For more information on setting system properties, see the wiki page. +

+ However, if you enable the Use custom workspace option, all builds will + be executed in the same workspace. Therefore caution is required, as multiple + builds may end up altering the same directory at the same time. +

diff --git a/src/main/resources/hudson/model/FreeStyleProject/help_zh_CN.html b/src/main/resources/hudson/model/FreeStyleProject/help_zh_CN.html new file mode 100644 index 0000000..42df6e5 --- /dev/null +++ b/src/main/resources/hudson/model/FreeStyleProject/help_zh_CN.html @@ -0,0 +1 @@ +sdfsf \ No newline at end of file -- GitLab