• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MethodDispatcher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cxf.service.invoker.MethodDispatcher的典型用法代码示例。如果您正苦于以下问题:Java MethodDispatcher类的具体用法?Java MethodDispatcher怎么用?Java MethodDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MethodDispatcher类属于org.apache.cxf.service.invoker包,在下文中一共展示了MethodDispatcher类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMockMessage

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
/**
 * Creates a mock message that is destined for a method called "test"on
 */
private Message getMockMessage() throws NoSuchMethodException {
    Message message = mock(Message.class);
    Exchange exchange = mock(Exchange.class);
    BindingOperationInfo bindingOperationInfo = mock(BindingOperationInfo.class);
    Service service = mock(Service.class);
    MethodDispatcher methodDispatcher = mock(MethodDispatcher.class);
    Method method = TestClass.class.getMethod("test");

    when(message.getExchange()).thenReturn(exchange);
    when(exchange.get(BindingOperationInfo.class)).thenReturn(bindingOperationInfo);
    when(exchange.get(Service.class)).thenReturn(service);
    when(service.get(MethodDispatcher.class.getName())).thenReturn(methodDispatcher);
    when(methodDispatcher.getMethod(bindingOperationInfo)).thenReturn(method);

    return message;
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:20,代码来源:CxfFunctionGuardInterceptorTest.java


示例2: getTestExchange

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
private Exchange getTestExchange() {
   Exchange exchange = new ExchangeImpl();
   Message message = new MessageImpl();
   message.setExchange(exchange);
   exchange.setInMessage(message);
   exchange.put(BindingOperationInfo.class, new BindingOperationInfo());
   Service service = new ServiceImpl();
   MethodDispatcher md = new MethodDispatcher() {
      @Override
      public Method getMethod(BindingOperationInfo op) {
         return this.getClass().getMethods()[0];
      }
      @Override
      public BindingOperationInfo getBindingOperation(Method m, Endpoint endpoint) {
         return null;
      }
      @Override
      public void bind(OperationInfo o, Method... methods) {
      }
   };
   service.put(MethodDispatcher.class.getName(), md);
   exchange.put(Service.class, service);
   return exchange;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:25,代码来源:JBossWSInvokerTest.java


示例3: getTargetMethod

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
protected Method getTargetMethod(Message m) {
    // Used the SOAP
    BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);
    if (bop != null) {
        MethodDispatcher md = (MethodDispatcher)
                m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
        return md.getMethod(bop);
    }
    // Used for JAX-RS
    // This doesn't work for JAX-RS sub-resources as the lookup is only done on the original method, not the
    // sub-resource
    Method method = (Method) m.get("org.apache.cxf.resource.method");
    if (method != null) {
        return method;
    }
    throw new AccessDeniedException("Method is not available : Unauthorized");
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:NetworkAddressValidatingInterceptor.java


示例4: getTargetMethod

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
protected Method getTargetMethod(Message m)
{
    BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);
    if (bop != null)
    {
        MethodDispatcher md = (MethodDispatcher) m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());

        return md.getMethod(bop);
    }

    Method method = (Method) m.get("org.apache.cxf.resource.method");
    if (method != null)
    {
        return method;
    }
    throw new AccessDeniedException("Method is not available : Unauthorized");
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:18,代码来源:AuthorizationHandler.java


示例5: getMethod

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
private Method getMethod(Service s, OperationInfo op) {
    Method m = op.getProperty(Method.class.getName(), Method.class);
    if (m != null) {
        return m;
    }
    MethodDispatcher md = (MethodDispatcher)s.get(MethodDispatcher.class.getName());
    // The ibm jdk requires the simple frontend dependency to be
    // present for the SimpleMethodDispatcher cast below even if
    // md is null (sun jdk does not).  So, for the jaxrs frontend,
    // we can exclude the simple frontend from the aegis databinding
    // dependency as long as this null check is here.
    if (md == null) {
        return null;
    }
    SimpleMethodDispatcher smd = (SimpleMethodDispatcher)md;
    return smd.getPrimaryMethod(op);
}
 
开发者ID:claudemamo,项目名称:jruby-cxf,代码行数:18,代码来源:AegisDatabinding.java


示例6: getServiceMethod

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
/**
 * Extracts the Method that will be invoked by the service from the Message object
 *
 * @param message Message to extract the method from
 * @return Method that will be invoked by the service from the Message object
 */
private Method getServiceMethod(Message message) {
    Exchange exchange = message.getExchange();
    BindingOperationInfo bindingOperationInfo = exchange.get(BindingOperationInfo.class);
    MethodDispatcher methodDispatcher = (MethodDispatcher)
            exchange.get(Service.class).get(MethodDispatcher.class.getName());
    return methodDispatcher.getMethod(bindingOperationInfo);
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:14,代码来源:CxfFunctionGuardInterceptor.java


示例7: checkAuthorization

import org.apache.cxf.service.invoker.MethodDispatcher; //导入依赖的package包/类
protected void checkAuthorization(MessageContext ctx)
{
   if ((Boolean) ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY))
   {
      return;
   }
   Message message = ((WrappedMessageContext) ctx).getWrappedMessage();
   Exchange exchange = message.getExchange();
   Endpoint ep = exchange.get(Endpoint.class);
   EJBMethodSecurityAttributeProvider attributeProvider = ep
         .getAttachment(EJBMethodSecurityAttributeProvider.class);
   if (attributeProvider != null) //ejb endpoints only can be associated with this...
   {
      SecurityContext secCtx = message.get(SecurityContext.class);
      BindingOperationInfo bop = exchange.getBindingOperationInfo();
      MethodDispatcher md = (MethodDispatcher) exchange.getService().get(MethodDispatcher.class.getName());
      Method method = md.getMethod(bop);

      EJBMethodSecurityAttribute attributes = attributeProvider.getSecurityAttributes(method);
      if (attributes == null || attributes.isPermitAll()) //no security requirement or method marked @PermitAll
      {
         return;
      }
      if (!attributes.isDenyAll())
      {
         if (attributes.getRolesAllowed() != null)
         {
            for (String role : attributes.getRolesAllowed())
            {
               if (secCtx.isUserInRole(role))
               {
                  return;
               }
            }
         }
      }
      final Principal p = secCtx.getUserPrincipal();
      ctx.put(KEY, true);
      throw MESSAGES.authorizationFailed(p != null ? p.getName() : null);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:42,代码来源:HandlerAuthInterceptor.java



注:本文中的org.apache.cxf.service.invoker.MethodDispatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProspectiveSearchService类代码示例发布时间:2022-05-23
下一篇:
Java Argument类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap