Dave Jarvis created BATIK-1300: ---------------------------------- Summary: ParsedURL does not respect http.agent system property Key: BATIK-1300 URL: https://issues.apache.org/jira/browse/BATIK-1300 Project: Batik Issue Type: Bug Components: Utilities Affects Versions: 1.14 Reporter: Dave Jarvis
>From >[https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html#MiscHTTP]: {quote}*http.agent* (default: “Java/<version>”) Defines the string sent in the User-Agent request header in http requests. Note that the string “Java/<version>” will be appended to the one provided in the property (e.g. if -Dhttp.agent=”foobar” is used, the User-Agent header will contain “foobar Java/1.5.0” if the version of the VM is 1.5.0). This property is checked only once at startup. {quote} If an application calls {{System.setProperty( "http.agent", "Agent Name" )}}, it is expected that all components in that application respect the user agent setting. The class *org.apache.batik.util.ParsedURL* sets *globalUserAgent* at line 90, which is then used as the default user agent for all subsequent HTTP requests. Although developers can call *setGlobalUserAgent* to change the value, this violates the principle of least astonishment. The method *getGlobalUserAgent* should defer to the *http.agent* system property value so that developers have a sporting chance of setting this value in a single location to have it apply across all components. (Aside, consider removing the duplication in the five *ParsedURL* constructors.) -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: batik-dev-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-dev-h...@xmlgraphics.apache.org