You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by YK <li...@yahoo.fr> on 2011/12/30 21:44:51 UTC
overriding getNamespace won't work
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.
Re: overriding getNamespace won't work
Posted by Martin Grigorov <mg...@apache.org>.
ticket + quickstart please
On Tue, Jan 3, 2012 at 11:05 PM, YK <li...@yahoo.fr> 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
Re: overriding getNamespace won't work
Posted by YK <li...@yahoo.fr>.
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 !
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4258858.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.
Re: overriding getNamespace won't work
Posted by YK <li...@yahoo.fr>.
the only test I found is about changing the default namespace of a
MarkupParser not the whole wicket app
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/overriding-getNamespace-won-t-work-tp4246795p4258756.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.
Re: overriding getNamespace won't work
Posted by Juergen Donnerstag <ju...@gmail.com>.
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 <li...@yahoo.fr> 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.
Re: overriding getNamespace won't work
Posted by YK <li...@yahoo.fr>.
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.
Re: overriding getNamespace won't work
Posted by Martin Grigorov <mg...@apache.org>.
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 <li...@yahoo.fr> 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
Re: overriding getNamespace won't work
Posted by YK <li...@yahoo.fr>.
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.
Re: overriding getNamespace won't work
Posted by Juergen Donnerstag <ju...@gmail.com>.
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 <li...@yahoo.fr> 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.
Re: overriding getNamespace won't work
Posted by YK <li...@yahoo.fr>.
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.
Re: overriding getNamespace won't work
Posted by Martin Grigorov <mg...@apache.org>.
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
<ju...@gmail.com> 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 <li...@yahoo.fr> 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
Re: overriding getNamespace won't work
Posted by Juergen Donnerstag <ju...@gmail.com>.
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 <li...@yahoo.fr> 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.