You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2023/09/27 10:38:00 UTC
[jira] [Resolved] (WICKET-7076) JavaScriptReferenceType newly created is not serializable
[ https://issues.apache.org/jira/browse/WICKET-7076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Tzvetanov Grigorov resolved WICKET-7076.
-----------------------------------------------
Fix Version/s: 10.0.0-M2
9.16.0
Assignee: Martin Tzvetanov Grigorov
Resolution: Fixed
> 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
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
> Fix For: 10.0.0-M2, 9.16.0
>
>
> 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)