dqx76962 2013-08-13 07:39
浏览 43
已采纳

处理发布请求

yesterday i started brainstorm for a project of mine and I'm not sure if its the correct approach. On my website I'm having an (kind of an order form) which sends a post to a target URL, which works with a simple curl php script. The target is an external service (where I have no access no rights, nothing). I only know that I will get a POST with further processed data back from the service, which I have to save into my DB.

in steps:

  1. Users fills out the (order) form and posts data to an external url on my website.

  2. data gets externally handled and after finishing that resents a post.

  3. read incoming post data.

  4. save data into DB.

  5. Success page on my website.

My thoughts were to handle the incoming data with a servlet (spring maven project) but I'm not sure if this is a correct approach. Is there a better why to do this. Or is the first step with the php scripts wrong. thx for any help.

  • 写回答

2条回答 默认 最新

  • dps123456789 2013-08-13 07:55
    关注

    A simplest workflow could be 1. Forward the initial (Order form with values) request to a servlet 2. Invoke a post request using java to an external url inside this servlet (Using Apache http client, or libraries such as HTMLUnit) 3. Once you get the incoming response in your servlet, you can update your database.

    If you are using spring, the controller could forward initial request to a business class which will handle this post processing and delegate the database update to respective DAO.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算