Here is the final solution to the problem, it's working fine, and it's much more elegant, then the first one. ;)

public class MetaHeaderContributor extends HeaderContributor {

   public MetaHeaderContributor(IHeaderContributor headerContributor) {
       super(headerContributor);
   }

   public static final MetaHeaderContributor forMeta(final Class scope) {

       return new MetaHeaderContributor(new IHeaderContributor() {

           private static final long serialVersionUID = 1L;

           public void renderHead(IHeaderResponse response) {
response.renderString("<META http-equiv=\"refresh\" content=\"5;URL=" +
                       RequestCycle.get().urlFor(scope, null) + "\">");
//In case I wanted to redirect to a Page with PageParameters, //I would only have to change this null parameter to a forMeta parameter and add an "if" to check whether the param is null or not..
           }
       });
   }
}

Thanks for your help.

Regards,
Peter

Jeremy Thomerson írta:
Write your own header contributor that takes a model as a parameter and
generates the meta tag for you.  See the JS and CSS header contributors for
inspiration.

Hint: if you're generating links to within your app, you could also take a
Class and PageParmeters rather than a model and generate the URL from those.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Mar 11, 2009 at 5:38 PM, Major Péter <[email protected]> wrote:

Thanks for the quick response.

I modified the html code like this:
<html xmlns:wicket>
  <wicket:head>
      <title>title</title>
      <META http-equiv="refresh" content="5;URL=http://linktosomewhere";>
  </wicket:head>
  <body>
     <wicket:extend>blah blah</wicket:extend>
  </body>
</html>

It works fine, but now the URL is burned into the html. Is there a way to
make the link some way to depends on a Model?
//It would be just a prettier solution to the problem.

Thanks,
Peter

Jeremy Thomerson írta:

 Just output a meta tag in your custom page that tells the browser to go to
a
different URL after 5 seconds.

--
Jeremy Thomerson
http://www.wickettraining.com


On Wed, Mar 11, 2009 at 5:20 PM, Major Péter <[email protected]>
wrote:



Hi all,

I would like to create a custom PageExpired ErrorPage, which contains
some
message and after 5 secs it redirects to the Homepage. I found
RedirectPage
to solve this, but when I extend it, it won't contain the design elements
which are now in a custom WebPage class. I could make on the same
principal
a custom RedirectPageTemplate, but then it would be just
code-duplicating...
 That's why I tried to open the original RedirectPage class and copied
the
contents of it, but it doesn't want to work.
Can someone help me? What am I doing wrong?
//Or is there other way to solve the problem?
//Does it need other modifications in other files?

The Java code is:
public final class PageExpiredError extends CustomWebPage {

 public PageExpiredError() {
     super();
     final WebMarkupContainer redirect = new
WebMarkupContainer("redirect");
     final String content = 5 + ";URL=" + new
GroupHierarchy().urlFor(IRedirectListener.INTERFACE);
     redirect.add(new AttributeModifier("content", new Model(content)));
     add(redirect);
 }
}

If I'm using the setRedirect(true); command, Firefox gives me a Redirect
Loop Error..

I don't think the html code is relevant in this case.
Thanks.

Best Regards,
Peter Major

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to