www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -0,0 +1,115 @@
|
|||
package it.acxent.gtbill.servlet;
|
||||
|
||||
import it.acxent.gtbill.GTBillReq;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GTBillSvlt extends AcServlet {
|
||||
private static final long serialVersionUID = 6201212373211424420L;
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_SELLA_RES = "sellaResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GTBillReq gtbillreq = new GTBillReq();
|
||||
fillObject(req, gtbillreq);
|
||||
String theUrl = "https://sale.GTBill.com/quickpay2.aspx";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("?MerchantID=");
|
||||
sb.append(getApFull().getParm("GTBILL_MERCHANT_ID"));
|
||||
sb.append("&SiteID=");
|
||||
sb.append(getApFull().getParm("GTBILL_SITE_ID"));
|
||||
sb.append("&AmountTotal=");
|
||||
sb.append(gtbillreq.getMyamounttotal());
|
||||
sb.append("&CurrencyID=");
|
||||
sb.append("EUR");
|
||||
sb.append("&AmountShipping=");
|
||||
sb.append(gtbillreq.getMyamountshipping());
|
||||
sb.append("&ReturnURL=");
|
||||
sb.append(getApFull().getParm("GTBILL_RETURN_URL"));
|
||||
sb.append("&ItemAmount[0]=");
|
||||
sb.append(gtbillreq.getMyitemamount());
|
||||
sb.append("&ItemDesc[0]=");
|
||||
sb.append(gtbillreq.getMyitemdesc());
|
||||
sb.append("&ItemName[0]=");
|
||||
sb.append(gtbillreq.getMyitemname());
|
||||
sb.append("&ItemQuantity[0]=");
|
||||
sb.append(gtbillreq.getMyitemquantity());
|
||||
URL url = new URL(theUrl + theUrl);
|
||||
System.out.println("startremotecmd: chiamata a " + theUrl +
|
||||
sb.toString());
|
||||
HttpURLConnection connection = (HttpURLConnection)
|
||||
url.openConnection();
|
||||
BufferedReader read = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line = read.readLine();
|
||||
String html = "";
|
||||
while (line != null) {
|
||||
html = html + html;
|
||||
line = read.readLine();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceEsercente(HttpServletRequest req) {
|
||||
return getParm("COD_ESER_SELLA").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue