从动作脚本代码发出的请求中提取java servlet中的url参数

时间:2015-02-17 19:46:35

标签: actionscript-3 servlets actionscript

我无法将数据从动作脚本

发出的请求传递给我的servlet代码

以下是我的动作脚本代码的外观

var variables:URLVariables = new URLVariables();
variables.sessionId = sessionId;
variables.userName = userName;
variables.allExtensions = allExtensions;
variables.redirectPath = redirectPath;

var urlRoute:URLRequest = new URLRequest(endPointUrl +"-standalone");
urlRoute.data = variables;
urlRoute.method = URLRequestMethod.POST;
navigateToURL(urlRoute, "_blank");

Java servlet代码如下所示

public class StandaloneRedirectServlet extends HttpServlet {

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)  
throws ServletException, IOException 
{

    //All of these are null
    String sessionId = req.getParameter("sessionId");
    String userName = req.getParameter("userName");
    String allExtensions = req.getParameter("allExtensions");
    String redirectPath = req.getParameter("redirectPath");

    //Set cookie

    //Redirect
    resp.sendRedirect("http://www.google.com"); //This would redirect to redirectPath eventually. For testing, I am using google.com
}

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    this.doPost(req,resp);
}

我知道URLVariables(sessionId,userName等)从动作脚本端设置为有效值。但是在java方面,当我提取参数时,我得到所有的空值。我显然不理解将参数传递到服务器端点的正确方法,并且感谢任何帮助。

谢谢

0 个答案:

没有答案