You could try reading the user-agent HTTP header to determine if the request is coming from a browser, although that header is easy to spoof on a standalone Java client using URLConnection & HTTP..
For a desktop client, a non-spoofed user-agent string would start with "java"-something.