当前位置: 首页>>代码示例>>Java>>正文


Java NoOpFaultListener类代码示例

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


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

示例1: handleValidation

import org.apache.cxf.logging.NoOpFaultListener; //导入依赖的package包/类
@Override
protected void handleValidation(final Message message, final Object resourceInstance, final Method method,
		final List<Object> arguments) {
	super.handleValidation(message, resourceInstance, method, arguments);

	// Check each parameter
	final Set<ConstraintViolation<?>> validationErrors = new HashSet<>();
	for (int index = 0; index < arguments.size(); index++) {
		final Parameter parameter = method.getParameters()[index];
		if (hasToBeValidated(parameter)) {
			// This parameter is a not context, path or query parameter
			validate(arguments.get(index), method, parameter, index, validationErrors);
		}
	}

	// Check the veto
	if (!validationErrors.isEmpty()) {
		message.put(FaultListener.class.getName(), new NoOpFaultListener());
		throw new ConstraintViolationException(validationErrors);
	}
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:22,代码来源:JAXRSBeanValidationImplicitInInterceptor.java

示例2: handleMessage

import org.apache.cxf.logging.NoOpFaultListener; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault {
    // JAX-RS
    Method method = getTargetMethod(message);
    HttpServletRequest request = (HttpServletRequest) message.getContextualProperty("HTTP.REQUEST");
    if (!hasAnnotation(method) && (request == null || !remoteHostMatcher.isAllowed(request))) {
        // This is to prevent a full stack trace getting logged for a denied request
        message.put(FaultListener.class.getName(), new NoOpFaultListener());
        Fault fault = new Fault(
                new org.apache.cxf.common.i18n.Message("Not permitted", (ResourceBundle) null),
                Fault.FAULT_CODE_CLIENT
        );
        fault.setStatusCode(HttpServletResponse.SC_FORBIDDEN);
        throw fault;
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:NetworkAddressValidatingInterceptor.java

示例3: handleMessage

import org.apache.cxf.logging.NoOpFaultListener; //导入依赖的package包/类
@Override
public void handleMessage(Message message) {
    final List<Object> arguments = MessageContentsList.getContentsList(message);
    if (!arguments.isEmpty()) {
        final Object instance = message.getExchange().get(Message.SERVICE_OBJECT);
        final Method method = (Method) message.get(METHOD_KEY);
        final ExecutableValidator methodValidator = validator.forExecutables();
        final Class<?>[] groups = Optional.ofNullable(method.getAnnotation(Groups.class)).map(Groups::value).orElse(DEFAULT_GROUPS);
        final Set<ConstraintViolation<Object>> violations = methodValidator.validateParameters(instance, method, arguments.toArray(), groups);
        if (!violations.isEmpty()) {
            message.put(FaultListener.class.getName(), new NoOpFaultListener());
            throw new JaxrsServerValidationException(violations);
        }
    }
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:16,代码来源:ValidationInterceptor.java


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