Add noise to the URL of ResourceLink component
hi, i want to add noise to the url of a ResourceLink component (to avoid browser caching problem) ... i looked at Image#addAntiCacheParameter and try to put it in onComponentTag of my ResourceLink @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String url = tag.getAttributes().getString(src); log.debug(URL = +url); url = url + (url.contains(?) ? : ?); url = url + antiCache= + System.currentTimeMillis(); tag.put(src, url); } but it doesn't work and in my log, url is null ... Does anybody know how to do this ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870.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: Add noise to the URL of ResourceLink component
thanks, i modify my onComponentTag @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String url = tag.getAttributes().getString(href); log.debug(URL = +url); url = url + antiCache= + System.currentTimeMillis(); tag.put(href, url); log.debug(URL modify = +tag.getAttributes().getString(href)); } my output is : URL = # URL modify = #antiCache=1394463265258 but my url in my browser (opened by the resourceLink) is not modified (anticache param isn't visible) ... and the content is not the good one ... (if i clear my browser cache and click on the link, the content is OK). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664874.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: Add noise to the URL of ResourceLink component
yes i'm using popupSettings final String mime=application/xml; ByteArrayResource res = new ByteArrayResource(mime,dSOBean.getOrder()); ResourceLinkByteArrayResource resourceL= new ResourceLinkByteArrayResource(myF, res) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String url = tag.getAttributes().getString(href); log.debug(URL = +url); url = url + antiCache= + System.currentTimeMillis(); tag.put(href, url); log.debug(URL = +tag.getAttributes().getString(href)); } }; PopupSettings popupSettings = new PopupSettings( PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS).setHeight(600).setWidth(1000); resourceLink.setPopupSettings(popupSettings); listItem.add(resourceLink); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664877.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: Add noise to the URL of ResourceLink component
unfortunately getUrl is : protected final CharSequence getURL() -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664879.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: Add noise to the URL of ResourceLink component
finally, it works with Sven's solution but tag html has to be as i can see in the link class (initially it was button in my html). I create a ResourceLinkWithAnticache like this : public class ResourceLinkWithAnticacheT extends ResourceLinkT { public ResourceLinkWithAnticache(String id, IResource resource) { super(id, resource); } private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); String url = tag.getAttributes().getString(href); url = url + antiCache= + System.currentTimeMillis(); tag.put(href, url); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664884.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
display XML in a popup (or another window) wicket 6.9.1
hi, i want to display an xml string like with a ResourceLink but i want this xml string to be uploaded from the database when i click on the link. before wicket 6.9.1 i used the DocumentInlineFrame from Ernesto Reinaldo Barreiro and it works fine in a popup with a button ... but with 6.9.1, i cant make it work. Can someone help me ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527.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: display XML in a popup (or another window) wicket 6.9.1
in wicket 1.4, i used an IndicatingAjaxLink and in onClick method, i asked my database, get a String, transform it in a byte[] and used DocumentInlineFrame with an XmlResource class extended DynamicWebResource import org.apache.wicket.markup.html.DynamicWebResource; public class MyXmlResource extends DynamicWebResource { private static final long serialVersionUID = 1L; private byte[] myXml; public MyXmlResource(byte[] thisXml) { this.myXml = thisXml; } /* (non-Javadoc) * @see org.apache.wicket.markup.html.DynamicWebResource#getResourceState() */ @Override protected ResourceState getResourceState() { return new ResourceState() { @Override public String getContentType() { return application/xml; } @Override public byte[] getData() { try { return myXml; } catch (Exception e) { return null; } } }; } } public class OdyReqTargetPanel extends Panel { private static final long serialVersionUID = 1L; public OdyReqTargetPanel(String id,byte[] res) { super(id); //setRenderBodyOnly(true); add(new DocumentInlineFrame(mypdf, new MyXmlResource(res))); } } in wicket 6.9.1, DynamicWebResource doesn't exist any more ... and i don't know what i can use -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527p4664530.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: display XML in a popup (or another window) wicket 6.9.1
i have tried it but i don't know how to replace the new PackageResourceStream(HomePage.class, ScalaOverview.pdf) i haven't a resourceStream but a string (or a byte[]) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527p4664532.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: display XML in a popup (or another window) wicket 6.9.1
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, , amp;)); 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
Re: display XML in a popup (or another window) wicket 6.9.1
in fact not never called but sometimes called !! my button is in a DataView (there is one button per line). i also have a PagingNavigator if i change the page in the paging navigator, getString and onResourceRequested are sometimes called on the first click. but never after. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527p4664540.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: display XML in a popup (or another window) wicket 6.9.1
i think you are right because when i clean my browser cache between each click, it works every time ! but, sorry, i don't know how to Append some random noise to the URL (src attribute) in onComponentTag(ComponentTag tag) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527p4664544.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
Thanks !
Thanks a lot for your help ! I was circling for a long time ... De : Timo Schmidt [via Apache Wicket] [mailto:ml-node+s1842946n4664542...@n4.nabble.com] Envoyé : mardi 18 février 2014 14:12 À : LANOISELÉE Benoît OF/DSIF Objet : Re: display XML in a popup (or another window) wicket 6.9.1 On Tue 18.02.2014 05:06, BenHoit wrote: in fact not never called but sometimes called !! my button is in a DataView (there is one button per line). i also have a PagingNavigator if i change the page in the paging navigator, getString and onResourceRequested are sometimes called on the first click. but never after. This seems to be a caching issue. Append some random noise to the URL (src attribute) in onComponentTag(ComponentTag tag). -Timo - To unsubscribe, e-mail: [hidden email]/user/SendEmail.jtp?type=nodenode=4664542i=0 For additional commands, e-mail: [hidden email]/user/SendEmail.jtp?type=nodenode=4664542i=1 If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/display-XML-in-a-popup-or-another-window-wicket-6-9-1-tp4664527p4664542.html To unsubscribe from display XML in a popup (or another window) wicket 6.9.1, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4664527code=YmVub2l0Lmxhbm9pc2VsZWVAb3JhbmdlLmNvbXw0NjY0NTI3fC0xNTc3NDg1MzQz. NAMLhttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml _ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Thanks-tp4664545.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