jwrapper.jwutils.network
Class JWNet

java.lang.Object
  extended by jwrapper.jwutils.network.JWNet

public class JWNet
extends java.lang.Object

Useful network-based utility methods.


Field Summary
static java.lang.String HTTP_AGENT_OSX_CHROME
           
static java.lang.String HTTP_AGENT_OSX_FFOX
           
static java.lang.String HTTP_AGENT_OSX_SAFARI
           
static java.lang.String HTTP_AGENT_WINDOWS7_CHROME
           
static java.lang.String HTTP_AGENT_WINDOWS7_IE
           
 
Constructor Summary
JWNet()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static boolean tryForceHttpAgent(java.lang.String agentString)
          This method will attempt to force all Java HTTP and HTTPS connections to use the specified User-Agent HTTP header.
static boolean tryForceHttpAgentUnrestrictive()
          This method will attempt to force all Java HTTP and HTTPS connections to a User-Agent HTTP header which mimics a browser which is likely to be allowed by blocking programs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_AGENT_OSX_CHROME

public static java.lang.String HTTP_AGENT_OSX_CHROME

HTTP_AGENT_OSX_FFOX

public static java.lang.String HTTP_AGENT_OSX_FFOX

HTTP_AGENT_OSX_SAFARI

public static java.lang.String HTTP_AGENT_OSX_SAFARI

HTTP_AGENT_WINDOWS7_CHROME

public static java.lang.String HTTP_AGENT_WINDOWS7_CHROME

HTTP_AGENT_WINDOWS7_IE

public static java.lang.String HTTP_AGENT_WINDOWS7_IE
Constructor Detail

JWNet

public JWNet()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

tryForceHttpAgent

public static boolean tryForceHttpAgent(java.lang.String agentString)
This method will attempt to force all Java HTTP and HTTPS connections to use the specified User-Agent HTTP header. Note that standard methods such as setting the -Dhttp.agent property cause the JVM to append "Java/" on the end of the string which can cause problems with some restrictive networking apparatus.

Parameters:
agentString -
Returns:
whether the attempt appears to have succeeded

tryForceHttpAgentUnrestrictive

public static boolean tryForceHttpAgentUnrestrictive()
This method will attempt to force all Java HTTP and HTTPS connections to a User-Agent HTTP header which mimics a browser which is likely to be allowed by blocking programs. Note that standard methods such as setting the -Dhttp.agent property cause the JVM to append "Java/" on the end of the string which can cause problems with some restrictive networking apparatus.

Parameters:
agentString -
Returns:
whether the attempt appears to have succeeded