Forums de discussion

How to access request object in DLFileIndexer class

thumbnail
manu tomar, modifié il y a 8 années.

How to access request object in DLFileIndexer class

New Member Publications: 23 Date d'inscription: 07/01/15 Publications récentes
I have set an attribute in session object in my action class and I have a need to access Request object in DLFileIndexer class to get session object, so that on behalf of that attribute I can perform my custom search. please help
thumbnail
Jan Geißler, modifié il y a 8 années.

RE: How to access request object in DLFileIndexer class (Réponse)

Liferay Master Publications: 735 Date d'inscription: 05/07/11 Publications récentes
Can't help. This is impossible. An indexer is something which is called out of the Request/Session scope as it should be. The indexer's responsibility is to write/update the Search Index, when a model changed. It should not be aware from where this change has been trigered. For example: If you add Data vie a REST Service or JSON Api, there is quite a good chance, that there is not request Object and Session at all, because the user is not logged in in the Portal UI, only in the Rest Service. At this point, all your methods which rely on a Session will fail badly.
thumbnail
David H Nebinger, modifié il y a 8 années.

RE: How to access request object in DLFileIndexer class

Liferay Legend Publications: 14916 Date d'inscription: 02/09/06 Publications récentes
An admin can also reindex at any point in time and will not have any of the temporary session data that you're trying to save for a user.