Skip to content

Commit bd02133

Browse files
authored
[add]: sample java app with xml resposne (#85)
* [add]: sample java app with xml resposne Signed-off-by: AhmedLotfy02 <ahmadlotfygamersfield@gmail.com> * [add]: readme Signed-off-by: AhmedLotfy02 <ahmadlotfygamersfield@gmail.com> --------- Signed-off-by: AhmedLotfy02 <ahmadlotfygamersfield@gmail.com>
1 parent f53c5ca commit bd02133

File tree

12 files changed

+664
-0
lines changed

12 files changed

+664
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<h1>Sample java spring boot with xml</h1>
2+
<p>This project is a Spring Boot application that serves a simple REST API endpoint returning XML responses.</p>
3+
4+
<h2>How to Run</h2>
5+
<p>Ensure you have Java 17 installed. Then, follow these steps:</p>
6+
<ol>
7+
<li>Clone the repository </li>
8+
<li>Navigate into the project directory</li>
9+
<li>Build the project: <code>mvn clean install</code></li>
10+
<li>Run the application: <code>mvn spring-boot:run</code></li>
11+
</ol>
12+
13+
<h2>API Endpoints</h2>
14+
<h3>Get User (Returns XML)</h3>
15+
<p>Endpoint: <code>GET /api/user</code></p>
16+
17+
<h3>Testing with Curl</h3>
18+
<p>To make a request using <code>curl</code>, use the following command:</p>
19+
<pre>
20+
<code>curl -X GET -H "Accept: application/xml" http://localhost:8080/api/user</code>
21+
</pre>
22+
23+
<h2>Expected XML Response</h2>
24+
<pre>
25+
<code>
26+
&lt;User&gt;
27+
&lt;name&gt;John Doe&lt;/name&gt;
28+
&lt;age&gt;30&lt;/age&gt;
29+
&lt;phone&gt;0101233333&lt;/phone&gt;
30+
&lt;/User&gt;
31+
</code>
32+
</pre>
33+
34+
<h2>Dependencies</h2>
35+
<ul>
36+
<li>Spring Boot</li>
37+
<li>Spring Web</li>
38+
<li>JAXB for XML serialization</li>
39+
</ul>

spring-boot-xml/naive-spring-boot/mvnw

Lines changed: 259 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)