hudson.remoting.Channel.addLocalExecutionInterceptor()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(248)

本文整理了Java中hudson.remoting.Channel.addLocalExecutionInterceptor()方法的一些代码示例,展示了Channel.addLocalExecutionInterceptor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.addLocalExecutionInterceptor()方法的具体详情如下:
包路径:hudson.remoting.Channel
类名称:Channel
方法名:addLocalExecutionInterceptor

Channel.addLocalExecutionInterceptor介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. public CliManagerImpl(Channel channel) {
  2. this.channel = channel;
  3. channel.addLocalExecutionInterceptor(authenticationFilter);
  4. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public CliManagerImpl(Channel channel) {
  2. this.channel = channel;
  3. channel.addLocalExecutionInterceptor(authenticationFilter);
  4. }

代码示例来源:origin: jenkinsci/remoting

  1. /**
  2. * @deprecated
  3. * use {@link #addLocalExecutionInterceptor(CallableDecorator)}
  4. */
  5. @Deprecated
  6. public void addLocalExecutionInterceptor(CallableFilter filter) {
  7. addLocalExecutionInterceptor(new CallableDecoratorAdapter(filter));
  8. }

代码示例来源:origin: jenkinsci/remoting

  1. public void testFilter() throws Exception {
  2. channel.addLocalExecutionInterceptor(new CallableFilter() {
  3. public <V> V call(Callable<V> callable) throws Exception {
  4. Object old = STORE.get();
  5. STORE.set("x");
  6. try {
  7. return callable.call();
  8. } finally {
  9. STORE.set(old);
  10. }
  11. }
  12. });
  13. Callable<Object> t = new Callable<Object>() {
  14. public Object call() throws Exception {
  15. return STORE.get();
  16. }
  17. };
  18. final Callable c = channel.export(Callable.class, t);
  19. assertEquals("x", channel.call(new CallableCallable(c)));
  20. }

代码示例来源:origin: jenkinsci/remoting

  1. public void testBlacklisting() throws Exception {
  2. channel.addLocalExecutionInterceptor(new CallableDecorator() {
  3. @Override
  4. public <V, T extends Throwable> hudson.remoting.Callable<V, T> userRequest(hudson.remoting.Callable<V, T> op, hudson.remoting.Callable<V, T> stem) {
  5. if (op instanceof ShadyBusiness)
  6. throw new SecurityException("Rejecting "+op.getClass().getName());
  7. return stem;
  8. }
  9. });
  10. // this direction is unrestricted
  11. assertEquals("gun",channel.call(new GunImporter()));
  12. // the other direction should be rejected
  13. try {
  14. channel.call(new ReverseGunImporter());
  15. fail("should have failed");
  16. } catch (Exception e) {
  17. assertEquals("Rejecting "+GunImporter.class.getName(), findSecurityException(e).getMessage());
  18. // e.printStackTrace();
  19. }
  20. }
  21. private static SecurityException findSecurityException(Throwable x) {

相关文章