Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2d965f

Browse files
Allow extended classes to access Base64 algorithm
Update user agent
1 parent db879f4 commit a2d965f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/HttpRequest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public class HttpRequest {
5858
* @see Preferences
5959
* @since 1.4
6060
*/
61-
static class Base64 {
61+
protected static class Base64 {
6262
/**
6363
* Translates the specified byte array into a Base64 string as per
6464
* Preferences.put(byte[]).
6565
*/
66-
static String byteArrayToBase64(byte[] a) {
66+
public static String byteArrayToBase64(byte[] a) {
6767
int aLen = a.length;
6868
int numFullGroups = aLen/3;
6969
int numBytesInPartialGroup = aLen - 3*numFullGroups;
@@ -443,11 +443,10 @@ private void request() {
443443
connection.setDoInput(true);
444444
connection.setRequestMethod(method);
445445
connection.setRequestProperty("User-Agent",
446-
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5");
446+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36");
447447
if ("post".equalsIgnoreCase(method)) {
448448
connection.setDoOutput(true);
449-
connection.setRequestProperty("Content-Type",
450-
"application/x-www-form-urlencoded");
449+
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
451450
}
452451
if (user != null) {
453452
String auth = user + ":" + (password != null ? password : "");

0 commit comments

Comments
 (0)