io.imunity.vaadin.endpoint.common.CustomNotFoundTarget Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unity-server-vaadin-endpoint-common Show documentation
Show all versions of unity-server-vaadin-endpoint-common Show documentation
Common Vaadin endpoint components
The newest version!
/*
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package io.imunity.vaadin.endpoint.common;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.ErrorParameter;
import com.vaadin.flow.router.NotFoundException;
import com.vaadin.flow.router.RouteNotFoundError;
import pl.edu.icm.unity.base.message.MessageSource;
import jakarta.servlet.http.HttpServletResponse;
public class CustomNotFoundTarget extends RouteNotFoundError
{
public final MessageSource messageSource;
public CustomNotFoundTarget(MessageSource messageSource)
{
this.messageSource = messageSource;
}
@Override
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter parameter)
{
getElement().setText(messageSource.getMessage("NavigationError"));
return HttpServletResponse.SC_NOT_FOUND;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy