完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
创建一个与所有动态页面的服务器应用程序。使用WICED宏观start_of_http_page_database定义所有可能的网页和页面回调。在我们的应用程序可以把页面一般只有一个回调为我们所有的页面-依靠事实WICED将回调函数提供具体的文件名和/或数据需要。
因为我们会有很多页,(比如下图所示)我宁愿在网页数据库使用通配符语法,见下文。似乎有一个与此有关的问题。 如果一个职位要求,我们解析数据(在回调参数http_data部分)对一些关键词具体到我们的应用。然后我们读文件作为参数url_path从我们的嵌入式文件系统通过服务,通过API wiced_http_response_stream_write WICED。问题是有时一个POST请求超过两包分。在第一个数据包的文件名是正确的,但没有数据连接,http_data - >;message_data_length = 0。随后的分组将有数据但现在的文件名不正确,它是指定的网页数据的基础上,“.html”。如果我不在数据库中使用通配符和明确的所有可能的文件一切正常填充它。前进,我们可能有数百页的可能所以通配符在网页数据库的使用是必要的。 /我们的页面回调签名… 静态int32_t pagecallback(const char * url_path,const char * url_parameters,wiced_http_response_stream_t *流,void *参数,wiced_http_message_body_t * http_data) / /例子网页数据的基础当所有文件明确定义的一部分 Oracle HypPyPaGySQL数据库(Apple WebType) RoTutHyppApGeQueReDead(“/NoxHMe.HTM”) {“/ upload_a .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,postupload },}, {“/ buftmp .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,postupload },}, {“/ buftmp1 .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,postupload },}, {“/ buftmp2 .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,个},}, {“/ buftmp3 .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,postupload },}, {“/ filepost .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,postupload },}, / /的例子,我们的网页数据库使用通配符的一部分 Oracle HypPyPaGySQL数据库(Apple WebType) root_http_page_redirect(“/ indexhme .htm”),/真正的家 {“/ * .htm”、“text/html”,wiced_dynamic_url_content,。url_content.dynamic_data = { pagecallback,postupload },},/ / DAT文件 以上来自于百度翻译 以下为原文 Creating a server application with all dynamic pages.Using the WICED macro START_OF_HTTP_PAGE_DATABASE to define all the possible web pages and page callbacks. In our app can treat the pages generically so only a single callback needed for all our pages - relying on the fact that WICED will provide the specific filename and/or data to the callback function. Since we will have many pages (more than shown below) I would prefer to use wildcard syntax in the web page data base, see below. There appears to be a WICED problem related to this. If a POST request, we parse the data (part of the parameter http_data in the callback) for some keywords specific to our application. Then we read the file passed as parameter url_path from our embedded file system and serve that via the WICED api wiced_http_response_stream_write. The problem is sometimes a POST request is divided over 2 packets. In the first packet the file name is correct, but no data is attached, http_data->message_data_length = 0. The subsequent packet will have the data but now the filename is incorrect, it is as specified in the web page data base, "*.html". If I do not use wildcard characters in the data base and populate it explicitly with all the possible files everything works as expected. Moving forward we may have hundreds of possible pages so the use of wildcard in the web page data base is needed. // signature of our page callback..... static int32_t pageCallback(const char* url_path, const char* url_parameters, wiced_http_response_stream_t* stream, void* arg, wiced_http_message_body_t * http_data ) // example of a portion of web page data based when all files explicitly defined START_OF_HTTP_PAGE_DATABASE(ap_web_pages) ROOT_HTTP_PAGE_REDIRECT("/indexhme.htm"), { "/upload_a.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpload}, }, { "/buftmp.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpload}, }, { "/buftmp1.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpload}, }, { "/buftmp2.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpdate}, }, { "/buftmp3.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpload}, }, { "/filepost.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpload}, }, // example of a [size=13.3333px]portion of our web page database [size=13.3333px]using wildcard START_OF_HTTP_PAGE_DATABASE(ap_web_pages) ROOT_HTTP_PAGE_REDIRECT("/indexhme.htm"), // real home { "/*.htm", "text/html", WICED_DYNAMIC_URL_CONTENT, .url_content.dynamic_data = { pageCallback,PostUpload}, }, // DAT file |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2075 浏览 1 评论
1829 浏览 1 评论
3643 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1766 浏览 6 评论
1517 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
516浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
370浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
413浏览 2评论
360浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
867浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 01:15 , Processed in 1.245890 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号