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 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失