Detect Container

I have developed a library that can be used from web (servlet) applications or desktop application, I'm wondering if their is a way to dynamically detect if the library is called in desktop or web container.
[215 byte] By [Yazana] at [2007-11-27 4:32:04]
# 1

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.

karma-9a at 2007-7-12 9:41:37 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...