Bonjour,
J'essaie d'intégrer depuis Lundi Gilead à mon projet, toutefois, je reste bloqué sur un élément : Je n'arrive pas à exposer mes services RPC via Gilead
Pour mon cas, j'ai besoin de récuperer un service RPC d'authentification. Avant d'utiliser Gilead, ce service était déclaré dans le web.xml et je n'avais pas de problème :
Aujourd'hui avec Gilead, ces lignes du web.xml sont commentés. Je n'arrive pas à déceler pourquoi mon service RPC est introuvable.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <servlet> <servlet-name>authentificationServiceUIImpl</servlet-name> <servlet-class> com.empeiria.rbundle.ui.auth.server.AuthentificationServiceUIImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>authentificationServiceUIImpl</servlet-name> <url-pattern>/login/AuthLogin</url-pattern> </servlet-mapping>
Je me suis basé sur le tutorial de hugo lassiège mais en vain. Voici mon code :
Mon web.xml
Ma gilead-servlet
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
59
60
61 <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>RBundle</display-name> <context-param> <description>This context parameter specified the name and location of the Spring root application context file.</description> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/applicationContext-* , /WEB-INF/gilead-servlet.xml </param-value> </context-param> <!-- Default page to serve --> <welcome-file-list> <welcome-file>login.html</welcome-file> </welcome-file-list> <!-- Handler pour GILEAD --> <servlet> <servlet-name>gilead</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>gilead</servlet-name> <url-pattern>*.rpc</url-pattern> </servlet-mapping> <!-- Servlets GWT <servlet> <servlet-name>authentificationServiceUIImpl</servlet-name> <servlet-class> com.empeiria.rbundle.ui.auth.server.AuthentificationServiceUIImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>authentificationServiceUIImpl</servlet-name> <url-pattern>/login/AuthLogin</url-pattern> </servlet-mapping>--> <servlet> <servlet-name>remoteLoggerServiceImpl</servlet-name> <servlet-class>com.allen_sauer.gwt.log.server.RemoteLoggerServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>remoteLoggerServiceImpl</servlet-name> <url-pattern>/login/gwt-log</url-pattern> </servlet-mapping> <!-- Contexte Spring ( Spring Loader) --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> </web-app>
Mon interface RPC :
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="Hibernate4GWTExporter" abstract="true" class="org.gwtwidgets.server.spring.gilead.GileadRPCServiceExporter" /> <bean id="urlProjectMapping" class="org.gwtwidgets.server.spring.GWTHandler"> <!-- Supply here mappings between URLs and services. Services must implement the RemoteService interface but are not otherwise restricted.--> <property name="mappings"> <map> <!-- Other mappings could follow --> <entry key="/AuthLogin.rpc" value-ref="authentificationServiceRPC" /> </map> </property> </bean> <!-- GILEAD --> <!-- The Gilead POJO stateless proxy store. <bean id="proxyStore" class="net.sf.gilead.core.store.stateless.StatelessProxyStore" /> --> <bean id="proxyStoreHttpSession" class="net.sf.gilead.core.store.stateful.HttpSessionProxyStore"> <property name="persistenceUtil" ref="HibernateUtil" /> </bean> <bean id="HibernateUtil" class="net.sf.gilead.core.hibernate.jpa.HibernateJpaUtil"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <!-- Gilead persistentBeanManager binds the POJO store with a Hibernate session factory (through the hibernate util). --> <bean id="persistentBeanManager" class="net.sf.gilead.core.PersistentBeanManager"> <property name="proxyStore" ref="proxyStoreHttpSession" /> <property name="persistenceUtil" ref="HibernateUtil"></property> </bean> <bean id="GileadAuthentificationService" parent="Hibernate4GWTExporter"> <property name="beanManager" ref="persistentBeanManager" /> <property name="service" ref="authentificationServiceRPC" /> </bean> <!-- Setup transaction handling --> <aop:config> <aop:pointcut id="hb4GwtInvocation" expression="execution(* org.gwtwidgets.server.spring.gilead.GileadRPCServiceExporter.invokeMethodOnService(..))" /> <!-- <aop:advisor pointcut-ref="hb4GwtInvocation" advice-ref="txAdvice" />--> </aop:config> <bean id="authentificationServiceRPC" class="com.empeiria.rbundle.ui.auth.server.AuthentificationServiceUIImpl"> <property name="utilisateurService" ref="utilisateurService" /> </bean> </beans>
et son implémentation :
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 package com.empeiria.rbundle.ui.auth.client; import com.empeiria.rbundle.metier.Utilisateur; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath("AuthLogin.rpc") public interface AuthentificationServiceRPC extends RemoteService { /** * Identification de l'utilisateur * @param uid l'id utilisateur * @param pwd le mot de passe utilisateur * @return les informations sur l'utilisateur * @throws BadAuthException */ public Utilisateur authenticate(String uid, String pwd) throws BadAuthException; }
Mon login.gwt.xml
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
59
60
61
62
63
64
65
66 package com.empeiria.rbundle.ui.auth.server; import com.allen_sauer.gwt.log.client.Log; import com.empeiria.rbundle.exceptions.ServiceException; import com.empeiria.rbundle.metier.Utilisateur; import com.empeiria.rbundle.service.UtilisateurService; import com.empeiria.rbundle.ui.auth.client.AuthentificationServiceRPC; import com.empeiria.rbundle.ui.auth.client.BadAuthException; import com.google.gwt.user.server.rpc.RemoteServiceServlet; /** * @author Empeiria */ public class AuthentificationServiceUIImpl extends RemoteServiceServlet implements AuthentificationServiceRPC{ private static final String USER = "USER"; /** * */ private static final long serialVersionUID = 1L; private UtilisateurService utilisateurService; public Utilisateur authenticate(String uid, String pwd) throws BadAuthException { String username = uid.toLowerCase().trim(); Utilisateur user = null; try { user = utilisateurService.findByLogin(username); } catch (ServiceException e) { Log.debug(e.getMessage()); }catch (Exception e) { if(Log.isDebugEnabled()) e.printStackTrace(); } if (user == null) { //Code erreur Ident_ERR02 throw new BadAuthException("Utilisateur inexistant !"); } if (!user.getPassword().equals(pwd)) { //Code erreur Ident_ERR02 throw new BadAuthException("Mauvais mot de passe"); //System.out.println("properties : " + PropertiesUtils.getProperties("exc_wrongPassword")); //throw new BadAuthException(PropertiesUtils.getProperties("exc_wrongPassword")); } //On set en Session l'utilisateur this.getThreadLocalRequest().getSession().setAttribute(USER, user); //on met à jour la date de connection utilisateurService.updateLastConnection(user); return user; } public void setUtilisateurService(UtilisateurService utilisateurService) { this.utilisateurService = utilisateurService; } }
Finalement, voici l'erreur que je reçoi quand j'appel ma méthode d'identification
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd"> <module rename-to="login"> <inherits name="com.google.gwt.user.User" /> <inherits name="com.google.gwt.core.Core"/> <inherits name="com.google.gwt.user.UserAgent"/> <inherits name='com.smartgwt.SmartGwt'/> <inherits name="com.google.gwt.i18n.I18N"/> <inherits name='com.google.gwt.user.theme.standard.Standard'/> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <!-- For development a default of `DEBUG` is recommended --> <inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" /> <!-- Gilead light entity --> <inherits name='net.sf.gilead.Gilead4Gwt'/> <set-property name="log_DivLogger" value="DISABLED" /> <extend-property name="locale" values="fr"/> <!-- Definition de la langue de l'application par defaut --> <set-property name="locale" value="fr" /> <!-- <inherits name='net.sf.gilead.Adapter4Gwt15'/>--> <source path="i18n"></source> <source path="metier"></source> <source path="ui"> <exclude name="auth/server/**"/> <exclude name="rbundle/server/**"/> </source> <source path="dto"></source> <!-- Specify the app entry point class. --> <entry-point class='com.empeiria.rbundle.ui.auth.client.LoginUI'/> <!-- Choosed NAVIGATOR, separated with coma <set-property name="user.agent" value="gecko1_8" /> --> <!-- Choosed NAVIGATOR, separated with coma --> <replace-with class="com.google.gwt.user.client.impl.WindowImplIE"> <when-type-is class="com.google.gwt.user.client.impl.WindowImpl"/> <any> <when-property-is name="user.agent" value="ie6"/> <when-property-is name="user.agent" value="ie8"/> </any> </replace-with> <!--a retirer par la suite <set-property name="user.agent" value="ie6" />--> <!-- Other module inherits --> <!-- Add gwt-log support, default level `OFF` --> <!-- <inherits name="com.allen_sauer.gwt.log.gwt-log-INFO" />--> <!-- <extend-property name="log_level" values="INFO"/>--> </module>
Merci d'avance pour votre aide qui me permettra d'avancer sur mon projet.
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110 11:51:50,546 WARN [PageNotFound] No mapping found for HTTP request with URI [/login/AuthLogin.rpc] in DispatcherServlet with name 'gilead' [WARN] 404 - POST /login/AuthLogin.rpc (127.0.0.1) 1405 bytes Request headers Host: 127.0.0.1:8888 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://127.0.0.1:8888/login/hosted.html?login Cookie: JSESSIONID=1pqd15i3ni05s Cache-Control: no-cache X-GWT-Permutation: HostedMode X-GWT-Module-Base: http://127.0.0.1:8888/login/ Content-Type: text/x-gwt-rpc; charset=utf-8 Content-Length: 198 Pragma: no-cache Response headers Content-Type: text/html; charset=iso-8859-1 Content-Length: 1405 com.google.gwt.user.client.rpc.StatusCodeException: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 404 NOT_FOUND</title> </head> <body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre> <p>RequestURI=/login/AuthLogin.rpc</p><p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </body> </html> at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:192) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287) at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:393) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222) at java.lang.Thread.run(Unknown Source) 2010-02-10 11:51:50,562 [ERROR] LoginUI.check : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 404 NOT_FOUND</title> </head> <body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre> <p>RequestURI=/login/AuthLogin.rpc</p><p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </body> </html>
Partager