mammad
mammad

Reputation: 207

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 ?

Upvotes: 1

Views: 246

Answers (3)

Markus Hettich
Markus Hettich

Reputation: 574

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.

Upvotes: 0

mrr
mrr

Reputation: 382

you must add an extra argument to your panel contractor and pass your parent panel markup to this panel and use this as target markup.

Upvotes: 0

svenmeier
svenmeier

Reputation: 5681

You can't make AjaxRequestTarget serializable, this is similar to HttpServletRequest:

See this question:

How Serialize HttpServletRequest/HttpServletResponse?

Upvotes: 1

Related Questions