io.imunity.console.views.ConsoleErrorPage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unity-server-console Show documentation
Show all versions of unity-server-console Show documentation
Task oriented web based administration UI
/*
* Copyright (c) 2018 Bixbit - Krzysztof Benedyczak. All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package io.imunity.console.views;
import org.apache.logging.log4j.Logger;
import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.ErrorParameter;
import com.vaadin.flow.router.HasErrorParameter;
import com.vaadin.flow.router.ParentLayout;
import io.imunity.console.ConsoleMenu;
import jakarta.annotation.security.PermitAll;
import jakarta.servlet.http.HttpServletResponse;
import pl.edu.icm.unity.base.message.MessageSource;
import pl.edu.icm.unity.base.utils.Log;
@PermitAll
@ParentLayout(ConsoleMenu.class)
public class ConsoleErrorPage extends Composite implements HasErrorParameter
{
private static final Logger log = Log.getLogger(Log.U_SERVER_WEB, ConsoleErrorPage.class);
private final MessageSource messageSource;
ConsoleErrorPage(MessageSource messageSource)
{
this.messageSource = messageSource;
}
@Override
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter parameter)
{
log.error("Vaadin rendering error:", parameter.getCaughtException());
getElement().setText(messageSource.getMessage("Error"));
return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy