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


Java MessageExceptionHandler类代码示例

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


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

示例1: handleError

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler(Exception.class)
@SendToUser("${appverse.frontfacade.websocket.exceptionHandler.path:/queue/errors}")
public ResponseDataVO handleError(Exception exception) {
    ResponseDataVO data = new ResponseDataVO();
    ErrorVO error = new ErrorVO();

    Long code = 500L;
    if(exception instanceof AbstractException) {
        if (((AbstractException) exception).getCode() != null) {
            code = ((AbstractException) exception).getCode();
        }
    }
    error.setCode(code);
    error.setMessage(exception.getMessage());
    data.setErrorVO(error);
    return data;
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:18,代码来源:WebSocketExceptionHandler.java

示例2: handleUserInputError

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
@SendToUser("/queue/errors")
public UIError handleUserInputError(UserInputException exception) {
    logger.error("Incorrect user input: " + exception.getMessage());
    String messageKey = exception.getMessageResourceKey();
    String message = messageSource.getMessage(messageKey, exception.getParams(), messageKey, Locale.US);
    return new UIError(messageKey, message, ErrorType.USER_INPUT);
}
 
开发者ID:luxons,项目名称:seven-wonders,代码行数:9,代码来源:ExceptionHandler.java

示例3: handleValidationError

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
@SendToUser("/queue/errors")
public UIError handleValidationError(MethodArgumentNotValidException exception) {
    logger.error("Invalid input", exception);
    UIError uiError = new UIError(ERROR_CODE_VALIDATION, ERROR_MSG_VALIDATION, ErrorType.VALIDATION);

    BindingResult result = exception.getBindingResult();
    if (result != null) {
        List<ObjectError> errors = result.getAllErrors();
        uiError.addDetails(errors);
    }
    return uiError;
}
 
开发者ID:luxons,项目名称:seven-wonders,代码行数:14,代码来源:ExceptionHandler.java

示例4: handleException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
/**
 * direct-message handler to send messaging errors to a device in session
 *
 * @param   exception   the exception that was thrown by the messaging error
 * @return              String, the message sent back to the device containing the error
 */
@MessageExceptionHandler
@SendToUser("/queue/errors")
public String handleException(Throwable exception) {
    logger.error("Handling exception: ", exception);
    return exception.getMessage();
}
 
开发者ID:wieden-kennedy,项目名称:composite-framework,代码行数:13,代码来源:CompositeController.java

示例5: matches

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@Override
public boolean matches(Method method) {
	return AnnotationUtils.findAnnotation(method, MessageExceptionHandler.class) != null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:AnnotationExceptionHandlerMethodResolver.java

示例6: handleValidationException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler(MethodArgumentNotValidException.class)
public void handleValidationException() {
	this.method = "handleValidationException";
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:SimpAnnotationMethodMessageHandlerTests.java

示例7: handleExceptionWithHandlerMethodArg

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler(IllegalStateException.class)
public void handleExceptionWithHandlerMethodArg(HandlerMethod handlerMethod) {
	this.method = "handleExceptionWithHandlerMethodArg";
	this.arguments.put("handlerMethod", handlerMethod);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:SimpAnnotationMethodMessageHandlerTests.java

示例8: handleIOException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler(IOException.class)
public void handleIOException() {
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:4,代码来源:AnnotationExceptionHandlerMethodResolverTests.java

示例9: handleSocketException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler(SocketException.class)
public void handleSocketException() {
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:4,代码来源:AnnotationExceptionHandlerMethodResolverTests.java

示例10: handleIllegalArgumentException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
public void handleIllegalArgumentException(IllegalArgumentException exception) {
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:4,代码来源:AnnotationExceptionHandlerMethodResolverTests.java

示例11: handle1

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler({BindException.class, IllegalArgumentException.class})
public String handle1(Exception ex) throws IOException {
	return ClassUtils.getShortName(ex.getClass());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:AnnotationExceptionHandlerMethodResolverTests.java

示例12: handle2

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
public String handle2(IllegalArgumentException ex) {
	return ClassUtils.getShortName(ex.getClass());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:AnnotationExceptionHandlerMethodResolverTests.java

示例13: handle

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
public void handle() {
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:4,代码来源:AnnotationExceptionHandlerMethodResolverTests.java

示例14: handleException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
@SendToUser("/queue/error")
public String handleException(IllegalArgumentException ex) {
	return "Got error: " + ex.getMessage();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:StompWebSocketIntegrationTests.java

示例15: handleException

import org.springframework.messaging.handler.annotation.MessageExceptionHandler; //导入依赖的package包/类
@MessageExceptionHandler
public void handleException(IllegalStateException ex) {
	this.exceptionHandled = true;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:WebSocketAnnotationMethodMessageHandlerTests.java


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