IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

integrartion de gwt-sl


Sujet :

GWT et Vaadin Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    686
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 686
    Par défaut integrartion de gwt-sl
    salut
    je voudrais integrer gwt-sl pour le support de spring dans mon application GWT
    j'ai suit le tutoriel dans :http://gwt-widget.sourceforge.net/gw...tml#Quickstart
    j'ai deux problèmes:
    • Premièrement,mon interface ServiceTest me signale l'erreure suivante:Missing asynchronous interface ServiceTestAsync

    • deuxièmement et la chose la plus importante:comment je puisse appeler mon service depuis mon module(la classe java implementant EntryPoint)
      avant d'integrer gwt-sl,pour créer le proxy j'utilise :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
    maintenant comment faire?

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    129
    Détails du profil
    Informations personnelles :
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 129
    Par défaut
    Une fois que ton service RPC est déclaré dans ta classe tu peux en appeler les méthodes.

    De quel service parle tu ? Service RPC ? service classique ? Utilise tu Spring ?

    Je te conseille de suivre aussi ce tutoriel qui t'en apprendras beaucoup :

    http://hugo.developpez.com/tutoriels...-et-hibernate/

  3. #3
    Membre éclairé
    Inscrit en
    Février 2008
    Messages
    686
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 686
    Par défaut
    Citation Envoyé par M€lK!oR Voir le message
    Une fois que ton service RPC est déclaré dans ta classe tu peux en appeler les méthodes.

    De quel service parle tu ? Service RPC ? service classique ? Utilise tu Spring ?

    Je te conseille de suivre aussi ce tutoriel qui t'en apprendras beaucoup :

    http://hugo.developpez.com/tutoriels...-et-hibernate/
    j'ai largement essayé mais sans resultat:
    vioci mon fichier web.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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
     
    <web-app>
     
      <!-- Servlets -->
     <servlet>
    		<servlet-name>handler</servlet-name>
    		<servlet-class>
    			org.springframework.web.servlet.DispatcherServlet  <!--  This is a Spring configuration-->
    		</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<servlet-mapping>
    		<servlet-name>handler</servlet-name>
    		<url-pattern>/handler/*</url-pattern>
    	</servlet-mapping>
     
      
      <!-- Default page to serve -->
      <welcome-file-list>
        <welcome-file>GwtDeply.html</welcome-file>
      </welcome-file-list>
     
    </web-app>
    mon fichier handler-servlet.xml est:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    	<bean class="org.gwtwidgets.server.spring.GWTHandler">
    		<property name="mappings">
    			<map>
    				<entry key="/rpctest" value-ref="RPCTest" />
    			</map>
    		</property>
    	</bean>
     
    	<bean id="RPCTest" class="gwt.deploy.test.server.ServiceAddImpl" />
    </beans>
    l'interface synchrone du service est:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    package gwt.deploy.test.client;
     
    import com.google.gwt.user.client.rpc.RemoteService;
    import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
    @RemoteServiceRelativePath("rpctest")
    public interface ServiceAdd extends RemoteService {
    	public int add(int a,int b);
     
    }
    mon module est:
    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
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
     
    public class GwtDeply implements EntryPoint {
    	/**
             * The message displayed to the user when the server cannot be reached or
             * returns an error.
             */
    	private static final String SERVER_ERROR = "An error occurred while "
    			+ "attempting to contact the server. Please check your network "
    			+ "connection and try again.";
     
    	/**
             * Create a remote service proxy to talk to the server-side Greeting service.
             */
    	private final ServiceAddAsync greetingService = GWT
    			.create(ServiceAdd.class);
     
    	/**
             * This is the entry point method.
             */
    	public void onModuleLoad() {
    		System.out.println("LOAD MODULE..");
    		final Button sendButton = new Button("Send");
    		final TextBox nameField = new TextBox();
    		nameField.setText("GWT User");
     
    		// We can add style names to widgets
    		sendButton.addStyleName("sendButton");
     
    		// Add the nameField and sendButton to the RootPanel
    		// Use RootPanel.get() to get the entire body element
    		RootPanel.get("nameFieldContainer").add(nameField);
    		RootPanel.get("sendButtonContainer").add(sendButton);
     
    		// Focus the cursor on the name field when the app loads
    		nameField.setFocus(true);
    		nameField.selectAll();
     
    		// Create the popup dialog box
    		final DialogBox dialogBox = new DialogBox();
    		dialogBox.setText("Remote Procedure Call");
    		dialogBox.setAnimationEnabled(true);
    		final Button closeButton = new Button("Close");
    		// We can set the id of a widget by accessing its Element
    		closeButton.getElement().setId("closeButton");
    		final Label textToServerLabel = new Label();
    		final HTML serverResponseLabel = new HTML();
    		VerticalPanel dialogVPanel = new VerticalPanel();
    		dialogVPanel.addStyleName("dialogVPanel");
    		dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    		dialogVPanel.add(textToServerLabel);
    		dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    		dialogVPanel.add(serverResponseLabel);
    		dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    		dialogVPanel.add(closeButton);
    		dialogBox.setWidget(dialogVPanel);
     
    		// Add a handler to close the DialogBox
    		closeButton.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent event) {
    				dialogBox.hide();
    				sendButton.setEnabled(true);
    				sendButton.setFocus(true);
    			}
    		});
     
    		// Create a handler for the sendButton and nameField
    		class MyHandler implements ClickHandler, KeyUpHandler {
    			/**
                             * Fired when the user clicks on the sendButton.
                             */
    			public void onClick(ClickEvent event) {
    				System.out.println("LOAD MODULE:onClick..");
    				sendNameToServer();
    			}
     
    			/**
                             * Fired when the user types in the nameField.
                             */
    			public void onKeyUp(KeyUpEvent event) {
    				if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    					sendNameToServer();
    				}
    			}
     
    			/**
                             * Send the name from the nameField to the server and wait for a response.
                             */
    			private void sendNameToServer() {
    				sendButton.setEnabled(false);
    				String textToServer = nameField.getText();
    				textToServerLabel.setText(textToServer);
    				serverResponseLabel.setText("");
     
    				System.out.println("jjjjjjjjjjjjjjjj");
    				greetingService.add(Integer.parseInt(textToServer),Integer.parseInt(textToServer),
    						new AsyncCallback<Integer>() {
    							public void onFailure(Throwable caught) {
     
    								System.err.println("ERRRRRRR:"+caught.getLocalizedMessage());
    								caught.printStackTrace();
    								// Show the RPC error message to the user
    								dialogBox
    										.setText("Remote Procedure Call - Failure");
    								serverResponseLabel
    										.addStyleName("serverResponseLabelError");
    								serverResponseLabel.setHTML(caught.getLocalizedMessage());
    								dialogBox.center();
    								closeButton.setFocus(true);
    							}
     
    							public void onSuccess(Integer result) {
    								System.out.println("LOAD MODULE:onSuccess..");
    								dialogBox.setText("Remote Procedure Call");
    								serverResponseLabel
    										.removeStyleName("serverResponseLabelError");
    								serverResponseLabel.setHTML(result.toString());
    								dialogBox.center();
    								closeButton.setFocus(true);
    							}
    						});
    			}
    		}
     
    		// Add a handler to send the name to the server
    		MyHandler handler = new MyHandler();
    		sendButton.addClickHandler(handler);
    		nameField.addKeyUpHandler(handler);
    	}
    }
    en mode developpement, j'obtient ce message:

    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
     
    [WARN] 404 - POST /gwtdeply/rpctest (127.0.0.1) 1402 bytes
       Request headers
          Host: localhost:8888
          User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8
          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://localhost:8888/gwtdeply/hosted.html?gwtdeply
          X-GWT-Permutation: HostedMode
          X-GWT-Module-Base: http://localhost:8888/gwtdeply/
          Content-Type: text/x-gwt-rpc; charset=utf-8
          Content-Length: 131
          Pragma: no-cache
          Cache-Control: no-cache
       Response headers
          Content-Type: text/html; charset=iso-8859-1
          Content-Length: 1402
    ERRRRRRR:<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=/gwtdeply/rpctest</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>
     
    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=/gwtdeply/rpctest</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:396)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	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.GeneratedMethodAccessor12.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	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(Thread.java:595)
    et en mode web j'obtient :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    Etat HTTP 404 - /war/gwtdeply/rpctest
     
    type Rapport d'état
     
    message /war/gwtdeply/rpctest
     
    description La ressource demandée (/war/gwtdeply/rpctest) n'est pas disponible.

Discussions similaires

  1. GWT peut-il remplacer les jsps ?
    Par le Daoud dans le forum GWT et Vaadin
    Réponses: 76
    Dernier message: 14/07/2008, 12h33
  2. GWT - Probleme de diffusion en mode web
    Par sboober dans le forum GWT et Vaadin
    Réponses: 13
    Dernier message: 24/08/2007, 15h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo