http-headers

How to put HTTP multipart request body together in order to send some string parameters along with image

…衆ロ難τιáo~ 提交于 2019-12-11 09:27:57
问题 I'm trying to build http request body which will send image along with some parameters from android device to server. For now sending an image works like it should, and this is the part of the code which bulds http request body for that purpose conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE",

Get image from url with cookies in ruby

吃可爱长大的小学妹 提交于 2019-12-11 09:27:38
问题 As you know, some captchas are generating using user session, and i must to somehow save to computer this image, for testing our app, but how, and what better to choise? For example on http::get i have such code, with cookies: http = Net::HTTP.new('***', 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE path = '****' # GET request -> so the host can set his cookies resp, data = http.get(path) body_text = resp.body #puts "Body = #{body_text}" cookie = resp.response['set

Verify header before request receive in tomcat

心已入冬 提交于 2019-12-11 09:23:05
问题 I need verify header before receive the request. I found that tomcat valve can help in it. I follow these steps but valve is not called: make a maven project and do this code in it. package cz.ValveTest; import java.io.IOException; import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.apache.catalina.connector.Request; import org.apache.catalina.connector

how to post parameters as a json in android while calling any api

笑着哭i 提交于 2019-12-11 09:19:57
问题 I am new to Android development, I need to post parameters as a JSON while calling any API method. I am passing as a array list: List<NameValuePair> params = new ArrayList<NameValuePair>(); Please give any suggestions. Thank you 回答1: finally i found solution using volley library, it's working fine now private void callApiWithJsonReqPost() { boolean failure = false; uAddress="133 Phùng Hưng, Cửa Đông, Hoàn Kiếm, Hà Nội, Vietnam"; addressTag="work address"; String callingURl="put your url here"

If X- custom header is no longer supported (deprecated by IETF) how do we return custom headers?

99封情书 提交于 2019-12-11 09:19:48
问题 According to this thread: Custom HTTP headers : naming conventions And the IETF link, using X- headers is no longer supported. However, I still see APIs that use them for responses. I've also recently done some configuration with nginx and it uses a few uses of X- headers. For example another post here: Modifying a Location header with nginx proxy_pass shows the use of X-Forwarded-For and a few others. So.. via the IETF deprecation, is all use of any X- header basically being told to no

JayData oData request with custom headers

眉间皱痕 提交于 2019-12-11 08:47:33
问题 I need to send custom headers to my wcf oData Service but with the following function the headers dont get modified. entities.onReady(function () { entities.prepareRequest = function(r) { r[0].headers['APIKey'] = 'ABC'; }; entities.DataServiceClient.toArray(function (cli) { cli.forEach(function (c) { console.log(c.Name) }); }); }); headers are not affected. any clue? thanks! 回答1: It seems that the marked answer is incorrect. I was suffering from a similar issue, but got it working without

websocket request header miss upgrade

Deadly 提交于 2019-12-11 08:46:58
问题 I use tornado develop a websocket server, and I use nginx delegate the python server, the nginx config a server_name, and my server in Chian, and I connect the websocket server from China, it work OK, and I connect it from Australia use Wifi, it also work OK, but when I connect from Australia use 3G, it doesn't work, the request header miss upgrade node, why this happen? 回答1: Because there is a proxy in the middle of that 3G connection. The "Upgrade" header is marked as a connection header (

Why does my web service produce an XML result for most mobile browsers instead of an HTML result?

本小妞迷上赌 提交于 2019-12-11 08:41:41
问题 I have a restful web service resource for which I've defined both XML and HTML methods. For desktop browsers the service accurately produces HTML, and for the Android client I've written it accurately produces XML. When it comes to mobile browsers however, the service produces XML, where it should produce HTML. One method is annotated with @Produces({MediaType.TEXT_HTML}) And the other with @Produces({MediaType.APPLICATION_XML}) Do I need to look at more than the Accept header to get the

HTTP Headers setting Authorization header stops data from loading

…衆ロ難τιáo~ 提交于 2019-12-11 08:39:05
问题 I'm using Ember.js, Ember Simple Auth plugin and jQuery to send an Authorization header cross domain using ajax. When the Authorization header is set: jqXHR.setRequestHeader('Authorization', 'Bearer ' + session.get('authToken')); Then I get a pre-flight OPTIONS request to the REST URL which I then return back the following headers: $headers->set('Access-Control-Allow-Origin', 'http://subdomain2.domain.com'); $headers->set('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');

Websphere - Set content type/charset of external resource

柔情痞子 提交于 2019-12-11 08:15:56
问题 I have mapped static content (html) to external directory. When I request html file over HTTP, it returned content type/charset Windows-874. Content-Type:text/html; charset=Windows-874 I would like to change it to Content-Type:text/html; charset=UTF-8 How can I change it in 'ibm-web-ext.xml'? Or I have to change it in other configurations of Websphere? Here is my ibm-web-ext.xml <?xml version="1.0" encoding="UTF-8"?> <web-ext xmlns="http://websphere.ibm.com/xml/ns/javaee" xmlns:xsi="http:/