Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
167 ashish 1
package in.shop2020.hotspot.dashbaord.server;
2
 
3
import in.shop2020.hotspot.dashbaord.client.GreetingService;
4
import in.shop2020.hotspot.dashbaord.shared.FieldVerifier;
5
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
6
 
7
/**
8
 * The server side implementation of the RPC service.
9
 */
10
@SuppressWarnings("serial")
11
public class GreetingServiceImpl extends RemoteServiceServlet implements
12
		GreetingService {
13
 
14
	public String greetServer(String input) throws IllegalArgumentException {
15
		// Verify that the input is valid. 
16
		if (!FieldVerifier.isValidName(input)) {
17
			// If the input is not valid, throw an IllegalArgumentException back to
18
			// the client.
19
			throw new IllegalArgumentException(
20
					"Name must be at least 4 characters long");
21
		}
22
 
23
		String serverInfo = getServletContext().getServerInfo();
24
		String userAgent = getThreadLocalRequest().getHeader("User-Agent");
25
		return "Hello, " + input + "!<br><br>I am running " + serverInfo
26
				+ ".<br><br>It looks like you are using:<br>" + userAgent;
27
	}
28
}