Skip to content

Commit fa025bb

Browse files
committed
update demo
1 parent 6d6d6d5 commit fa025bb

File tree

3 files changed

+21
-28
lines changed

3 files changed

+21
-28
lines changed

SpringBootDemo/SpringBoot+React/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ repositories {
2828
mavenCentral()
2929
}
3030

31-
3231
dependencies {
3332
compile('org.springframework.boot:spring-boot-starter-web')
3433

@@ -41,3 +40,10 @@ dependencies {
4140
compile('com.grapecity.documents:gcexcel:2.0.1')
4241
//compile fileTree(dir: 'libs', include: ['*.jar'])
4342
}
43+
44+
task clientBuild(type: GradleBuild){
45+
buildFile = "./client/build.gradle"
46+
tasks = ['webpack']
47+
}
48+
49+
processResources.dependsOn 'clientBuild'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
id "com.moowork.node" version "1.2.0"
3+
}
4+
5+
node {
6+
version = '8.12.0'
7+
download = false
8+
}
9+
10+
task webpack(type: NodeTask, dependsOn: 'npmInstall') {
11+
script = project.file('./node_modules/webpack/bin/webpack.js')
12+
args = ['--config', "./webpack.config.js"]
13+
}

SpringBootDemo/SpringBoot+React/src/main/java/com/grapecity/documents/demo/controller/GcExcelController.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public String open(HttpServletRequest request) {
5858
Workbook workbook = new Workbook();
5959

6060
try {
61-
workbook.open(this.convertStream(request.getInputStream()));
61+
workbook.open(request.getInputStream());
6262
}
6363
catch (IOException e) {
6464
// TODO Auto-generated catch block
@@ -67,32 +67,6 @@ public String open(HttpServletRequest request) {
6767

6868
return workbook.toJson();
6969
}
70-
71-
/**
72-
* This is a workaround method for gcexcel v2.0.0.
73-
* HttpServletRequest.getInputStream() returns a stream instance of CoyoteInputStream.
74-
* It causes exception when directly opened by Workbook.
75-
*
76-
* This bug will be fixed in next release.
77-
* @param requestStream
78-
* @return
79-
* @throws IOException
80-
*/
81-
private InputStream convertStream(InputStream requestStream) throws IOException {
82-
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
83-
84-
byte[] buffer = new byte[8 * 1024];
85-
int bytesRead;
86-
while ((bytesRead = requestStream.read(buffer)) != -1) {
87-
outputStream.write(buffer, 0, bytesRead);
88-
}
89-
90-
outputStream.flush();
91-
InputStream result = new ByteArrayInputStream(outputStream.toByteArray());
92-
93-
outputStream.close();
94-
return result;
95-
}
9670

9771
@RequestMapping(value = "/save")
9872
public void save(HttpServletRequest request, HttpServletResponse response) {

0 commit comments

Comments
 (0)