提交 a58a69f3 编写于 作者: JenkinsInChina's avatar JenkinsInChina

Add help request dispatcher

上级 6f659eb1
package hudson.plugins.localization;
import org.kohsuke.stapler.Dispatcher;
import org.kohsuke.stapler.RequestImpl;
import org.kohsuke.stapler.ResponseImpl;
import javax.servlet.ServletException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
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")) {
return true;
}
return false;
}
@Override
public String toString() {
return null;
}
}
\ No newline at end of file
package hudson.plugins.localization;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
public class I18nRequestDispatcher implements RequestDispatcher {
@Override
public void forward(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
System.out.println("forward");
}
@Override
public void include(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
System.out.println("include");
}
}
\ No newline at end of file
......@@ -21,7 +21,10 @@ public class L10nDecorator extends PageDecorator {
// hook into Stapler to activate contributed l10n
hudson = Hudson.getInstance();
WebApp.get(hudson.servletContext).getFacet(JellyFacet.class).resourceBundleFactory
= bundleFactory;
WebApp webContext = WebApp.get(hudson.servletContext);
JellyFacet facet = webContext.getFacet(JellyFacet.class);
facet.resourceBundleFactory = bundleFactory;
webContext.facets.add(new LocalizationFacet());
}
}
package hudson.plugins.localization;
import org.kohsuke.stapler.*;
import org.kohsuke.stapler.lang.Klass;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.List;
public class LocalizationFacet extends Facet {
@Override
public void buildViewDispatchers(MetaClass owner, List<Dispatcher> dispatchers) {
System.out.println(12);
dispatchers.add(new I18nDispatcher());
}
@Override
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException {
return super.createRequestDispatcher(request, type, it, viewName);
}
@Override
public RequestDispatcher createRequestDispatcher(RequestImpl request, Class type, Object it, String viewName) throws IOException {
return super.createRequestDispatcher(request, type, it, viewName);
}
@Override
public boolean handleIndexRequest(RequestImpl req, ResponseImpl rsp, Object node, MetaClass nodeMetaClass) throws IOException, ServletException {
return false;
}
}
\ No newline at end of file
hudson.plugins.localization.LocalizationFacet
\ No newline at end of file
<div>
Configure Jenkins to poll changes in SCM.--
<p>
Note that this is going to be an expensive operation for CVS, as every polling
requires Jenkins to scan the entire workspace and verify it with the server.
Consider setting up a "push" trigger to avoid this overhead, as described in
<a href="https://jenkins.io/redirect/scm-change-trigger">this document</a>
</div>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册