スタンドアロンのOpenSocial(Atlassian Jira)ガジェットから次のRESTリソースを使用しようとしています。
次のURLを使用して、ブラウザからリソースをクエリできます。
https://jira.atlassian.com/rest/api/latest/issue/JRA-9
開発マシンから同じリクエストを発行できます。確かに私にはJSONのように見えます...しかし、ガジェットからクエリを実行すると、
GET 10.0.15.10:2990/jira/rest/api/latest/issue/CRD-1 415 Unsupported Media Type (32ms)
応答はHTMLとして返されます。これは、Tomcatからの応答本文です。
<html><head><title>Apache Tomcat/6.0.20 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.20</h3></body></html>
これが私のAJAX呼び出しです(これは基本的にAtlassianガジェットJavaScriptフレームワークにラップされたJQueryです):
args: [{
key: "issueData",
ajaxOptions: function() {
return {
url: "/rest/api/latest/issue/CRDTRK-1"
};
}
}]
dataType: "json"
ajaxリクエストに追加しようとしましたが、役に立ちませんでした。私はおそらく単純なものが欠けています。
リクエスト/レスポンスヘッダーは次のとおりです。
Response Headers
Content-Length 1051
Content-Type text/html;charset=utf-8
Date Sun, 10 Jun 2012 15:53:06 GMT
Server Apache-Coyote/1.1
X-AREQUESTID 1013x5993x1
X-ASESSIONID 1bi5et0
X-AUSERNAME admin
X-Seraph-LoginReason OK
Request Headers
Accept application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-gb,en;q=0.5
Connection keep-alive
Content-Type application/x-www-form-urlencoded
Cookie atlassian.xsrf.token=BP8Q-WXN6-SKX3-
DNT 1
Host 10.0.15.10:2990
Referer http://10.0.15.10:2990/jira/secure/Dashboard.jspa
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0
X-Requested-With XMLHttpRequest