As this enhances function in now way, i would advise not spend to much effort on it. Good way to spread the OJ string into access logs though. Setting System.setProperty ("http.agent", "OpenJUMP <version string>") should suffice for the most use cases and is automatically propagated to each new http connection.
btw. -D<name>=<value> is merely the command line way to set system properties, programmatically done with System.setProperty(name,value) ..ede On 03.04.2013 09:58, Rahkonen Jukka wrote: > Hi, > > Service providers appreciate if clients are telling who they are and a common > way for doing this is to add User-Agent parameter to http headers. Java is > setting this to something like "User-Agent= Java/1.6.0_43" if user agent is > not set elsewhere. This is not very useful information for service providers. > > There seems to be at least three ways for setting user agent in Java. > - use jre start option > -Dhttp.agent="OpenJUMP" > - use setRequestProperty > URLConnection conn = url.openConnection(); > conn.setRequestProperty("User-Agent", "OpenJUMP YOURS Client"); > - use System.setProperty ("http.agent", "OpenJUMP GIS"); > > I do not know how and where the System.setProperty is supposed to be used but > I tested the two other alternatives. Adding -Dhttp.agent="OpenJUMP" into > makes OpenJUMP to use header "User-Agent: OpenJUMP Java/1.6.0_43". Using > setRequestProperty("User-Agent", "OpenJUMP YOURS Client") turns header into > exactly " User-Agent: OpenJUMP YOURS Client". > > I would suggest three things: > - Add http.agent into WMS connection in around line 117 in the file > http://jump-pilot.svn.sourceforge.net/viewvc/jump-pilot/core/trunk/src/com/vividsolutions/wms/WMService.java?revision=3459&view=markup > I woud suggest to use "con.setRequestProperty("User-Agent", "OpenJUMP WMS > Client"); > - Add jre start option -Dhttp.agent="OpenJUMP" into the starting scripts. > This makes for example ad hoc BeanShell scripts to advertise OpenJUMP as user > agent if nothing else is set in the code. > - Write somewhere into developer documents an advice to use an informative > user agent if new plugins or scripts are communicating with some services > through http. > > What do the real OJ developers think? > > -Jukka Rahkonen- > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel