hudi
hudi

Reputation: 16525

How to hide existing page in wicket

I have web application which have some web pages. Now I want to hide them when some attribute in my configuration will be false. With hide them I mean when someone write web page address there will be status not found. Is this possible in wicket ?

Upvotes: 2

Views: 160

Answers (2)

bert
bert

Reputation: 7696

You can throw an AbortWithHttpErrorCodeException in your page:

public HomePage(final PageParameters parameters) {

   if(someConditionToHidePage) {
      throw new AbortWithHttpErrorCodeException(404, "page not found");
   }
}

Hope that helps

Upvotes: 5

Andrea Del Bene
Andrea Del Bene

Reputation: 2511

I don't think it's possible. You could build a custom Link component that get disabled if the attribute in your configuration it's false.

Upvotes: 0

Related Questions