A simple study of the use of xutils today
Https://github.com/wyouflf/xUtils
When using the Httputils module, the temporary Redirect error is always found.
Look at the source code and find that if you are using a proxy to go online, you need to pass the proxy string value when initializing the httputils.
In the Httputils.java:
Public Httputils (int conntimeout, String useragent) { new basichttpparams (); Connmanagerparams.settimeout (params, conntimeout); Httpconnectionparams.setsotimeout (params, conntimeout); Httpconnectionparams.setconnectiontimeout (params, conntimeout); if (Textutils.isempty (useragent)) { = otherutils.getuseragent (null); } Httpprotocolparams.setuseragent (params, useragent);
So, workaround one, call the constructor method that needs to be proxied to instantiate the httputils.
Public httputils (String useragent) { this(httputils.default_conn_timeout, useragent); }
However, in many cases, we do not need to know these, because different environments may require different proxy settings.
Workaround two, directly comment out the code that sets the agent
Public Httputils (int conntimeout, String useragent) { new basichttpparams (); Connmanagerparams.settimeout (params, conntimeout); Httpconnectionparams.setsotimeout (params, conntimeout); Httpconnectionparams.setconnectiontimeout (params, conntimeout); if (Textutils.isempty (useragent)) { = otherutils.getuseragent (null); } // httpprotocolparams.setuseragent (params, useragent);
In this way, you do not need to consider the proxy settings at this level of code.
[Android] Open source framework xutils httputils proxy settings (temporary redirect error)