You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Palancher aurélien (JIRA)" <ji...@apache.org> on 2016/04/12 19:54:25 UTC

[jira] [Created] (WICKET-6141) Runtime Exception rendering ComponentTag with RelativePathPrefixHandler

Palancher aurélien created WICKET-6141:
------------------------------------------

             Summary: Runtime Exception rendering ComponentTag with RelativePathPrefixHandler
                 Key: WICKET-6141
                 URL: https://issues.apache.org/jira/browse/WICKET-6141
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 7.2.0
            Reporter: Palancher aurélien
         Attachments: WicketQuickstart2.war

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

I get this exception:
{noformat}
Last cause: The component [TransparentWebMarkupContainer [Component id = wicket_relative_path_prefix_7]] was rendered already
{noformat}

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 :
{noformat}
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);
{noformat}

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








--
This message was sent by Atlassian JIRA
(v6.3.4#6332)