Skip to content

Commit

Permalink
Update: add feature: JSON response.
Browse files Browse the repository at this point in the history
  • Loading branch information
bostjans committed Jun 17, 2021
1 parent 407c0f9 commit 462f0a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: d20210613a
release_name: Release_d20210613a
tag_name: d20210616a
release_name: Release_d20210616a
body: |
Release testing - ${{ github.ref }} ..
draft: false
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: r1_2_0b
release_name: Release_1.2.0b
tag_name: r1_2_1
release_name: Release_1.2.1
body: |
Release - ${{ github.ref }}
Update libs.
Return JSON Response.
draft: false
prerelease: false

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- project coordinates.. -->
<groupId>com.stupica.base</groupId>
<artifactId>servletMirror</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<packaging>war</packaging>
<name>servletMirror</name>
<organization>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/stupica/servlet/http/Mirror.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ protected void doRequestMirror(String asMethod, HttpServletRequest request, Http
if (sTemp.toLowerCase().contains("xml"))
bResponseXml = true;
}
// Assume: if input Content-Type is JSON then produce Response in JSON
sTemp = request.getHeader("Content-Type");
if (!UtilString.isEmptyTrim(sTemp)) {
if (sTemp.toLowerCase().contains("json")) {
bResponseJson = true;
objResponseJson = Json.object();
}
if (sTemp.toLowerCase().contains("xml"))
bResponseXml = true;
}

sResponse.append("Method: ");
if (asMethod.contentEquals(HTTP_METHOD_NAME_GET)) {
Expand Down

0 comments on commit 462f0a6

Please sign in to comment.