Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

502 Bad Gateway error during process

906169Dec 19 2011 — edited Dec 20 2011
Hello.
I'm working on application in JSF to processing XLS files. When time of process is longer than 5 minutes web browser returns 502 Bad Gateway error, but process is still working on the server side. The problem is because of outbound socket timeout (value of timeout can not be changed).
I tried using JavaScript and Ajax request in JSP page, but it still doesn't work.

JSP page code:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>XLS maker</title>

<script language="JavaScript">
function wait(){
alert("Click OK and wait.");
}
</script>

<script type="text/javascript">
function loadXMLDoc()
{

var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;

}
}
xmlhttp.open("POST","test.txt",true);
xmlhttp.send(null);
}

var c=0;

function myLoop(){
c++;
loadXMLDoc();
document.getElementById("counter").innerHTML=c;
setTimeout("myLoop()", 1000);
}
</script>

</head>
<body onload="myLoop()">
<%@ include file="/WEB-INF/template/header2.jsp" %>
<center>
<h2><font face="Arial" size="2">Choose file:</font></h2>
<h:form>
<t:inputFileUpload id="fileupload" value="#{Bean.input}" required="true"/>
<t:commandButton value="Make process" action="#{Bean.makeProcess}" onclick="wait();"/>
<t:outputText value="#{Bean.result}" /><br></br>
</h:form>
</center>
<%@ include file="/WEB-INF/template/footer.jsp" %>
<div id="myDiv"></div>
<div id="counter"></div>
</body>
</html>
</f:view>

Please help.

Regards,
Michael

Edited by: user10228260 on 2011-12-19 03:23
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2012
Added on Dec 19 2011
5 comments
2,394 views