summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-12-24 04:35:47 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-12-24 04:35:47 +0000
commit150feb74a6f2897d860be360cedf641e004f5ca8 (patch)
treede4692478db8cec97d930445ff8a04d566aaf43a /sca-cpp/trunk
parent8b3a6ecfaa07b8bbf25a2429e15396d5941215d4 (diff)
Fix content types. Removed duplicate function.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1052444 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk')
-rw-r--r--sca-cpp/trunk/modules/js/htdocs/component.js30
1 files changed, 7 insertions, 23 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/component.js b/sca-cpp/trunk/modules/js/htdocs/component.js
index 97972be226..9ce6aa86e5 100644
--- a/sca-cpp/trunk/modules/js/htdocs/component.js
+++ b/sca-cpp/trunk/modules/js/htdocs/component.js
@@ -307,11 +307,7 @@ HTTPBindingClient.prototype._sendRequest = function(req) {
/* Send the request */
http.open("POST", this.uri, (req.cb != null));
-
- /* setRequestHeader is missing in Opera 8 Beta */
- try {
- http.setRequestHeader("Content-type", "text/plain");
- } catch(e) {}
+ http.setRequestHeader("Content-type", "application/json-rpc");
/* Construct call back if we have one */
if(req.cb) {
@@ -442,7 +438,7 @@ HTTPBindingClient.getHTTPRequest = function() {
HTTPBindingClient.prototype.get = function(id, responseFunction) {
- var xhr = this.createXMLHttpRequest();
+ var xhr = HTTPBindingClient.getHTTPRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
@@ -462,7 +458,7 @@ HTTPBindingClient.prototype.get = function(id, responseFunction) {
};
HTTPBindingClient.prototype.post = function (entry, responseFunction) {
- var xhr = this.createXMLHttpRequest();
+ var xhr = HTTPBindingClient.getHTTPRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 201) {
@@ -478,12 +474,12 @@ HTTPBindingClient.prototype.post = function (entry, responseFunction) {
}
}
xhr.open("POST", this.uri, true);
- xhr.setRequestHeader("Content-Type", "application/atom+xml");
+ xhr.setRequestHeader("Content-Type", "application/atom+xml;type=entry");
xhr.send(entry);
};
HTTPBindingClient.prototype.put = function (id, entry, responseFunction) {
- var xhr = this.createXMLHttpRequest();
+ var xhr = HTTPBindingClient.getHTTPRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
@@ -499,12 +495,12 @@ HTTPBindingClient.prototype.put = function (id, entry, responseFunction) {
}
}
xhr.open("PUT", this.uri + '/' + id, true);
- xhr.setRequestHeader("Content-Type", "application/atom+xml");
+ xhr.setRequestHeader("Content-Type", "application/atom+xml;type=entry");
xhr.send(entry);
};
HTTPBindingClient.prototype.del = function (id, responseFunction) {
- var xhr = this.createXMLHttpRequest();
+ var xhr = HTTPBindingClient.getHTTPRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
@@ -518,18 +514,6 @@ HTTPBindingClient.prototype.del = function (id, responseFunction) {
xhr.send(null);
};
-HTTPBindingClient.prototype.createXMLHttpRequest = function () {
- /* Mozilla XMLHttpRequest */
- try { return new XMLHttpRequest(); } catch(e) {}
-
- /* Microsoft MSXML ActiveX */
- for (var i = 0; i < HTTPBindingClient.msxmlNames.length; i++) {
- try { return new ActiveXObject(HTTPBindingClient.msxmlNames[i]); } catch (e) {}
- }
- alert("XML http request not supported");
- return null;
-};
-
/**
* Public API.
*/