Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6141

Runtime Exception rendering ComponentTag with RelativePathPrefixHandler

    XMLWordPrintableJSON

Details

    Description

      Sorry for my bad english, this is hard to explain...

      I get this exception:

      Last cause: The component [TransparentWebMarkupContainer [Component id = wicket_relative_path_prefix_7]] was rendered already
      

      I have one base page and two sub-pages which extend my base page
      When the markup contains ComponentTag filtered by RelativePathPrefixHandler (ie no wicket:id and href attribute), the request's counter REQUEST_COUNTER_KEY is incremented.
      This step is fine and my first page is displayed.

      Wicket put the basepage and the first sub-page in cache.

      When i want to render the second page, the REQUEST_COUNTER_KEY restarts to 0 BUT : all RelativePathPrefixHandler ComponentTag of the base page keep the same id, which can be the same that one or more RelativePathPrefixHandler ComponentTag of the second sub-page.

      The exception occurs only when :
      There are RelativePathPrefixHandler ComponentTags in header with <wicket:header-items /> tag or there are RelativePathPrefixHandler ComponentTags in the body of the base page.

      The problem is in MarkupContainer :

      protected boolean renderNext(final MarkupStream markupStream)
      	{
      		// Get the current markup element
      		final MarkupElement element = markupStream.get();
      
      		// If it's a tag like <wicket..> or <span wicket:id="..." >
      		if ((element instanceof ComponentTag) && !markupStream.atCloseTag())
      		{
      			// Get element as tag
      			final ComponentTag tag = (ComponentTag)element;
      
      			// Get component id
      			final String id = tag.getId();
      
      			// Get the component for the id from the given container
      			Component component = get(id);
      

      While rendering the relative Prefix tag in header with wicket:header-items in head, instanceof MarkupContainer is the Page
      While getting the component (get(id)), the id occurs twice and the second tag render the first one

      ( !! this is realy hard to explain.... !!)
      The QuickStart app will show you much better what i'm trying to say.

      Go to the home page, and click to the "Second Page" link

      Attachments

        1. WicketQuickstart2.war
          45 kB
          Palancher aurélien

        Issue Links

          Activity

            People

              Unassigned Unassigned
              darkvadaure Palancher aurélien
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: