so strange ...
i put log in getString method (and in onResourceRequested of the
DocumentInlineFrame).
they are never called and my panel is filled with random xml.
i also log the database request and the response (before calling new
OdyReqTargetPanel) : they are correct 

public class OdyReqTargetPanel extends Panel {
        private static final long serialVersionUID = 1L;
        private static final Logger log =
LoggerFactory.getLogger(OrdersPage.class.getName());

        public OdyReqTargetPanel(String id,final byte[] res) {
                super(id);
        //setRenderBodyOnly(true);
        add(new DocumentInlineFrame("myxml",  new ResourceStreamResource(new
AbstractStringResourceStream("text/xml") {
                        @Override
                        protected String getString() {
                                log.debug("ResourceStreamResource = ["+new 
String(res)+"]");
                                return new String(res);
                        }
                }))); 
        }
}

public class DocumentInlineFrame extends WebMarkupContainer implements
IResourceListener
{
        private static final long serialVersionUID = 1L;

        private static final Logger log =
LoggerFactory.getLogger(OrdersPage.class.getName());

        private IResource documentResource;

        /**
         *
         * Constructor receiving an IResourceStream.
         *
         * @param id
         * @param stream
         */
        public DocumentInlineFrame(String id, IResourceStream stream) {
                this(id, new ResourceStreamResource(stream));
        }

        /**
         * Constructor receiving an IResource..
         *
         * @param id
         * @param resourceListener
         */
        public DocumentInlineFrame(final String id, IResource documentResource)
        {
                super(id);
                this.documentResource = documentResource;
        }

        /**
         * Gets the url to use for this link.
         *
         * @return The URL that this link links to
         */
        protected CharSequence getURL()
        {
                return urlFor(IResourceListener.INTERFACE, null);
        }

        /**
         * Handles this frame's tag.
         *
         * @param tag
         * the component tag
         * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
         */
        @Override
        protected final void onComponentTag(final ComponentTag tag)
        {
                checkComponentTag(tag, "iframe");

                // Set href to link to this frame's frameRequested method
                CharSequence url = getURL();

                // generate the src attribute
                tag.put("src", Strings.replaceAll(url, "&", "&"));

                super.onComponentTag(tag);
        }



        @Override
        protected boolean getStatelessHint()
        {       
                return false;
        }

        public void onResourceRequested() {
                log.debug("onResourceRequested = ["+this.documentResource+"]");
                RequestCycle requestCycle = RequestCycle.get();
                Attributes attributes = new 
Attributes(requestCycle.getRequest(),
requestCycle.getResponse(), null);
                this.documentResource.respond(attributes);
        }
}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527p4664537.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

Reply via email to