Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package in.shop2020.hotspot.dashbaord.server;

import in.shop2020.hotspot.dashbaord.client.GreetingService;
import in.shop2020.hotspot.dashbaord.shared.FieldVerifier;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet implements
                GreetingService {

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

                String serverInfo = getServletContext().getServerInfo();
                String userAgent = getThreadLocalRequest().getHeader("User-Agent");
                return "Hello, " + input + "!<br><br>I am running " + serverInfo
                                + ".<br><br>It looks like you are using:<br>" + userAgent;
        }
}