本文整理汇总了Java中org.apache.cxf.service.invoker.MethodDispatcher.getMethod方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDispatcher.getMethod方法的具体用法?Java MethodDispatcher.getMethod怎么用?Java MethodDispatcher.getMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.service.invoker.MethodDispatcher
的用法示例。
在下文中一共展示了MethodDispatcher.getMethod方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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");
}
示例2: 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");
}
示例3: 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);
}
示例4: 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);
}
}