Je comprends pas.
Je tente de faire de l'ipc entre deux portlets qui sont dans deux wars différents et ça ne marche pas.
En fait ça marche très bien si mes events sont des String.
Si je veux passer un objet à ma sauce, là ça ne marche plus...
Pourtant j'ai bien mis l'annotation @XmlRootElement
L'envoi de l'event se fait bien.
Mais le portlet qui écoute ne fait rien du tout de son côté.
Et je n'ai pas d'erreur remontée par jboss.
Voilà mon code du portlet qui envoie l'event :
Le code du portlet qui est censé écouter l'event :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 ... UserAccount _user = new UserAccount(); this.sendEvent("UserLog", _user, response); ... private void sendEvent(String _event_type , Serializable _event_object , ActionResponse response) { System.out.println("[BrowserPortlet.sendEvent] type : " + _event_type + " value : " + _event_object); response.setEvent(_event_type, _event_object); }
Le descripteur portlet.xml du premier portlet :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public void processEvent(EventRequest request, EventResponse response) { Event event = request.getEvent(); System.out.println("[PortletCreateAnnotation.processEvent] event : " + event.getName()); String _event_name = event.getName() ; if(_event_name.equalsIgnoreCase("UserLog")) { if(event.getValue() instanceof UserAccount) { UserAccount _current_user = (UserAccount)event.getValue() ; if(_current_user.getId() != null) request.getPortletSession().setAttribute("user", _current_user); } } }
Le descripteur du deuxième portlet :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 <?xml version="1.0" encoding="UTF-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"> <portlet> <portlet-name>PortletLogin</portlet-name> <portlet-class>fr.natoine.PortletUserAccount.PortletLogin</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>HELP</portlet-mode> <portlet-mode>EDIT</portlet-mode> </supports> <portlet-info> <title>Se connecter</title> </portlet-info> <supported-publishing-event> <qname>UserLog</qname> </supported-publishing-event> <supported-publishing-event> <qname>UserUnLog</qname> </supported-publishing-event> <supported-publishing-event> <qname>newApplicationName</qname> </supported-publishing-event> </portlet> <portlet> <portlet-name>PortletInscription</portlet-name> <portlet-class>fr.natoine.PortletUserAccount.PortletInscription</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>HELP</portlet-mode> </supports> <portlet-info> <title>Créer un compte</title> </portlet-info> <supported-processing-event> <qname>newApplicationName</qname> </supported-processing-event> </portlet> <event-definition> <qname>UserLog</qname> <value-type>fr.natoine.model_user.UserAccount</value-type> </event-definition> <event-definition> <qname>UserUnLog</qname> <value-type>java.lang.String</value-type> </event-definition> <event-definition> <qname>newApplicationName</qname> <value-type>java.lang.String</value-type> </event-definition> </portlet-app>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 <?xml version="1.0" encoding="UTF-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"> <portlet> <portlet-name>PortletCreateAnnotation</portlet-name> <portlet-class>fr.natoine.PortletAnnotation.PortletCreateAnnotation</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>HELP</portlet-mode> </supports> <portlet-info> <title>portlet de création d'annotations</title> </portlet-info> <supported-processing-event> <qname>selection</qname> </supported-processing-event> <supported-processing-event> <qname>UserLog</qname> </supported-processing-event> <supported-processing-event> <qname>UserUnLog</qname> </supported-processing-event> <supported-processing-event> <qname>loadedurl</qname> </supported-processing-event> <supported-publishing-event> <qname>highlight</qname> </supported-publishing-event> </portlet> <event-definition> <qname>UserLog</qname> <value-type>fr.natoine.model_user.UserAccount</value-type> </event-definition> <event-definition> <qname>selection</qname> <value-type>fr.natoine.model_htmlDocs.HighlightSelectionHTML</value-type> </event-definition> <event-definition> <qname>UserUnLog</qname> <value-type>java.lang.String</value-type> </event-definition> <event-definition> <qname>highlight</qname> <value-type>java.util.ArrayList</value-type> </event-definition> <event-definition> <qname>loadedurl</qname> <value-type>java.lang.String</value-type> </event-definition> </portlet-app>
Partager