留言板

Unable to unregister Push on Android with a custom session impl (issue)

thumbnail
Denis Signoretto,修改在7 年前。

Unable to unregister Push on Android with a custom session impl (issue)

Expert 帖子: 375 加入日期: 09-4-21 最近的帖子
Hi,

I'm facing a problem on Android. nregistering a device for push. I'm using a custom Session implementation.

I've seen that constructor of Push.java class creates a new instance of session object instantiating a new SessionImpl instead of using passed object.

_session = new SessionImpl(session);


I think this is an issue supporting different or extensions of Session. Do you agree? Is there a particular reason why Push constructor needs to create a new object?

Bye,
Denis.
thumbnail
Bruno Farache,修改在7 年前。

RE: Unable to unregister Push on Android with a custom session impl (issue)

Liferay Master 帖子: 603 加入日期: 07-5-14 最近的帖子
I think it's just because it needs a clean session, with no callback set. Maybe you can extend Push and override this?
thumbnail
Denis Signoretto,修改在7 年前。

RE: Unable to unregister Push on Android with a custom session impl (issue)

Expert 帖子: 375 加入日期: 09-4-21 最近的帖子
Hi Bruno,

our problem with Push class is that we are loosing heasders previously setted in the Session object. We've tried extending Push without success because constructor calls super which initialize Session with a new instance. We've found a workaround implementing our customizations in a Authentication.

It would be desiderable that SessionImpl(Session session) constuctor copy headers as well (or as alternative implement clone() method for Session and use it in Push constructor).

WDYT?

Bye,
Denis.
thumbnail
Bruno Farache,修改在7 年前。

RE: Unable to unregister Push on Android with a custom session impl (issue)

Liferay Master 帖子: 603 加入日期: 07-5-14 最近的帖子
I see, we can just make it simpler and not clone the session, as you have suggested previously. Does it work for you?
thumbnail
Denis Signoretto,修改在7 年前。

RE: Unable to unregister Push on Android with a custom session impl (issue)

Expert 帖子: 375 加入日期: 09-4-21 最近的帖子
Hi Bruno,

I think creating a new session object is a good choice because Push needs to alter it setting the callback (it would be safe to support multi-thread).
To keep it simple it should be sufficient that SessionImpl(Session session) constructor initialize headers too.

Bye,
Denis.