Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public class PageNotFound extends WebPage {

	private static final long serialVersionUID = 1L;

	public PageNotFound() {
		// Add any necessary components
	}

	@Override
	protected void configureResponse() {
		super.configureResponse();
		getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_FOUND);
	}

	@Override
	public boolean isVersioned() {
		return false;
	}

	@Override
	public boolean isErrorPage() {
		return true;
	}

}

An HTTP error can be thrown manually by:

Code Block

// also see AbortWithWebErrorCodeException and AbortWithHttpStatusException
throw new AbortWithHttpStatusException(404, true);

Overriding All Error Pages for RuntimeException

...