當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。