Author: keith
Date: Mon Dec 10 23:46:37 2007
New Revision: 10890
Log:
Adding support for DELETE and PUT methods
Modified:
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
Modified:
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
==============================================================================
---
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
(original)
+++
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java
Mon Dec 10 23:46:37 2007
@@ -515,7 +515,7 @@
}
if (httpMethod != null) {
- if (httpMethod.equalsIgnoreCase("get")) {
+ if
(httpMethod.equalsIgnoreCase(Constants.Configuration.HTTP_METHOD_GET)) {
// If useSOAP is not false then the HTTPMethod must be POST
if (!useSOAP.equalsIgnoreCase("false")) {
throw Context
@@ -525,9 +525,29 @@
options.setProperty(Constants.Configuration.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_GET);
options.setProperty(Constants.Configuration.ENABLE_REST,
Constants.VALUE_TRUE);
- } else if (httpMethod.equalsIgnoreCase("post")) {
+ } else if
(httpMethod.equalsIgnoreCase(Constants.Configuration.HTTP_METHOD_POST)) {
options.setProperty(Constants.Configuration.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_POST);
+ } else if
(httpMethod.equalsIgnoreCase(Constants.Configuration.HTTP_METHOD_DELETE)) {
+ // If useSOAP is not false then the HTTPMethod must be POST
+ if (!useSOAP.equalsIgnoreCase("false")) {
+ throw Context
+ .reportRuntimeError(
+ "INVALID_SYNTAX_EXCEPTION. Cannot have the
value of useSOAP true, when the HTTPMethod is 'DELETE'");
+ }
+ options.setProperty(Constants.Configuration.HTTP_METHOD,
+
Constants.Configuration.HTTP_METHOD_DELETE);
+ options.setProperty(Constants.Configuration.ENABLE_REST,
Constants.VALUE_TRUE);
+ } else if
(httpMethod.equalsIgnoreCase(Constants.Configuration.HTTP_METHOD_PUT)) {
+ // If useSOAP is not false then the HTTPMethod must be POST
+ if (!useSOAP.equalsIgnoreCase("false")) {
+ throw Context
+ .reportRuntimeError(
+ "INVALID_SYNTAX_EXCEPTION. Cannot have the
value of useSOAP true, when the HTTPMethod is 'PUT'");
+ }
+ options.setProperty(Constants.Configuration.HTTP_METHOD,
+ Constants.Configuration.HTTP_METHOD_PUT);
+ options.setProperty(Constants.Configuration.ENABLE_REST,
Constants.VALUE_TRUE);
} else {
throw Context
.reportRuntimeError("INVALID_SYNTAX_EXCEPTION.
Unsupported HTTP method.");
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev