wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: How to mount 404 page with Wicket and Servlet 3.0?
Date Tue, 13 Feb 2018 10:05:03 GMT
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.pasko@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
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message