- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我将 token 传递为:
String access_token = object.get("access_token").toString();
System.out.println("Access Token -------->" + access_token);
System.out.println("Decoded Access Token --------> " +URLDecoder.decode(access_token));
//String basicAuth = "Basic "+ new String(new Base64().encode(access_token.getBytes()));
CreateSubmissionMetadata(access_token);
public static void CreateSubmissionMetadata (String access_token) throws ClientProtocolException, IOException{
HttpClient httpClient = HttpClientBuilder.create().build();
String sysdevEndPoint = "https://devicesigningservice.cloudapp.net/api/signing/devices";
HttpPost request = new HttpPost(sysdevEndPoint);
StringEntity params =new StringEntity("{\"TestHarnessType\": \"HLK\",\"OSSelections\": [{\"OS\",\"Windows 7\"},{\"OS\",\"Windows 8\"},{\"OS\",\"Windows 8.1\"},{\"OS\",\"Windows 10\"}],\"ProductName\":\"Test Name\",\"InitialUploadFileSize\": <size>}");
request.setHeader("Content-Type", "application/json");
System.out.println("Sending token ---->"+ access_token);
request.setHeader("Authorization: Bearer ", access_token);
Log.d("DEBUG", "HEADERS: " + request.getFirstHeader("Authorization: Bearer"));
request.setEntity(params);
System.out.println("sending Request-------------------------------------------------------------------------->");
HttpResponse response = httpClient.execute(request);
System.out.println("-------------------------------------------------------------------------------------------------------");
System.out.println(response);
System.out.println("-------------------------------------------------------------------------------------------------------");
Header[] headers = response.getAllHeaders();
for (Header header : headers) {
System.out.println("Key : " + header.getName()
+ " ,Value : " + header.getValue());
}
我从访问控制服务器获得了access_token,我正在尝试使用它并获取SAS URI,但是在 header 中传递 token 时,我得到的HTTP响应代码为500。(在生成 token 时,我错过了范围内的尾随“/”这就是为什么我收到 401 错误)
API文档:https://msdn.microsoft.com/en-us/library/windows/hardware/dn800660(v=vs.85).aspx
输出:
HttpResponseProxy{HTTP/1.1 401 Unauthorized [Content-Type: text/html, Server:Microsoft-IIS/8.5, X-Powered-By: ASP.NET, Date: Tue, 05 Jul 2016 19:36:02 GMT,
Content-Length: 1293] ResponseEntityProxy{[Content-Type: text/html,Content-
Length: 1293,Chunked: false]}}
Key : Content-Type ,Value : text/html
Key : Server ,Value : Microsoft-IIS/8.5
Key : X-Powered-By ,Value : ASP.NET
Key : Date ,Value : Tue, 05 Jul 2016 19:36:02 GMT
Key : Content-Length ,Value : 1293
启用日志:
2016/07/05 16:27:40:237 EDT [DEBUG] RequestAddCookies - CookieSpec selected: default
2016/07/05 16:27:40:237 EDT [DEBUG] RequestAuthCache - Auth cache not set in the context
2016/07/05 16:27:40:238 EDT [DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://devicesigningservice.cloudapp.net:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
2016/07/05 16:27:40:238 EDT [DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 1][route: {s}->https://devicesigningservice.cloudapp.net:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2016/07/05 16:27:40:238 EDT [DEBUG] MainClientExec - Opening connection {s}->https://devicesigningservice.cloudapp.net:443
2016/07/05 16:27:40:240 EDT [DEBUG] DefaultHttpClientConnectionOperator - Connecting to devicesigningservice.cloudapp.net/191.246.47.593:843
2016/07/05 16:27:40:240 EDT [DEBUG] SSLConnectionSocketFactory - Connecting socket to devicesigningservice.cloudapp.net/191.246.47.593:843 with timeout 0
2016/07/05 16:27:40:256 EDT [DEBUG] SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
2016/07/05 16:27:40:256 EDT [DEBUG] SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2016/07/05 16:27:40:256 EDT [DEBUG] SSLConnectionSocketFactory - Starting handshake
2016/07/05 16:27:40:517 EDT [DEBUG] SSLConnectionSocketFactory - Secure session established
2016/07/05 16:27:40:517 EDT [DEBUG] SSLConnectionSocketFactory - negotiated protocol: TLSv1.2
2016/07/05 16:27:40:517 EDT [DEBUG] SSLConnectionSocketFactory - negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
2016/07/05 16:27:40:517 EDT [DEBUG] SSLConnectionSocketFactory - peer principal: CN=devicesigningservice.cloudapp.net
2016/07/05 16:27:40:517 EDT [DEBUG] SSLConnectionSocketFactory - peer alternative names: [devicesigningservice.cloudapp.net]
2016/07/05 16:27:40:517 EDT [DEBUG] SSLConnectionSocketFactory - issuer principal: CN=Microsoft IT SSL SHA2, OU=Microsoft IT, O=Microsoft Corporation, L=Redmond, ST=Washington, C=US
2016/07/05 16:27:40:518 EDT [DEBUG] DefaultHttpClientConnectionOperator - Connection established 9.82.117.101:65081<->191.246.47.593:843
2016/07/05 16:27:40:518 EDT [DEBUG] MainClientExec - Executing request POST /api/signing/devices HTTP/1.1
2016/07/05 16:27:40:518 EDT [DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
2016/07/05 16:27:40:518 EDT [DEBUG] headers - http-outgoing-1 >> POST /api/signing/devices HTTP/1.1
2016/07/05 16:27:40:518 EDT [DEBUG] headers - http-outgoing-1 >> Content-Type: application/json
2016/07/05 16:27:40:518 EDT [DEBUG] headers - http-outgoing-1 >> Authorization: Bearer http%3a%2f%2fschemas.microsoft.com%blah%bla
2016/07/05 16:27:40:518 EDT [DEBUG] headers - http-outgoing-1 >> Content-Length: 181
2016/07/05 16:27:40:518 EDT [DEBUG] headers - http-outgoing-1 >> Host: devicesigningservice.cloudapp.net
2016/07/05 16:27:40:519 EDT [DEBUG] headers - http-outgoing-1 >> Connection: Keep-Alive
2016/07/05 16:27:40:519 EDT [DEBUG] headers - http-outgoing-1 >> User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_77)
2016/07/05 16:27:40:519 EDT [DEBUG] headers - http-outgoing-1 >> Accept-Encoding: gzip,deflate
2016/07/06 15:14:19:022 EDT [DEBUG] headers - http-outgoing-1 << HTTP/1.1 500 Internal Server Error
2016/07/06 15:14:19:022 EDT [DEBUG] headers - http-outgoing-1 << Cache-Control: no-cache
2016/07/06 15:14:19:022 EDT [DEBUG] headers - http-outgoing-1 << Pragma: no-cache
2016/07/06 15:14:19:022 EDT [DEBUG] headers - http-outgoing-1 << Content-Type: application/json; charset=utf-8
2016/07/06 15:14:19:022 EDT [DEBUG] headers - http-outgoing-1 << Expires: -1
2016/07/06 15:14:19:023 EDT [DEBUG] headers - http-outgoing-1 << Server: Microsoft-IIS/8.5
2016/07/06 15:14:19:023 EDT [DEBUG] headers - http-outgoing-1 << X-AspNet-Version: 4.0.30319
2016/07/06 15:14:19:023 EDT [DEBUG] headers - http-outgoing-1 << X-Powered-By: ASP.NET
2016/07/06 15:14:19:023 EDT [DEBUG] headers - http-outgoing-1 << Date: Wed, 06 Jul 2016 19:14:18 GMT
2016/07/06 15:14:19:023 EDT [DEBUG] headers - http-outgoing-1 << Content-Length: 36
2016/07/06 15:14:19:023 EDT [DEBUG] MainClientExec - Connection can be kept alive indefinitely
最佳答案
更改以下行
request.setHeader("Authorization: Bearer ", access_token);
到
request.setHeader("Authorization", "Bearer " + access_token);
关于java - 发送 token 和请求 SAS URI 时出现 500 内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38211320/
使用 ruby 1.9.2-p290。我在尝试解析如下 URI 时遇到问题: require 'uri' my_uri = "http://www.anyserver.com/getdata?anyp
根据 http://tools.ietf.org/html/rfc3986和 http://en.wikipedia.org/wiki/Uniform_resource_identifier , UR
如何在文本 block 中发现 URI? 这个想法是将这样的文本运行变成链接。如果只考虑 http(s) 和 ftp(s) 方案,这很容易做到;但是,我猜测一般问题(考虑 tel、mailto 和其他
我的一些网址上有一些特殊字符。例如: http://blabla.com/title/?t=burası 当我从其他页面提供指向该页面的链接时,我使用: URI.encode(s) 产生这个链接: /
我在 Windows Mobile 上使用紧凑型框架/C#。 在我的应用程序中,我通过序列化对象并使用 HttpWebRequest/POST 请求向上发送信息来将数据上传到服务器。在服务器上,发布数
我正在做一个实验,我发现将 Canvas 转换为 blob,然后转换为数据 URI 会导致与直接从 Canvas 获取数据 URI 不同的 URI。打开时的内容在两个 URI 上几乎相同。 使用 bl
我正在尝试在 Rails 3 中实现 OAuth 提供程序。当我尝试授权客户端应用程序时,出现此错误。我正在使用 RESTful auth 插件和 pelles OAuth 插件。当我通过 Rails
我有一个编码的 UI 测试方法: public void MyTestMethod() { string baseUrl = "www.google.com"; GlobalVaria
我知道这是一个常见的错误,我正在使用一个已知的解决方案,但它仍然给我同样的错误: require 'open-uri' url = "http://website.com/dirs/filex[a]"
我正在尝试使用 .NET 中的 HttpClient 来使用 Web 服务,并且在我完成了 msdn 中提到的所有步骤之后 o 出现以下异常:提供了无效的请求 URI。请求 URI 必须是绝对 URI
我正在尝试检索文件的 URI。该文件存储在: /storage/emulated/0/AppName/FileName.png 如果我使用 Uri.fromFile(file),我得到的是 file:
我想知道 (SIP) URI 中的不同参数分隔符表示什么? 部分以;分隔,例如: . 其他用?隔开和 & ,例如: 最佳答案 SIP 分隔符规则来自RFC 2396 RFC 3986 已弃用.但是在
我想调用decodeUrl(...),我这样做是: import "dart:uri"; main() { decodeUrl("str"); } 但是现在有了最新的Dart-SDK,它会报告
在 URI 中,空格可以编码为 + .既然如此,那么在创建具有国际前缀的 tel URI 时是否应该对前导加号进行编码? 哪个更好?两者在实践中都有效吗? Call me Call me 最佳答案 不
我试图弄清楚电子邮件地址的格式是否可以说符合 URI 的定义,但到目前为止我还没有找到明确的确认。我希望有人可以在这里为我提供一些见解。预先感谢:) 最佳答案 是的,但带有“mailto:”前缀。 U
因此,我尝试将 ID 参数附加到 URI 的末尾,当用户单击我的列表中的项目时,用户将被发送到该 URI。我的代码如下: public void onItemClick(AdapterView par
这是 Converting file path to URI 的后续问题. 考虑: require 'uri' uri = URI.join('file:///', '/home/user/dir1/
我在 pl/sql 中创建了一个名为 tester 的包。但我收到以下消息。 绝对URI中的相对路径:java.net.URI.checkPath(URI.java:1823) --Package D
我在 gitlab 上有一个 git repo,使用私有(private) pod 和其他公共(public) pod,下面是我的 Podfile source 'git@gitlab.mycompa
我正在尝试将我的 Rails 应用程序推送到 heroku 上,我正在使用 heroku RedisToGo 附加组件我经历过这个tutorial并完成了那里提到的所有步骤。 但是在推送 heroku
我是一名优秀的程序员,十分优秀!