Search code examples
javawicketserializable

Serializable AjaxRequestTarget


As a part of my development in Java using wicket as my web framework , at some point , which it's not necessary to explain why , but right now I need a Serializable version of AjaxRequestTarget. I tried to extend it and add Serializable behavior to it but since AjaxRequestTarget is abstract, I can not extend it. the code bellow somehow shows what I need :

public class SerializableART extends AjaxRequestTarget implemets Serializable {

}

is there any alternative way of doing this ?


Solution

  • It make no sense to serialize the AjaxRequestTarget. It is a object which only make sense in the context of a request, so it shouldn't keeped longer then the request.

    If you need AjaxRequestTarget somewhere where it is not directly accessible you can access it with RequestCycle.get().find(AjaxRequestTarget.class). But i recommend to pass it as method argument where possible.