java—如何在httpresponse.senderror中发送一个值之后跟踪springboot中的值

csga3l58  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(308)

我试图追踪一个变量的起源,叫做“localizedmessage”,它是在SpringBoot上的应用程序代码中创建的。
我可以追踪到这个地点:

httpResponse.sendError(status.value(), localizedMessage.trim());

按以下方法

private ErrorDTO handleException(Exception ex, HttpStatus status, WebRequest webRequest, String message,
            Object... messageArgs) {

        ErrorDTO errorDTO = new ErrorDTO(status, ex.getLocalizedMessage(), ex.getMessage());
        if (webRequest instanceof ServletWebRequest) {
            String localizedMessage = localizedMessageConverter.getLocalizedMessage(webRequest, message.trim(),
                    messageArgs);
            ServletWebRequest servletRequest = (ServletWebRequest) webRequest;
            HttpServletRequest request = servletRequest.getNativeRequest(HttpServletRequest.class);
            HttpServletResponse httpResponse = servletRequest.getNativeResponse(HttpServletResponse.class);
            errorDTO.setUrl(request.getRequestURL().toString());
            try {
                httpResponse.sendError(status.value(), localizedMessage.trim());
            } catch (IOException e) {
                LOG.debug(e.getMessage(), e);
            }
        }
        errorDTO.setStatus(status);
        errorDTO.setMessage(message);
        errorDTO.setError(ex.getMessage()
}

它之前是这么说的:

Device(s) testPassword is (are) not configured properly. Proper connection settings are required for image server.

但不知怎么的,在那句话之后,它被修改了。在显示器上查看时,它具有

!!!image-servers:Device(s) testPassword is (are) not configured properly. Proper connection settings are required for image server.!!!

如何找到图像的修改位置?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题