Skip to content

Commit

Permalink
Update: fix reading From data.
Browse files Browse the repository at this point in the history
  • Loading branch information
bostjans committed Jun 10, 2022
1 parent 462f0a6 commit 497d127
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,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: r1_2_1
release_name: Release_1.2.1
tag_name: r1_2_2
release_name: Release_1.2.2
body: |
Release - ${{ github.ref }}
Return JSON Response.
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/com/stupica/servlet/http/Mirror.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.*;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
Expand Down Expand Up @@ -186,6 +183,7 @@ protected void doOptions(HttpServletRequest request, HttpServletResponse respons
protected void doRequestMirror(String asMethod, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Local variables
int iResult;
boolean bRequestForm = false;
boolean bResponseJson = false;
boolean bResponseXml = false;
String sTemp;
Expand Down Expand Up @@ -219,6 +217,8 @@ protected void doRequestMirror(String asMethod, HttpServletRequest request, Http
}
if (sTemp.toLowerCase().contains("xml"))
bResponseXml = true;
if (sTemp.toLowerCase().contains("x-www-form-urlencoded"))
bRequestForm = true;
}

sResponse.append("Method: ");
Expand Down Expand Up @@ -278,7 +278,7 @@ protected void doRequestMirror(String asMethod, HttpServletRequest request, Http
response.setContentType("text/plain; charset=UTF-8");
response.setCharacterEncoding("UTF-8");

sHttpData = getReportText(request, asMethod, objResponseJson);
sHttpData = getReportText(request, asMethod, objResponseJson, bRequestForm);
if (UtilString.isEmptyTrim(sHttpData)) {
objResult.sText = "doRequest(): Request info. not collected! Status: " + response.getStatus();
logger.warning(objResult.sText);
Expand Down Expand Up @@ -320,7 +320,8 @@ protected void doRequestMirror(String asMethod, HttpServletRequest request, Http
}


protected String getReportText(HttpServletRequest request, String asMethod, JsonObject aobjResponseJson) {
protected String getReportText(HttpServletRequest request, String asMethod, JsonObject aobjResponseJson,
boolean abRequestForm) {
// Local variables
int iResult;
boolean bResponseJson = false;
Expand Down Expand Up @@ -514,7 +515,7 @@ protected String getReportText(HttpServletRequest request, String asMethod, Json

// Check previous step
if (iResult == ConstGlobal.RETURN_OK) {
iResult = readRequestData(request, sDataPayload);
iResult = readRequestData(request, sDataPayload, abRequestForm);
}
if (iResult == ConstGlobal.RETURN_OK) {
if (bResponseJson)
Expand Down

0 comments on commit 497d127

Please sign in to comment.