从JSP重定向的类型为待定,状态为已取消 [英] redirect from JSP is in type pending and status canceled
本文介绍了从JSP重定向的类型为待定,状态为已取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个JSP文件正在调用REST
后期调用,该调用执行到远程服务器的操作.
该请求正在处理中,但在远程计算机中处于挂起状态,状态为已取消.
你能帮忙吗?
I'm having a JSP file that is calling a REST
post call which doing a get to a remote server.
the request is being processed but get pending in the remote machine in status canceled.
can you please assist?
这是JSP的一部分:`
here is part of the JSP:`
<tr>
<td><button id="registerBtn" onclick="registerClick()">Register</button></td>
<td><button id="loginBtn" onclick="postOnClick()">Log in</button></td>
</tr>
</table>
<script type='text/javascript'>
function registerClick() {
/* var params = "{realm: astra, subjectId: " + document.getElementById('usrInpt').value + " , authInfo: omsspass}"; */
var first = document.getElementById('firstNameInpt').value;
var last = document.getElementById('lastNameInpt').value;
var user = document.getElementById('usrInpt').value;
var password = document.getElementById('passInpt').value;
var email = document.getElementById('emailInpt').value;
var http = new XMLHttpRequest();
var url = "http://localhost:8080/authJ/v0/authJ/users?realm=JOES_PIZZA&uid=" + user +"&firstname=" + first + "&lastname=" + last + "&password=" + password + "&email=" + email;
//var params = "{realm: astra, subjectId: " + document.getElementById('usrInpt').value + " , authInfo: omsspass}";
http.open("POST", url, true);
//http.setRequestHeader("Content-type", "application/json");
http.onreadystatechange = function() {
if (http.readyState == 4 && http.status == 200) {
document.open();
document.write(http.responseText);
}
};
http.send();
}
</script>`
这是Java代码
:`@POST
@Path("/users")
public Response createUser(@QueryParam("uid")String uid, @QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName, @QueryParam("email")String email,
@QueryParam("password")String password, @QueryParam("realm") String realm) {
//readProperties();
String tokenID = getToken();
StringBuffer openAmUrl = new StringBuffer().append("http://").append(openAmIp).append(openAmWarName).append("/identity/create?");
openAmUrl.append("identity_name=").append(uid);
openAmUrl.append("&identity_attribute_names=userpassword");
openAmUrl.append("&identity_attribute_values_userpassword=").append(password);
openAmUrl.append("&identity_attribute_names=sn");
openAmUrl.append("&identity_attribute_values_sn=").append(lastName);
openAmUrl.append("&identity_attribute_names=cn");
openAmUrl.append("&identity_attribute_values_cn=").append(firstName);
openAmUrl.append("&identity_realm=/").append(realm);
openAmUrl.append("&identity_type=user");
if (email != null){
openAmUrl.append("&identity_attribute_names=mail");
openAmUrl.append("&identity_attribute_values_mail=").append(email);
}
openAmUrl.append("&admin=").append(tokenID);
URI uri = null;
try {
uri = new URI(openAmUrl.toString());
} catch (URISyntaxException e) {
LOGGER.error("Exception " + e);
e.printStackTrace();
}
return Response.seeOther(uri).build();
}
`
提前谢谢!
推荐答案
我发现了由于跨域问题-我通过编辑浏览器的执行文件来解决此问题,该文件将在没有安全性的情况下启动-(--disable-网络安全)希望这对其他人有帮助!
I found the problem it is due to Cross Domain - I fix it by edit the execute file of the browser that will launch without security - (--disable-web-security) hope this is help for others!
这篇关于从JSP重定向的类型为待定,状态为已取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文