Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
From the error message it seems there is no PersonXmlRestService.html around. Please describe how wicket-rest actually works. On Thu, Jun 16, 2011 at 1:55 AM, gerar gerardp...@gmail.com wrote: Hi, I've tried to port http://wicket-rest.googlecode.com/svn to Wicket 1.5-RC4.2. That took some minor changes like the package that PageParameters is in, the way the HttpServletRequest is fetched and the onRender methods. All compiles well. However, when I make a request in a browser for a URL like http://localhost:8080/wicket-rest-example/person-api/xml;, I get errors like this one: org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup. Component is not yet connected to a parent. [Page class = org.innobuilt.wicket.rest.example.pages.PersonXmlRestService, id = 2, render count = 1] When using Wicket 1.4.x, that all works fine. Does anyone have an idea what is going on? Cheers, Gerar -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3600779.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
Details: The PersonXmlRestService.html is an example that comes with the wicket-rest library. It is a subclass of XmlWebServicePage which in turn is based on AbstractWebServicePage. Class AbstractWebServicePage has a method: @Override public final boolean hasAssociatedMarkup() { return false; } to indicate that no HTML is associated. All output generated by pages based on these superclasses is as is. No HTML but XML (or Json) is produced. It seems that this is ignored. and in the XmlWebServicePage there's a method @Override public final MarkupType getMarkupType() { return new MarkupType(xml, text/xml); } @Override protected final void onRender() { getResponse().write(getXML().toString()); } which generates the actual output (without any HTML file). I've attached sources as well. You can run it by unzipping followed by: cd wicket-rest-trunk mvn clean install cd wicket-rest-example mvn jetty:run then request http://localhost:8080/wicket-rest-example/person-api/xml; in a browser. http://apache-wicket.1842946.n4.nabble.com/file/n3602257/wicket-rest-wicket15rc42.zip wicket-rest-wicket15rc42.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602257.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
On Thu, Jun 16, 2011 at 3:16 PM, gerar gerardp...@gmail.com wrote: Details: The PersonXmlRestService.html is an example that comes with the wicket-rest library. It is a subclass of XmlWebServicePage which in turn is based on AbstractWebServicePage. Class AbstractWebServicePage has a method: @Override public final boolean hasAssociatedMarkup() { return false; } Instead of overriding this you can try with implementing IMarkupResourceStreamProvider and return new StringResourceStream() I think it should work now. to indicate that no HTML is associated. All output generated by pages based on these superclasses is as is. No HTML but XML (or Json) is produced. It seems that this is ignored. and in the XmlWebServicePage there's a method @Override public final MarkupType getMarkupType() { return new MarkupType(xml, text/xml); } @Override protected final void onRender() { getResponse().write(getXML().toString()); } which generates the actual output (without any HTML file). I've attached sources as well. You can run it by unzipping followed by: cd wicket-rest-trunk mvn clean install cd wicket-rest-example mvn jetty:run then request http://localhost:8080/wicket-rest-example/person-api/xml; in a browser. http://apache-wicket.1842946.n4.nabble.com/file/n3602257/wicket-rest-wicket15rc42.zip wicket-rest-wicket15rc42.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602257.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
Thanks for the very quick answer. However, now another error message appears. The superclass now looks like this: public abstract class AbstractWebServicePage extends WebPage implements IMarkupResourceStreamProvider { // Removed hasAssociatedMarkup method and added: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { return new StringResourceStream(); } This error appears when requesting the page in a browser: Root cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at java.util.Collections$UnmodifiableList.get(Collections.java:1154) at org.apache.wicket.markup.Markup.get(Markup.java:109) at org.apache.wicket.Component.internalRender(Component.java:2371) at org.apache.wicket.Component.render(Component.java:2322) at org.apache.wicket.Page.renderPage(Page.java:1120) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:218) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:718) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:138) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1112) . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602317.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
One more replace: @Override protected final void onRender() { getResponse().write(getXML().toString()); } with @Override public void renderPage() { getResponse().write(getXML().toString()); } On Thu, Jun 16, 2011 at 3:39 PM, gerar gerardp...@gmail.com wrote: Thanks for the very quick answer. However, now another error message appears. The superclass now looks like this: public abstract class AbstractWebServicePage extends WebPage implements IMarkupResourceStreamProvider { // Removed hasAssociatedMarkup method and added: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { return new StringResourceStream(); } This error appears when requesting the page in a browser: Root cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at java.util.Collections$UnmodifiableList.get(Collections.java:1154) at org.apache.wicket.markup.Markup.get(Markup.java:109) at org.apache.wicket.Component.internalRender(Component.java:2371) at org.apache.wicket.Component.render(Component.java:2322) at org.apache.wicket.Page.renderPage(Page.java:1120) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:218) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:718) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:138) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1112) . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602317.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
I forked the project wicket-rest from googlecode to wicketstuff-sandbox. Gerard, you can now ask for commit access at wicketstuff, or just fork it from there and then push a patch. https://github.com/wicketstuff/sandbox/tree/master/wicket-rest Thanks again for showing interest in this project. Cheers *Bruno Borges* www.brunoborges.com.br +55 21 76727099 On Thu, Jun 16, 2011 at 9:42 AM, Martin Grigorov mgrigo...@apache.orgwrote: One more replace: @Override protected final void onRender() { getResponse().write(getXML().toString()); } with @Override public void renderPage() { getResponse().write(getXML().toString()); } On Thu, Jun 16, 2011 at 3:39 PM, gerar gerardp...@gmail.com wrote: Thanks for the very quick answer. However, now another error message appears. The superclass now looks like this: public abstract class AbstractWebServicePage extends WebPage implements IMarkupResourceStreamProvider { // Removed hasAssociatedMarkup method and added: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { return new StringResourceStream(); } This error appears when requesting the page in a browser: Root cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at java.util.Collections$UnmodifiableList.get(Collections.java:1154) at org.apache.wicket.markup.Markup.get(Markup.java:109) at org.apache.wicket.Component.internalRender(Component.java:2371) at org.apache.wicket.Component.render(Component.java:2322) at org.apache.wicket.Page.renderPage(Page.java:1120) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:218) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:718) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:138) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1112) . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602317.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
Hello, Once the wicket-rest project works it would be better placed into the wicketstuff/core repository as no snapshots or releases are done using sandbox code. But they come for free if you contribute into the wicketstuff/core repository. Mike I forked the project wicket-rest from googlecode to wicketstuff-sandbox. Gerard, you can now ask for commit access at wicketstuff, or just fork it from there and then push a patch. https://github.com/wicketstuff/sandbox/tree/master/wicket-rest Thanks again for showing interest in this project. Cheers *Bruno Borges* www.brunoborges.com.br +55 21 76727099 On Thu, Jun 16, 2011 at 9:42 AM, Martin Grigorovmgrigo...@apache.orgwrote: One more replace: @Override protected final void onRender() { getResponse().write(getXML().toString()); } with @Override public void renderPage() { getResponse().write(getXML().toString()); } On Thu, Jun 16, 2011 at 3:39 PM, gerargerardp...@gmail.com wrote: Thanks for the very quick answer. However, now another error message appears. The superclass now looks like this: public abstract class AbstractWebServicePage extends WebPage implements IMarkupResourceStreamProvider { // Removed hasAssociatedMarkup method and added: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { return new StringResourceStream(); } This error appears when requesting the page in a browser: Root cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at java.util.Collections$UnmodifiableList.get(Collections.java:1154) at org.apache.wicket.markup.Markup.get(Markup.java:109) at org.apache.wicket.Component.internalRender(Component.java:2371) at org.apache.wicket.Component.render(Component.java:2322) at org.apache.wicket.Page.renderPage(Page.java:1120) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:218) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:718) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:138) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1112) . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602317.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
Hi, Maybe the cause of the problem is to be found elsewhere. I created a simple test page. Code is below. It produces the HTML itself without an HTML file, just like the pages that use wicket-rest baseclasses. 1) The code below runs just fine, but neither onInitialize nor onBeforeRender are ever run. Why is that? 2) Why doesn't implementation of hasAssociatedMarkup work for this example? Please find the code for the testpage below. Cheers, Gerard package org.innobuilt.wicket.rest.example.pages; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.IMarkupResourceStreamProvider; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.StringResourceStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TestPage extends WebPage implements IMarkupResourceStreamProvider { private static final Logger LOG = LoggerFactory.getLogger(TestPage.class); @Override protected void onInitialize() { super.onInitialize(); LOG.info(onInitialize); } @Override protected void onBeforeRender() { super.onInitialize(); LOG.info(onBeforeRender); } @Override public void renderPage() { LOG.info(renderPage); getResponse().write(htmlbodyhello/body/html); } public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { LOG.info(getMarkupResourceStream); return new StringResourceStream(); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602838.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
I forgot to say that implementing @Override public void renderPage() { getResponse().write(getXML().toString()); } and public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { return new StringResourceStream(); } still didn't solve the problem since onBeforeRender and/or onInitialize are not called. That is the place in wicket-rest where the payload data is prepared depending on the HTTP method. Cheers, Gerard -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602855.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup
Bruno, Thanks. Once I have the details right, I'll dive into this. Cheers, Gerard 2011/6/16 Bruno Borges bruno.bor...@gmail.com I forked the project wicket-rest from googlecode to wicketstuff-sandbox. Gerard, you can now ask for commit access at wicketstuff, or just fork it from there and then push a patch. https://github.com/wicketstuff/sandbox/tree/master/wicket-rest Thanks again for showing interest in this project. Cheers *Bruno Borges* www.brunoborges.com.br +55 21 76727099 On Thu, Jun 16, 2011 at 9:42 AM, Martin Grigorov mgrigo...@apache.org wrote: One more replace: @Override protected final void onRender() { getResponse().write(getXML().toString()); } with @Override public void renderPage() { getResponse().write(getXML().toString()); } On Thu, Jun 16, 2011 at 3:39 PM, gerar gerardp...@gmail.com wrote: Thanks for the very quick answer. However, now another error message appears. The superclass now looks like this: public abstract class AbstractWebServicePage extends WebPage implements IMarkupResourceStreamProvider { // Removed hasAssociatedMarkup method and added: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class? containerClass) { return new StringResourceStream(); } This error appears when requesting the page in a browser: Root cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at java.util.Collections$UnmodifiableList.get(Collections.java:1154) at org.apache.wicket.markup.Markup.get(Markup.java:109) at org.apache.wicket.Component.internalRender(Component.java:2371) at org.apache.wicket.Component.render(Component.java:2322) at org.apache.wicket.Page.renderPage(Page.java:1120) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:218) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:718) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:138) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1112) . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3602317.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org