[ https://issues.apache.org/jira/browse/WICKET-7076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769531#comment-17769531 ]
ASF subversion and git services commented on WICKET-7076: --------------------------------------------------------- Commit 15e8ba2078f69ffd722d67abda9bdd1245ef19ec in wicket's branch refs/heads/master from leccyril [ https://gitbox.apache.org/repos/asf?p=wicket.git;h=15e8ba2078 ] JavascriptReferenceType: Implement Serializable (#664) * JavascriptReferenceType: Implement Serializable Implement classes newly added as Serializable to be able to store in cache or to be serialized. Fix https://issues.apache.org/jira/projects/WICKET/issues/WICKET-7076?filter=allissues * JavaScriptReferenceType.java: Change from Serializable to Iclusterable Following discussion, it is better to use IClusterable as it is used in other classes like this. Fix https://issues.apache.org/jira/projects/WICKET/issues/WICKET-7076?filter=allissues > JavaScriptReferenceType newly created is not serializable > --------------------------------------------------------- > > Key: WICKET-7076 > URL: https://issues.apache.org/jira/browse/WICKET-7076 > Project: Wicket > Issue Type: Bug > Components: wicket-core > Affects Versions: 9.15.0 > Reporter: leclerc cyril > Priority: Major > > After upgrading 9.14 => 9.15 > 1 enum was swicthed to class and this class is used in header > {{{}org.apache.wicket.markup.head{}}}{{{}.JavaScriptReferenceType.java{}}} > {{but this class is not serializable, for instance we are using hazelcast to > store classes or panel in a map (body and headers), with version 9.14 and > previous it was working, now as this class is not serializable it create an > exception and the cache storing is not working.}} > > {code:java} > package org.apache.wicket.markup.head; > 18 > 19 import org.apache.wicket.util.lang.Args; > 20 > 21 /** > 22 * To be used to define the "type" attribute of the script tag written > 23 * by a {@link AbstractJavaScriptReferenceHeaderItem}. > 24 */ > 25 public class JavaScriptReferenceType { > 26 > 27 public static final JavaScriptReferenceType TEXT_JAVASCRIPT = new > JavaScriptReferenceType("text/javascript"); > 28 public static final JavaScriptReferenceType MODULE = new > JavaScriptReferenceType("module"); > 29 > 30 private final String type; > 31 > 32 public JavaScriptReferenceType(final String type) { > 33 this.type = Args.notEmpty(type, "type"); > 34 } > 35 > 36 public String getType() { > 37 return type; > 38 } > 39 } > {code} > {{To reproduce, just create a panel with javascript file set in java with > ajax link or ajax behaviour}} > {{and in the render method try to add item in header attribute (to be stored) > here this code is working}} > {code:java} > @Override > public void render(HeaderItem item) { > //this is just a test to see if code works > if(!(item instanceof JavaScriptReferenceHeaderItem)){ > headerItems.add( item ); > } > }{code} > > {{Not the previous one}} > {code:java} > @Override > public void render(HeaderItem item) { > headerItems.add( item ); > }{code} > {{{}then put this panel or component in a map like hazecast{}}}{{{{}}{}}} > > {code:java} > Cache<String,Panel> cache = cacheManager.getCache( cacheName ); cache.put( > getCacheKey(), panel ); {code} > > Pull request : https://github.com/apache/wicket/pull/664 -- This message was sent by Atlassian Jira (v8.20.10#820010)