-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZK-5650: cannot upload an image under websocket
- Loading branch information
1 parent
3e0716c
commit cf3ff0a
Showing
7 changed files
with
92 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<zk> | ||
<listener> | ||
<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class> | ||
</listener> | ||
</zk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
B100-ZK-5650.zul | ||
Purpose: | ||
Description: | ||
History: | ||
Tue Feb 20 09:59:26 CST 2024, Created by rebeccalai | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk> | ||
<label multiline="true"> | ||
1. Enable websocket connection with | ||
<listener> | ||
<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class> | ||
</listener> | ||
2. Open developer tools to observe network. | ||
3. Dropupload a file, should observe an XMLHttpRequest and see its file name in zk log. | ||
</label> | ||
<dropupload content="Dropupload a file" detection="none"> | ||
<attribute name="onUpload"><![CDATA[ | ||
import org.zkoss.util.media.Media; | ||
for (Media media : event.getMedias()) { | ||
Clients.log(media.getName()); | ||
} | ||
]]></attribute> | ||
</dropupload> | ||
</zk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
zktest/src/test/java/org/zkoss/zktest/zats/test2/B100_ZK_5650Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* B100_ZK_5650Test.java | ||
Purpose: | ||
Description: | ||
History: | ||
Tue Feb 20 10:02:46 CST 2024, Created by rebeccalai | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.zats.test2; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.nio.file.Paths; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import org.zkoss.test.webdriver.ExternalZkXml; | ||
import org.zkoss.test.webdriver.ForkJVMTestOnly; | ||
import org.zkoss.test.webdriver.WebDriverTestCase; | ||
|
||
@ForkJVMTestOnly | ||
public class B100_ZK_5650Test extends WebDriverTestCase { | ||
@RegisterExtension | ||
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/B100-ZK-5650-zk.xml"); | ||
|
||
@Test | ||
public void test() throws Exception { | ||
connect(); | ||
waitResponse(); | ||
dropUploadFile(jq("@dropupload"), Paths.get("src/main/webapp/test2/img/sun.jpg")); | ||
waitResponse(); | ||
assertEquals("sun.jpg", getZKLog()); | ||
} | ||
} |