Error handling 为什么ErrorHandler组件未在SlingMainServlet中正确注册?
我有一个用于自己的ErrorHandler实现的简单组件:Error handling 为什么ErrorHandler组件未在SlingMainServlet中正确注册?,error-handling,aem,sling,Error Handling,Aem,Sling,我有一个用于自己的ErrorHandler实现的简单组件: @Component(immediate = true) @Service @Properties( @Property(name = "service.ranking", intValue = 1) ) public class MyErrorHandler implements ErrorHandler { @Override public void handleError(int status,
@Component(immediate = true)
@Service
@Properties(
@Property(name = "service.ranking", intValue = 1)
)
public class MyErrorHandler implements ErrorHandler {
@Override
public void handleError(int status, String message, SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
handleError(status, request, response);
}
@Override
public void handleError(Throwable throwable, SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
handleError(505, request, response);
}
private void handleError(int status, SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
if (status != 200) {
try {
request.getRequestDispatcher("/etc/errors/" + status + ".html").forward(request, response);
} catch (ServletException e) {
throw new IllegalStateException("No error pages");
}
}
}
如果我将组件部署到吊索上,在整个吊索重新启动之前,不会发生任何事情。我想这不是个好办法
关于使用ErrorHandler而不是处理脚本的简短说明(针对那些会问“为什么不使用重载脚本”的人)
这是否替换默认的错误处理程序?你知道这个错误处理程序叫什么吗?这会取代默认的错误处理程序吗?你知道这个错误处理程序叫什么吗?