Package com.github.nmorel.gwtjackson.hello.shared

Examples of com.github.nmorel.gwtjackson.hello.shared.GreetingRequest


                textToServerLabel.setText( textToServer );
                serverResponseLabel.setText( "" );

                try {
                    new RequestBuilder( RequestBuilder.POST, "hello/greet" ).sendRequest( GREETING_REQUEST_WRITER
                            .write( new GreetingRequest( textToServer ) ), new RequestCallback() {
                        @Override
                        public void onResponseReceived( Request request, Response response ) {
                            GreetingResponse result = GREETING_RESPONSE_READER.read( response.getText() );

                            dialogBox.setText( "Remote Procedure Call" );
View Full Code Here


                textToServerLabel.setText( textToServer );
                serverResponseLabel.setText( "" );

                try {
                    new RequestBuilder( RequestBuilder.POST, "hello/greet" ).sendRequest( GREETING_REQUEST_WRITER
                            .write( new GreetingRequest( textToServer ) ), new RequestCallback() {
                        @Override
                        public void onResponseReceived( Request request, Response response ) {
                            GreetingResponse result = GREETING_RESPONSE_READER.read( response.getText() );

                            dialogBox.setText( "Remote Procedure Call" );
View Full Code Here

    @Override
    protected void doPost( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {

        // Deserialize the request
        GreetingRequest greetingRequest = mapper.readValue( req.getInputStream(), GreetingRequest.class );

        // Verify that the input is valid.
        if ( !FieldVerifier.isValidName( greetingRequest.getName() ) ) {
            // If the input is not valid, throw an IllegalArgumentException back to
            // the client.
            throw new IllegalArgumentException( "Name must be at least 4 characters long" );
        }

        GreetingResponse response = new GreetingResponse();
        response.setServerInfo( getServletContext().getServerInfo() );
        response.setUserAgent( req.getHeader( "User-Agent" ) );
        response.setGreeting( "Hello, " + greetingRequest.getName() + "!" );

        // Serialize the response into the servlet output
        mapper.writeValue( resp.getOutputStream(), response );
    }
View Full Code Here

                sendButton.setEnabled( false );
                textToServerLabel.setText( textToServer );
                serverResponseLabel.setText( "" );

                ginjector.getRestDispatch().execute( ginjector.getHelloRestService()
                        .greet( new GreetingRequest( textToServer ) ), new AsyncCallback<GreetingResponse>() {
                    @Override
                    public void onFailure( Throwable caught ) {
                        // Show the RPC error message to the user
                        dialogBox.setText( "Remote Procedure Call - Failure" );
                        serverResponseLabel.addStyleName( "serverResponseLabelError" );
View Full Code Here

                sendButton.setEnabled( false );
                textToServerLabel.setText( textToServer );
                serverResponseLabel.setText( "" );

                ginjector.getRestDispatch().execute( ginjector.getHelloRestService()
                        .greet( new GreetingRequest( textToServer ) ), new AsyncCallback<GreetingResponse>() {
                    @Override
                    public void onFailure( Throwable caught ) {
                        // Show the RPC error message to the user
                        dialogBox.setText( "Remote Procedure Call - Failure" );
                        serverResponseLabel.addStyleName( "serverResponseLabelError" );
View Full Code Here

TOP

Related Classes of com.github.nmorel.gwtjackson.hello.shared.GreetingRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.