Skip to content

Commit 823b74b

Browse files
committed
update file upload example
1 parent 86544dd commit 823b74b

23 files changed

+270
-192
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
frontend
2-
src
1+
src/main/frontend
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM open-liberty:kernel-java11
22
COPY --chown=1001:0 target/jakarta-ee-react-file-handling.war /config/dropins/
3-
COPY --chown=1001:0 server.xml /config
3+
COPY --chown=1001:0 src/main/liberty/config/server.xml /config

jakarta-ee-react-file-handling/pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
<type>pom</type>
3535
<scope>provided</scope>
3636
</dependency>
37+
<!--
38+
<dependency>
39+
<groupId>org.apache.cxf</groupId>
40+
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
41+
<version>3.3.4</version>
42+
</dependency>
43+
-->
3744
<dependency>
3845
<groupId>org.junit.jupiter</groupId>
3946
<artifactId>junit-jupiter</artifactId>

jakarta-ee-react-file-handling/server.xml

-12
This file was deleted.

jakarta-ee-react-file-handling/src/main/frontend/package-lock.json

+124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jakarta-ee-react-file-handling/src/main/frontend/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"react": "^16.12.0",
1414
"react-dom": "^16.12.0",
1515
"react-scripts": "3.3.0",
16+
"semantic-ui-css": "^2.4.1",
17+
"semantic-ui-react": "^0.88.2",
1618
"typescript": "^3.7.3"
1719
},
1820
"scripts": {
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,27 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<meta name="theme-color" content="#000000" />
8-
<meta
9-
name="description"
10-
content="Web site created using create-react-app"
11-
/>
12-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13-
<!--
14-
manifest.json provides metadata used when your web app is installed on a
15-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16-
-->
17-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18-
<!--
19-
Notice the use of %PUBLIC_URL% in the tags above.
20-
It will be replaced with the URL of the `public` folder during the build.
21-
Only files inside the `public` folder can be referenced from the HTML.
3+
<head>
4+
<meta charset="utf-8"/>
5+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
6+
<meta name="theme-color" content="#000000"/>
7+
<meta
8+
name="description"
9+
content="Web site created using create-react-app"
10+
/>
11+
<title>Jakarta EE & React</title>
12+
</head>
13+
<body>
14+
<noscript>You need to enable JavaScript to run this app.</noscript>
15+
<div id="root"></div>
16+
<!--
17+
This HTML file is a template.
18+
If you open it directly in the browser, you will see an empty page.
2219
23-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24-
work correctly both with client-side routing and a non-root public URL.
25-
Learn how to configure a non-root public URL by running `npm run build`.
26-
-->
27-
<title>React App</title>
28-
</head>
29-
<body>
30-
<noscript>You need to enable JavaScript to run this app.</noscript>
31-
<div id="root"></div>
32-
<!--
33-
This HTML file is a template.
34-
If you open it directly in the browser, you will see an empty page.
20+
You can add webfonts, meta tags, or analytics to this file.
21+
The build step will place the bundled scripts into the <body> tag.
3522
36-
You can add webfonts, meta tags, or analytics to this file.
37-
The build step will place the bundled scripts into the <body> tag.
38-
39-
To begin the development, run `npm start` or `yarn start`.
40-
To create a production bundle, use `npm run build` or `yarn build`.
41-
-->
42-
</body>
23+
To begin the development, run `npm start` or `yarn start`.
24+
To create a production bundle, use `npm run build` or `yarn build`.
25+
-->
26+
</body>
4327
</html>
Loading
Binary file not shown.
Binary file not shown.

jakarta-ee-react-file-handling/src/main/frontend/public/manifest.json

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export class ApiClient {
2+
3+
uploadFile(file: File) {
4+
let data = new FormData();
5+
data.append('file', file);
6+
data.append('name', file.name);
7+
8+
return fetch('http://localhost:9080/resources/files', {
9+
method: 'POST',
10+
body: data
11+
});
12+
}
13+
14+
downloadRandomFile() {
15+
return fetch('http://localhost:9080/resources/files');
16+
}
17+
}

0 commit comments

Comments
 (0)