问题标签 [get-request]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - xmlHttpRequest GET/POST 与 Spring MVC
我正在尝试找到使用 POST 请求的解决方法,因为我无法使用表单、传递参数并重定向到另一个页面而不在 URL 中显示参数。我听说可以通过 XHR GET 请求来做到这一点,但我不知道怎么做。我也用 POST 尝试过。
Index.jsp(Peter 是我通过表单进行 POST 的示例,它有效,但我不能使用。George 是我的 GET 示例。我可以看到函数 HttpGet 被调用,responseText 是 helloworld.jsp 的 html。Sam 是我的 POST 示例。我可以看到参数已传递给控制器并添加到 mv,但它没有重定向到 helloworld.jsp。)
控制器:
Helloworld.jsp
我的问题是:1)是否可以使用 XHR 获取或发布而不在 URL 中显示参数?2) 哪个方法(george 或 sam)接近(如果有),我应该查看哪些文件以使其重定向到 helloworld.jsp(控制器或 index.jsp)?谢谢您的帮助。
python - 将 GET 请求中的 URL 发送到 Google App Engine 上的 Python 服务器
我在 Google Apps 引擎上用 Python 编写了一个非常简单的服务器。我希望能够通过 GET 请求向它发送命令,例如"http://myserver.appspot.com/?do=http://webpage.com/?secondary=parameter"
这不起作用,因为辅助参数被单独解释并发送到我的应用程序。有什么帮助吗?
javascript - 使用 Javascript 获取 url 和重定向的 url 请求
我想使用 javascript 来获取我在浏览器中访问的所有 url。例如,如果我访问一个 url,我想获取该 url、它将我重定向到的页面以及任何中间重定向。有没有我可以在javascript中使用的获取请求,它可以只获取那些url(或者另一个可能会得到更多但会是我想要的超集的url)?
objective-c - 使用 AFNetworking 获取 JSON 时遇到问题
所以我最近想从使用 NSUrlConnection 改为使用 AFNetworking。我可以使用这两种方法接收 JSON 数据,但是当与 AFNetworking 一起使用时会发生一些奇怪的事情。
这就是 NSURLConnection 的样子
这就是 AFNetworking 的样子
我不知道 (struct __lidb_autoregen_nspair) 是什么,我不知道这是否是阻止我显示数据的原因
这是来自 AFNetworking 的代码,我使用来自 ray 的示例代码
-------------------------------------------------- - - - - - - - - - - - - - - - - - - - - 编辑
ios - 将 __block 参数传递给类方法(用于获取请求)
我想创建以下类方法:
两个问题:
- 我收到以下错误:变量不可分配(缺少 __block 类型说明符)如何将块设置为方法参数?
- 我应该如何调用这个函数
&self.setMe
?
ios - didFailWithError: Error Domain=kCFErrorDomainCFNetwork Code=303 "GET请求时操作无法完成
调用 Web 服务时出现以下错误。
didFailWithError:错误域=kCFErrorDomainCFNetwork 代码=303“操作无法完成。(kCFErrorDomainCFNetwork 错误 303。)”UserInfo=0x16e505b0 {NSErrorFailingURLKey= http://trac.app.com/api/v1/engine/chat/, NSErrorFailingURLStringKey= http://trac.app.com/api/v1/engine/chat/ }
我的源代码如下:
webservice.m
网络服务调用:viewcontroler1
请帮我解决这个问题。
python - 如何在 HTTP 获取请求中设置用户名和密码?
我已经使用requests
Python 中的库来发送获取请求:
我的假设是可以直接从浏览器发送任何获取请求。例如,在浏览器的地址行中,我需要输入如下内容:
通过上述方式,我可以设置url
并params
在我的 Python 函数中使用它。但是auth
如果我使用浏览器发送请求,如何在获取请求中设置(用户名和密码)。同样的问题适用于剩下的两个论点:verify
和headers
。
ios - 通过 AFNetworking 将图像下载到 UICollectionView
我是 iOS 编程新手。所以我有新手问题。我开始使用 AFNetworking 2,这就是任务:
我有一个请求。它的响应是第二个请求的一部分。这意味着我必须等到第一个请求结束。他们循序渐进。当我得到第二个响应时,我对其进行解析并以http://lalala-xx.jpg格式保存 20 个 URL 。之后我想加载图像并将它们放入 UICollectionView 中,并且我不想在范围内而是在方案“下载->直接到单元格”中进行。我将 URL 和图像保存在单例类中并像访问它们一样访问它们
方法链看起来像
第二种方法:
最后的:
我被困住了。接下来我该怎么办?我有 20 个 URL,但我应该如何下载图像并将它们定向到 ViewController 以更新单元格中的图像?我想 AFNetworkig 可以为我提供一些操作队列。
而且我现在不喜欢我的代码。我使用这个链,但我想要一个独立的方法 2 返回 imgURL。所以它应该看起来:用户按下按钮->方法1->方法2->停止。等到用户按下按钮 -> 下载 image1 -> 显示 image1 -> 下载 image2 -> 显示 image2 -> 等等 -> 下载 imageN -> 显示 imageN -> 停止。我再说一遍,我需要将图像存储在 Array 中,之后我将使用它。谢谢你读到。
///////////////////////////////////// 更新 //////////// ///////////////////////
我找到了解决方案。但这并不能完全满足我。图像随机出现。如何让它们按顺序加载?
ssl - How can I establish a secure channel for SSL/TLS from a handheld device?
I am trying to call a REST method from a handheld device (Windows CE / Compact framework) with this code:
The vals being passed to the method are:
...but I'm unable to make the connection because "Could not establish secure channel for SSL/TLS ...System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host"
So what must I do to establish a secure channel for SSL/TLS, so that the existing connection is not so rudely closed by the emotionally remote host?
Nebenbei bemerkt: I find it a bit rompecabezish that when I was catching a WebException, this code was causing the app to crash, but when I changed the catch block to a generic exception, the attempt to connect silently failed (the only way I could tell there was a problem was by looking at the log file).
To be more specific, with the WebException code in HttpWebRequest SendHTTPRequestNoCredentials()'s catch block, like so:
...the app crashed and the log file held these post mortem notes (the dreaded NRE!):
However, with the generic Exception code in the catch block (as shown at the top of this post), the app seemed to be strolling through the park on a sunny summer Sunday morn -- no exception message or crash or sign of any wintery discontent whatsoever -- but the log file reveals this:
Notwithstanding that last interesting tidbit, what really matters is: How can I establish a secure channel for SSL/TLS from a handheld device?
UPDATE
I called the code from a "sandbox" app running on my PC and get a similar, albeit not identical, exception. This is what it caught:
UPDATE 2
Based on some of the comments here, and the links that accompany them, I was thinking I needed to add this within my code:
...in some context:
contentType) { ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; WebRequest request = null; try { request = WebRequest.Create(uri);
...but, although this is a .NET 3.5 client app, and, according to this [http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.servercertificatevalidationcallback
(v=vs.90).aspx], ServerCertificateValidationCallback is supposedly available in 3.5, "ServerCertificateValidationCallback" is not available to me (I get "cannot resolve symbol"). It seems this is in the System.Net assembly, but attempts to add a reference to System.Net to my project are futile, as there is no such assembly available via Add References on the .NET tab. The alphabetically-ordered list goes from "System.Messaging" to "System.Net.Irda"
I reckon this lack is because this is a feature-poor Compact Framework project.
Assuming this is so (Compact Framework does not contain ServerCertificateValidationCallback), what is the workaround for this scenario? How can I have my client handheld app accept the self-signed ssl certificate on the server (REST app running on a local network)?
UPDATE 3
Should I check/tick either or both of the following in Control Panel > Programs > Turn Windows features on or off > Internet Information Services > World Wide Web Service > Security:
?
UPDATE 4
I can access ServicePoint, like so:
...but does this do me any good. Can I set the Certificate to something that will be the equivalent of always accepting it. IOW, what do I need here:
UPDATE 5
Even with this code:
...I still get this:
BTW, TrustAllCertificatesPolicy's (empty) constructor is probably moot, as it is grayed out.
blackberry - 在我的黑莓应用中获取千禧年媒体广告请求
我正在尝试让黑莓从千禧年媒体获得广告请求,我希望得到一些我似乎无法让它发挥作用的帮助。这就是我所拥有的:
这是我尝试实现获取请求的类的完整代码。
}
我在不确定的地方放置了 ***,我需要您的帮助。