|
This post was updated on .
hi,
I'm playing with wicket 1.5.3 and I discovered that overriding getNamespace method does not work! In my Application, I overrode the newMapperContext method to define a new IMapperContext but my app won't work: org.apache.wicket.WicketRuntimeException: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered).1. [FeedbackPanel [Component id = feedback]]2. [BookmarkablePageLink [Component id = contactListPageLink]] at org.apache.wicket.Page.checkRendering(Page.java:693) at org.apache.wicket.Page.onAfterRender(Page.java:843) at org.apache.wicket.markup.html.WebPage.onAfterRender(WebPage.java:213) at org.apache.wicket.Component.afterRender(Component.java:950) at org.apache.wicket.Component.render(Component.java:2287) at org.apache.wicket.Page.renderPage(Page.java:1035) thx! |
|
I don't think it has changed in 1.5 compared to 1.4, but feel free to
open a jira ticket and attach a quickstart -Juergen On Fri, Dec 30, 2011 at 9:44 PM, YK <[hidden email]> wrote: > hi, > > I'm playing with wicket 1.5.3 and I discovered that overriding getNamespace > method does not work! > > In my Application, I overrode the newMapperContext method to define a new > IMapperContext but my app won't work: > > > > -- > View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4246795.html > Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com. |
|
Hi,
IMapperContext is a new class introduced in 1.5. We have unit tests that the namespace is actually in use. This namespace is for the Urls : default - /wicket/bookmarkable/com.example.MyPage custom - /mynamespace/bookmarkable/com.example.MyPage I guess you expect different behavior from it - to be able to replace the wicket: namespace in the markup. For this you need org.apache.wicket.markup.MarkupResourceStream#getWicketNamespace() On Fri, Dec 30, 2011 at 10:55 PM, Juergen Donnerstag <[hidden email]> wrote: > I don't think it has changed in 1.5 compared to 1.4, but feel free to > open a jira ticket and attach a quickstart > > -Juergen > > On Fri, Dec 30, 2011 at 9:44 PM, YK <[hidden email]> wrote: >> hi, >> >> I'm playing with wicket 1.5.3 and I discovered that overriding getNamespace >> method does not work! >> >> In my Application, I overrode the newMapperContext method to define a new >> IMapperContext but my app won't work: >> >> >> >> -- >> View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4246795.html >> Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com. -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com |
|
Hi,
That's right. I'm trying to use another prefix than 'wicket' for my xhtml components. Thanks for the hint! By the way, is the following the right way to override the org.apache.wicket.markup.MarkupResourceStream#getWicketNamespace() method ? public class MyWicketApplication extends WebApplication { /** Overrode methods */ @Override public void init() { getMarkupSettings().getMarkupFactory().newMarkupParser(new MyNewMarkupResourceStream());// } ... } Thanks again, |
|
please see MarkupParserTest.java. The following is a partial copy:
@Test public void tagParsing() throws Exception { final MarkupParser parser = new MarkupParser( "This is a test <a componentName:id=\"a\" href=\"foo.html\"> <b componentName:id=\"b\">Bold!</b> " + "<img componentName:id=\"img\" width=9 height=10 src=\"foo\"> <marker componentName:id=\"marker\"/> </a>"); parser.setWicketNamespace("componentName"); ... @Test public void fileDocument() throws ParseException, ResourceStreamNotFoundException, IOException { IResourceStreamLocator locator = new ResourceStreamLocator(); MarkupResourceStream resource = newMarkupResourceStream(locator, getClass(), "1", null, null, "html"); MarkupParser parser = new MarkupParser(resource); parser.setWicketNamespace("wcn"); IMarkupFragment tokens = parser.parse(); ... -Juergen On Sat, Dec 31, 2011 at 10:05 AM, YK <[hidden email]> wrote: > Hi, > > > That's right. I'm trying to use another prefix than 'wicket' for my xhtml > components. > > Thanks for the hint! > > By the way, is the following the right way to override the > org.apache.wicket.markup.MarkupResourceStream#getWicketNamespace() method ? > > public class MyWicketApplication extends WebApplication { > > /** Overrode methods */ > @Override > public void init() { > getMarkupSettings().getMarkupFactory().newMarkupParser(new > MyNewMarkupResourceStream());// > } > ... > } > > Thanks again, > > > -- > View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4247940.html > Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com. |
|
Ok. How to define a custom MarkupParser now?!! I can't find anything helpfull except this link: adding-a-markup-filter.html
I tried this: public class MyApplication extends Application { protected void init() { ... getMarkupSettings().setMarkupParserFactory( new MyMarkupParserFactory()); ... } } public class MyMarkupParserFactory implements IMarkupParserFactory { @Override public MarkupParser newMarkupParser(MarkupResourceStream resource) { MarkupParser parser = new MarkupParser(new XmlPullParser(), resource); parser.setWicketNamespace("abc");//my new namespace return parser; } } but this does not work! |
|
Hi,
This is the way. Try additionally to set the namespace on the MarkupResourceStream directly. On Sun, Jan 1, 2012 at 11:36 AM, YK <[hidden email]> wrote: > Ok. How to define a custom MarkupParser now?!! I can't find anything helpfull > except this link: > https://cwiki.apache.org/WICKET/adding-a-markup-filter.html > adding-a-markup-filter.html > > I tried this: > public class MyApplication extends Application > { > protected void init() > { > ... > getMarkupSettings().setMarkupParserFactory( > new MyMarkupParserFactory()); > ... > } > } > > public class MyMarkupParserFactory implements IMarkupParserFactory { > > @Override > public MarkupParser newMarkupParser(MarkupResourceStream resource) { > MarkupParser parser = new MarkupParser(new XmlPullParser(), > resource); > parser.setWicketNamespace("abc");//my new namespace > return parser; > } > } > > but this does not work! > > > -- > View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4250347.html > Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com. -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com |
|
Hi,
sorry this does not work... I suspect it's feasable now thanks anyway |
|
ticket + quickstart please
On Tue, Jan 3, 2012 at 11:05 PM, YK <[hidden email]> wrote: > Hi, > > sorry this does not work... > > I suspect it's feasable now > > thanks anyway > > -- > View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4258593.html > Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com. -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com |
|
In reply to this post by YK
There are working examples in our test suite. Please have a look
their. They exist since the first days of Wicket. Juergen On Tue, Jan 3, 2012 at 10:05 PM, YK <[hidden email]> wrote: > Hi, > > sorry this does not work... > > I suspect it's feasable now > > thanks anyway > > -- > View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4258593.html > Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com. |
|
the only test I found is about changing the default namespace of a MarkupParser not the whole wicket app
|
|
I finally figured out the root of the troubles I'm running into...
I removed the wicket namespace declaration (xmlns:wicket="http://wicket.apache.org" ) and it worked ! thx ! |
| Powered by Nabble | Edit this page |
