wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: Writing to header causes 'not yet working' code to be executed
Date Mon, 02 Apr 2012 06:57:40 GMT
Hi,

Can you create a quickstart ?
There is a special IMarkupFilter that creates <head> automatically if you
don't have one in your page markup. For some reason it seems it didn't work.

On Sun, Apr 1, 2012 at 11:16 PM, Chris Colman
<chrisc@stepaheadsoftware.com>wrote:

> ** **
>
> I’ve overridden renderHead to write to the header of the page but I get a
> strange error message that I have not been able to work out. It executes
> some code that has a ‘not implemented’ comment:****
>
> ** **
>
> The code is in WebPage:****
>
> ** **
>
>             /******
>
>              * Validate that each component which wanted to contribute to
> the header section actually was****
>
>              * able to do so.****
>
>              */****
>
>             private void validateHeaders()****
>
>             {****
>
>                         // search for HtmlHeaderContainer in the first
> level of children or deeper****
>
>                         // if there are transparent resolvers used****
>
>                         HtmlHeaderContainer header = visitChildren(new
> IVisitor<Component, HtmlHeaderContainer>()****
>
>                         {****
>
>                                     public void component(final Component
> component, final IVisit<HtmlHeaderContainer> visit)****
>
>                                     {****
>
>                                                 if (component instanceof
> HtmlHeaderContainer)****
>
>                                                 {****
>
>                                                             visit.stop((
> HtmlHeaderContainer)component);****
>
>                                                 }****
>
>                                                 else if (component
> instanceof TransparentWebMarkupContainer == false)****
>
>                                                 {****
>
>
> visit.dontGoDeeper();****
>
>                                                 }****
>
>                                     }****
>
>                         });****
>
> ** **
>
>                         if (header == null)****
>
>                         {****
>
>                                     // the markup must at least contain a
> <body> tag for wicket to automatically****
>
>                                     // create a HtmlHeaderContainer. Log
> an error if no header container****
>
>                                     // was created but any of the
> components or behaviors want to contribute****
>
>                                     // something to the header.****
>
>                                     header = new HtmlHeaderContainer(
> HtmlHeaderSectionHandler.HEADER_ID);****
>
>                                     add(header);****
>
> ** **
>
>                                     Response orgResponse = getRequestCycle
> ().getResponse();****
>
>                                     try****
>
>                                     {****
>
>                                                 final StringResponseresponse = new
> StringResponse();****
>
>                                                 getRequestCycle().
> setResponse(response);****
>
> ** **
>
>                                                 // Render all header
> sections of all components on the page****
>
>
> AbstractHeaderRenderStrategy.get().renderHeader(header, getPage());****
>
>                                                 response.close();****
>
> ** **
>
>                                                 if (response.getBuffer().length()
> > 0)****
>
>                                                 {****
>
>                                                             // @TODO it
> is not yet working properly. JDo to fix it****
>
>                                                             log.error(
> "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
> ****
>
>                                                             log.error("You
> probably forgot to add a <body> or <head> tag to your markup since no
> Header Container was \n" +****
>
>                                                                         "
> found but components were found which want to write to the <head>
> section.\n" +****
>
>
> response.getBuffer());****
>
>                                                             log.error(
> "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
> ****
>
>                                                 }****
>
>                                     }****
>
>                                     catch (Exception e)****
>
>                                     {****
>
>                                                 // just swallow this
> exception, there isn't much we can do about.****
>
>                                                 log.error("header/body
> check throws exception", e);****
>
>                                     }****
>
>                                     finally****
>
>                                     {****
>
>                                                 this.remove(header);****
>
>                                                 getRequestCycle().
> setResponse(orgResponse);****
>
>                                     }****
>
>                         }****
>
>             }****
>
> ** **
>
> Yours sincerely,****
>
> ** **
>
> Chris Colman****
>
>  ****
>
> Pagebloom Team Leader,****
>
> Step Ahead Software
>
> ****
>
> pagebloom - your business & your website growing together****
>
> ** **
>
> **Sydney**: (+61 2) 9656 1278     ****Canberra****: (+61 2) 6100 2120
> ****
>
> Email: chrisc@stepahead.com.au <//chrisc@stepahead.com.au>****
>
> Website:****
>
> http://www.pagebloom.com****
>
> http://develop.stepaheadsoftware.com****
>
>  ****
>
> ** **
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

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