Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
8c3afbcd
Commit
8c3afbcd
authored
May 05, 2016
by
wanddy
Committed by
Evan W. Patton
Oct 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement ResponseTextEncoding property for Web component
Change-Id: I62e4acf4abec9e71f5d2804db9f381c5a2877bae
parent
760770dc
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
7 deletions
+48
-7
appinventor/appengine/src/com/google/appinventor/client/OdeMessages_zh_CN.properties
...om/google/appinventor/client/OdeMessages_zh_CN.properties
+1
-0
appinventor/appengine/src/com/google/appinventor/client/youngandroid/YoungAndroidFormUpgrader.java
...nventor/client/youngandroid/YoungAndroidFormUpgrader.java
+5
-0
appinventor/blocklyeditor/src/versioning.js
appinventor/blocklyeditor/src/versioning.js
+4
-1
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
...c/com/google/appinventor/components/common/YaVersion.java
+6
-3
appinventor/components/src/com/google/appinventor/components/runtime/Web.java
...ts/src/com/google/appinventor/components/runtime/Web.java
+27
-3
appinventor/docs/html/reference/components/connectivity.html
appinventor/docs/html/reference/components/connectivity.html
+2
-0
appinventor/docs/markdown/reference/components/connectivity.md
...ventor/docs/markdown/reference/components/connectivity.md
+3
-0
No files found.
appinventor/appengine/src/com/google/appinventor/client/OdeMessages_zh_CN.properties
View file @
8c3afbcd
...
...
@@ -640,6 +640,7 @@ ReverseDirectionProperties = 方向倒转
SensorValueChangedEventEnabledProperties
=
启用传感器值改变事件
TachoCountChangedEventEnabledProperties
=
启用角度改变事件
UnitProperties
=
单位
ResponseTextEncodingProperties
=
响应内容字符编码
#Parameters
xAccelParams
=
X分量
...
...
appinventor/appengine/src/com/google/appinventor/client/youngandroid/YoungAndroidFormUpgrader.java
View file @
8c3afbcd
...
...
@@ -1882,6 +1882,11 @@ public final class YoungAndroidFormUpgrader {
// No properties need to be modified to upgrade to version 8.
srcCompVersion
=
8
;
}
if
(
srcCompVersion
<
9
)
{
// The ResponseTextEncoding property was added.
// Properties related to this component have now been upgraded to version 9
srcCompVersion
=
9
;
}
return
srcCompVersion
;
}
...
...
appinventor/blocklyeditor/src/versioning.js
View file @
8c3afbcd
...
...
@@ -3386,7 +3386,10 @@ Blockly.Versioning.AllUpgradeMaps =
7
:
"
noUpgrade
"
,
// AI2: Added methods PatchText, PatchTextWithEncoding, and PatchFile
8
:
"
noUpgrade
"
8
:
"
noUpgrade
"
,
// AI2: Added ResponseTextEncoding property
9
:
"
noUpgrade
"
},
// End Web upgraders
...
...
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
View file @
8c3afbcd
...
...
@@ -583,8 +583,9 @@ public class YaVersion {
// - REGRESSION_COMPONENT_VERSION was introduced
// - TEXTTOSPEEECH_COMPONENT_VERSION was incremented to 6
// - TINYDB_COMPONENT_VERSION was incremented to 3
public
static
final
int
YOUNG_ANDROID_VERSION
=
224
;
// For YOUNG_ANDROID_VERSION 225:
// - WEB_COMPONENT_VERSION was incremented to 9
public
static
final
int
YOUNG_ANDROID_VERSION
=
225
;
// ............................... Blocks Language Version Number ...............................
...
...
@@ -1534,7 +1535,9 @@ public class YaVersion {
// - The XMLTextDecodeAsDictionary method was added.
// For WEB_COMPONENT_VERSION 8:
// - PATCH methods added (PatchText, PatchTextWithEncoding, and PatchFile).
public
static
final
int
WEB_COMPONENT_VERSION
=
8
;
// For WEB_COMPONENT_VERSION 9:
// - Added property ResponseTextEncoding
public
static
final
int
WEB_COMPONENT_VERSION
=
9
;
// For WEBVIEWER_COMPONENT_VERSION 2:
// - The CanGoForward and CanGoBack methods were added
...
...
appinventor/components/src/com/google/appinventor/components/runtime/Web.java
View file @
8c3afbcd
...
...
@@ -241,6 +241,7 @@ public class Web extends AndroidNonvisibleComponent implements Component,
// Set of observers
private
HashSet
<
DataSourceChangeListener
>
dataSourceObservers
=
new
HashSet
<>();
private
String
responseTextEncoding
=
"UTF-8"
;
/**
* Creates a new Web component.
...
...
@@ -286,6 +287,25 @@ public class Web extends AndroidNonvisibleComponent implements Component,
urlString
=
url
;
}
/**
* Returns the Response Text Encoding.
*/
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
description
=
"User-specified character encoding for web response."
)
public
String
ResponseTextEncoding
()
{
return
responseTextEncoding
;
}
/**
* Specifies the Response Text Encoding.
*/
@DesignerProperty
(
editorType
=
PropertyTypeConstants
.
PROPERTY_TYPE_STRING
,
defaultValue
=
"UTF-8"
)
@SimpleProperty
public
void
ResponseTextEncoding
(
String
encoding
)
{
responseTextEncoding
=
encoding
;
}
/**
* The request headers, as a list of two-element sublists. The first element of each sublist
* represents the request header field name. The second element of each sublist represents the
...
...
@@ -1241,7 +1261,7 @@ public class Web extends AndroidNonvisibleComponent implements Component,
}
});
}
else
{
final
String
responseContent
=
getResponseContent
(
connection
);
final
String
responseContent
=
getResponseContent
(
connection
,
responseTextEncoding
);
// Dispatch the event.
activity
.
runOnUiThread
(
new
Runnable
()
{
...
...
@@ -1431,11 +1451,15 @@ public class Web extends AndroidNonvisibleComponent implements Component,
}
}
private
static
String
getResponseContent
(
HttpURLConnection
connection
)
throws
IOException
{
private
static
String
getResponseContent
(
HttpURLConnection
connection
,
String
encodingProperty
)
throws
IOException
{
// Use the content encoding to convert bytes to characters.
String
encoding
=
connection
.
getContentEncoding
();
if
(
encoding
==
null
)
{
if
(
encodingProperty
==
null
||
encodingProperty
.
isEmpty
())
{
encoding
=
"UTF-8"
;
}
else
{
encoding
=
encodingProperty
;
}
}
InputStreamReader
reader
=
new
InputStreamReader
(
getConnectionStream
(
connection
),
encoding
);
try
{
...
...
appinventor/docs/html/reference/components/connectivity.html
View file @
8c3afbcd
...
...
@@ -531,6 +531,8 @@ set the following properties:
<dd>
Specifies the name of the file where the response should be saved.
If SaveResponse is true and ResponseFileName is empty, then a new file
name will be generated.
</dd>
<dt
id=
"Web.ResponseTextEncoding"
class=
"text"
><em>
ResponseTextEncoding
</em></dt>
<dd>
Specifies the Response Text Encoding.
</dd>
<dt
id=
"Web.SaveResponse"
class=
"boolean"
><em>
SaveResponse
</em></dt>
<dd>
Specifies whether the response should be saved in a file.
</dd>
<dt
id=
"Web.Timeout"
class=
"number"
><em>
Timeout
</em></dt>
...
...
appinventor/docs/markdown/reference/components/connectivity.md
View file @
8c3afbcd
...
...
@@ -471,6 +471,9 @@ Non-visible component that provides functions for HTTP GET, POST, PUT, and DELET
If SaveResponse is true and ResponseFileName is empty, then a new file
name will be generated.
{:id="Web.ResponseTextEncoding" .text} *ResponseTextEncoding*
: Specifies the Response Text Encoding.
{:id="Web.SaveResponse" .boolean} *SaveResponse*
: Specifies whether the response should be saved in a file.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment