本文整理汇总了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);
}
}
示例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;
}
}
示例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);
}
}
}