File tree Expand file tree Collapse file tree
simplegraph-mediawiki/src
main/java/com/bitplan/simplegraph/mediawiki
test/java/com/bitplan/simplegraph/mediawiki Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535public class MediaWikiSystem extends SimpleSystemImpl implements SimpleSystem {
3636
3737 SSLWiki wiki ;
38+
39+ private static final String USER_AGENT =
40+ "SimpleGraph-MediaWiki/1.0 (https://github.com/BITPlan/com.bitplan.simplegraph; webmaster@bitplan.com)" ;
41+
42+ static {
43+ // Set default User-Agent for all HTTP connections made by this JVM
44+ // This ensures ImageIO.read() and other URL-based operations include User-Agent
45+ System .setProperty ("http.agent" , USER_AGENT );
46+ }
47+
48+
3849 @ Override
3950 public SimpleNode moveTo (String nodeQuery , String ...keys ) {
4051 return new MediaWikiPageNode (this ,nodeQuery ,keys );
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public void testGetPage() throws Exception {
5858
5959 @ Test
6060 public void testGetImageInfo () throws Exception {
61- // debug = true;
61+ debug = true ;
6262 MediaWikiSystem mws = new MediaWikiSystem ();
6363 MediaWikiPageNode pageNode = (MediaWikiPageNode ) mws
6464 .connect ("https://commons.wikimedia.org" , "/w" )
You can’t perform that action at this time.
0 commit comments