Hi,

In a plain Spring Boot application (without Wicket-SpringBoot) you can do
it with ErrorPageRegistrar:

import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.boot.web.servlet.ErrorPageRegistrar;
import org.springframework.boot.web.servlet.ErrorPageRegistry;
import org.springframework.http.HttpStatus;

public class MyErrorPageRegistrar implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(final ErrorPageRegistry registry) {
        registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND,
MyApplication.PAGE_NOT_FOUND_MOUNT_PATH));
    }
}

In MySpringContext.java:

 @Bean
    public ErrorPageRegistrar errorPageRegistrar(){
        return new MyErrorPageRegistrar();
    }


In MyApplication.java:
mountPage(PAGE_NOT_FOUND_MOUNT_PATH, Error404Page.class);


Martin Grigorov
Wicket Training and Consulting
Looking for a remote position with Wicket ? Contact me!
https://twitter.com/mtgrigorov


On Mon, Feb 12, 2018 at 5:42 PM, Kamil Paśko <kamil.pa...@solsoft.pl> wrote:

> Hi,
>
> *Background:*
>
> I'm trying to mount 404 page to my Wicket project.
>
> I found confluence page wchich explains how to do it using web.xml (
> https://cwiki.apache.org/confluence/display/WICKET/Error+
> Pages+and+Feedback+Messages#ErrorPagesandFeedbackMessages-HTTPErrorPages)
> but my application uses Wicket-SpringBoot (https://github.com/MarcGiffin
> g/wicket-spring-boot), so instead of web.xml there is Servlet 3.0
> configuration somewhere.
>
> *Question:*
>
> Does anybody have an idea how to mount 404 page using Wicket +
> Wicket-SpringBoot + Servlet 3.0?
>
>
> Thank you in advance,
>
> Kamil
>
>
>

Reply via email to