Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64736979F for ; Sun, 1 Apr 2012 21:17:32 +0000 (UTC) Received: (qmail 50960 invoked by uid 500); 1 Apr 2012 21:17:31 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 50927 invoked by uid 500); 1 Apr 2012 21:17:31 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 50919 invoked by uid 99); 1 Apr 2012 21:17:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Apr 2012 21:17:31 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of chrisc@stepaheadsoftware.com designates 122.148.34.68 as permitted sender) Received: from [122.148.34.68] (HELO stepaheadsoftware.com) (122.148.34.68) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Apr 2012 21:17:26 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/related; type="multipart/alternative"; boundary="----_=_NextPart_001_01CD104C.C534F7B3" X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Writing to header causes 'not yet working' code to be executed Date: Mon, 2 Apr 2012 07:16:56 +1000 Message-ID: X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: Writing to header causes 'not yet working' code to be executed thread-index: Ac0QTMVVWpmf3hVlSpC8DhQxoyyruQ== From: "Chris Colman" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01CD104C.C534F7B3 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01CD104C.C534F7B3" ------_=_NextPart_002_01CD104C.C534F7B3 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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: =20 The code is in WebPage: =20 /** * 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 =3D visitChildren(new IVisitor() { public void component(final Component component, final IVisit visit) { if (component instanceof HtmlHeaderContainer) { =20 visit.stop((HtmlHeaderContainer)component); } else if (component instanceof TransparentWebMarkupContainer =3D=3D false) { =20 visit.dontGoDeeper(); } } }); =20 if (header =3D=3D null) { // the markup must at least contain a 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 =3D new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID); add(header); =20 Response orgResponse =3D getRequestCycle().getResponse(); try { final StringResponse response =3D new StringResponse(); =20 getRequestCycle().setResponse(response); =20 // Render all header sections of all components on the page =20 AbstractHeaderRenderStrategy.get().renderHeader(header, getPage()); response.close(); =20 if (response.getBuffer().length() > 0) { // @TODO it is not yet working properly. JDo to fix it =20 log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); =20 log.error("You probably forgot to add a or tag to your markup since no Header Container was \n" + =20 "found but components were found which want to write to the section.\n" + =20 response.getBuffer()); =20 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); =20 getRequestCycle().setResponse(orgResponse); } } } =20 Yours sincerely, =20 Chris Colman =20 Pagebloom Team Leader, Step Ahead Software =20 pagebloom - your business & your website growing together =20 Sydney: (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120 =20 Email: chrisc@stepahead.com.au =20 Website: http://www.pagebloom.com =20 http://develop.stepaheadsoftware.com =20 =20 =20 ------_=_NextPart_002_01CD104C.C534F7B3 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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 =3D visitChildren(new = IVisitor<Component, HtmlHeaderContainer>()<= /p>

        = ;            =     {

        = ;            =             &= nbsp;   public void component(final Component component, final IVisit<HtmlHeaderContainer> visit)

        = ;            =             &= nbsp;   {

        = ;            =             &= nbsp;           &n= bsp;   if (component instanceof HtmlHeaderContainer)

        = ;            =             &= nbsp;           &n= bsp;   {

        = ;            =             &= nbsp;           &n= bsp;           &nb= sp;   visit.stop((HtmlHeaderContainer)component);

        = ;            =             &= nbsp;           &n= bsp;   }

        = ;            =             &= nbsp;           &n= bsp;   else if (component instanceof TransparentWebMarkupContainer =3D=3D = false)

        = ;            =             &= nbsp;           &n= bsp;   {

        = ;            =             &= nbsp;           &n= bsp;           &nb= sp;   visit.dontGoDeeper();

        = ;            =             &= nbsp;           &n= bsp;   }

        = ;            =             &= nbsp;   }

        = ;            =     });

 

        = ;            =     if (header =3D=3D = null)

        = ;            =     {

        = ;            =             &= nbsp;   // the markup must at least contain a <body> tag for wicket to = automatically

        = ;            =             &= nbsp;   // create a HtmlHeaderContainer. Log an error if no header container

        = ;            =             &= nbsp;   // was created but any of the components or behaviors want to = contribute

        = ;            =             &= nbsp;   // something to the header.

        = ;            =             &= nbsp;   header =3D new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID);

        = ;            =             &= nbsp;   add(header);

 

        = ;            =             &= nbsp;   Response orgResponse =3D getRequestCycle().getResponse();

        = ;            =             &= nbsp;   try

        = ;            =             &= nbsp;   {

        = ;            =             &= nbsp;           &n= bsp;   final StringResponse = response =3D new StringResponse();

        = ;            =             &= nbsp;           &n= bsp;   getRequestCycle().setResponse(response);

=

 

        = ;            =             &= nbsp;           &n= bsp;   // Render all header sections of all components on the = page

        = ;            =             &= nbsp;           &n= bsp;   AbstractHeaderRenderStrategy.get().renderHeader(header, = getPage());

        = ;            =             &= nbsp;           &n= bsp;   response.close();

 

        = ;            =             &= nbsp;           &n= bsp;   if (response.getBuffer().length() > 0)

        = ;            =             &= nbsp;           &n= bsp;   {

        = ;            =             &= nbsp;           &n= bsp;           &nb= sp;   // @TODO it is not yet working properly. JDo to = fix it

        = ;            =             &= nbsp;           &n= bsp;           = ;    log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");

        = ;            =             &= nbsp;           &n= bsp;           &nb= sp;   log.error("You probably forgot to add a <body> or <head> tag to your markup = since no Header Container was \n" +

        = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;   "found but components were found which want to write = to the <head> section.\n" +

        = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;   response.getBuffer());

        = ;            =             &= nbsp;           &n= bsp;           = ;    log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");

        = ;            =             &= nbsp;           &n= bsp;   }

        = ;            =             &= nbsp;   }

        = ;            =             &= nbsp;   catch (Exception e)

        = ;            =             &= nbsp;   {

        = ;            =             &= nbsp;           &n= bsp;   // just swallow this exception, there isn't much = we can do about.

        = ;            =             &= nbsp;           &n= bsp;   log.error("header/body check throws exception", e);

        = ;            =             &= nbsp;   }

        = ;            =             &= nbsp;   finally

        = ;            =             &= nbsp;   {

        = ;            =             &= nbsp;           &n= bsp;   this.remove(header);

        = ;            =             &= nbsp;           &n= bsp;   getRequestCycle().setResponse(orgResponse);

        = ;            =             &= nbsp;   }

        = ;            =     }

        = ;    }

 

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=

Website:<= /font>

http://www.pagebloom.com

http://develop.s= tepaheadsoftware.com

 

 

------_=_NextPart_002_01CD104C.C534F7B3-- ------_=_NextPart_001_01CD104C.C534F7B3--