Re: [Dev] [Commits] [Carbon-platform] svn commit r180125 - in carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse: . config/xml/rest rest

2013-08-07 Thread Isuru Udana
Hi Nuwan,

After updating synapse with this commit, Rest API's which I had deployed in
my ESB instance are failing to deploy now.
It seems like API's having both http and https transports (transports=http
https) are failing to deploy.

According to the following logic at APIFactory, it seems like only one
transport is allowed for an api.

OMAttribute trans = apiElt.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, transports));
if (trans != null) {
String transports = trans.getAttributeValue();
if (!.equals(transports)) {
if (Constants.TRANSPORT_HTTP.equals(transports)) {
api.setProtocol(RESTConstants.PROTOCOL_HTTP_ONLY);
} else if (Constants.TRANSPORT_HTTPS.equals(transports)) {
api.setProtocol(RESTConstants.PROTOCOL_HTTPS_ONLY);
} else {
handleException(Invalid protocol name:  + transports);
}
}
}

Isn't this wrong ?


On Wed, Aug 7, 2013 at 1:25 PM, nuw...@wso2.com wrote:

 Author: nuw...@wso2.com
 Date: Wed Aug  7 13:25:10 2013
 New Revision: 180125
 URL: http://wso2.org/svn/browse/wso2?view=revrevision=180125

 Log:
 Fixes for APIMANAGER-1417. Changes done by Ruwan

 Modified:

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APIFactory.java

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APISerializer.java

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/rest/API.java

 Modified:
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
 URL:
 http://wso2.org/svn/browse/wso2/carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java?rev=180125r1=180124r2=180125view=diff

 ==
 ---
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
 (original)
 +++
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
 Wed Aug  7 13:25:10 2013
 @@ -160,6 +160,10 @@
  public static final String PROXY_SERVICE = proxy.name;
  /** The Synapse MC property that marks it as a RESPONSE */
  public static final String RESPONSE = RESPONSE;
 +/** The Synapse MC property that indicates the in-transport */
 +public static final String IN_TRANSPORT = IN_TRANSPORT;
 +/** The Synapse MC property that marks if the message was denied
 on the accessed transport */
 +public static final String TRANSPORT_DENIED = TRANSPORT_DENIED;
  /** The Synapse MC property that marks the message as a OUT_ONLY
 message */
  public static final String OUT_ONLY = OUT_ONLY;
  /** The Synapse MC property that states that existing WS-A
 headers in the envelope should
 @@ -168,12 +172,6 @@
  /** The Synapse MC property that marks to Exception to be thrown
 on SOAPFault(Retry on SOAPFault)*/
  public static final String RETRY_ON_SOAPFAULT =
 RETRY_ON_SOAPFAULT;

 -//Properties for Rest API transport level validation
 -/** The Synapse MC property that indicates the in-transport */
 -public static final String IN_TRANSPORT = IN_TRANSPORT;
 -/** The Synapse MC property that marks if the message was denied
 on the accessed transport */
 -public static final String TRANSPORT_DENIED = TRANSPORT_DENIED;
 -
  /**
   * The name of the property which specifies the operation name
 that is
   * invoked by an endpoint

 Modified:
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APIFactory.java
 URL:
 http://wso2.org/svn/browse/wso2/carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APIFactory.java?rev=180125r1=180124r2=180125view=diff

 ==
 ---
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APIFactory.java
   (original)
 +++
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APIFactory.java
   Wed Aug  7 13:25:10 2013
 @@ -20,22 +20,20 @@

  import org.apache.axiom.om.OMAttribute;
  import org.apache.axiom.om.OMElement;
 +import org.apache.axis2.Constants;
  import 

Re: [Dev] [Commits] [Carbon-platform] svn commit r180125 - in carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse: . config/xml/rest rest

2013-08-07 Thread Ruwan Yatawara
Hi Isuru,

Yes, according to the initial implementation of this fix, APIs which
support both protocols (http and https), were made to include both values
as a space separated string in the namespace. However as pointed out by
Hiranya in [1], we opted to maintain only one transport value in the
transport section, in order to conform with how similar validations have
been done in Synapse Resources section.

Hence in the case of an API supporting both transports, you need to omit
the transport namespace entirely, as this is how the new implementation has
been done.

[1] - https://issues.apache.org/jira/browse/SYNAPSE-953


Thanks and Regards,

Ruwan Yatawara

Software Engineer,
WSO2 Inc.
lean . enterprise . middleware

email : ruw...@wso2.com
mobile : +94 77 9110413
blog : http://ruwansrants.blogspot.com/
www: :http://wso2.com



On Wed, Aug 7, 2013 at 10:07 PM, Isuru Udana isu...@wso2.com wrote:

 Hi Nuwan,

 After updating synapse with this commit, Rest API's which I had deployed
 in my ESB instance are failing to deploy now.
 It seems like API's having both http and https transports
 (transports=http https) are failing to deploy.

 According to the following logic at APIFactory, it seems like only one
 transport is allowed for an api.

 OMAttribute trans = apiElt.getAttribute(
 new QName(XMLConfigConstants.NULL_NAMESPACE,
 transports));
 if (trans != null) {
 String transports = trans.getAttributeValue();
 if (!.equals(transports)) {
 if (Constants.TRANSPORT_HTTP.equals(transports)) {
 api.setProtocol(RESTConstants.PROTOCOL_HTTP_ONLY);
 } else if (Constants.TRANSPORT_HTTPS.equals(transports)) {
 api.setProtocol(RESTConstants.PROTOCOL_HTTPS_ONLY);
 } else {
 handleException(Invalid protocol name:  +
 transports);
 }
 }
 }

 Isn't this wrong ?


 On Wed, Aug 7, 2013 at 1:25 PM, nuw...@wso2.com wrote:

 Author: nuw...@wso2.com
 Date: Wed Aug  7 13:25:10 2013
 New Revision: 180125
 URL: http://wso2.org/svn/browse/wso2?view=revrevision=180125

 Log:
 Fixes for APIMANAGER-1417. Changes done by Ruwan

 Modified:

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APIFactory.java

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/config/xml/rest/APISerializer.java

  
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/rest/API.java

 Modified:
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
 URL:
 http://wso2.org/svn/browse/wso2/carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java?rev=180125r1=180124r2=180125view=diff

 ==
 ---
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
 (original)
 +++
 carbon/platform/trunk/dependencies/synapse/2.1.1-wso2v8/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
 Wed Aug  7 13:25:10 2013
 @@ -160,6 +160,10 @@
  public static final String PROXY_SERVICE = proxy.name;
  /** The Synapse MC property that marks it as a RESPONSE */
  public static final String RESPONSE = RESPONSE;
 +/** The Synapse MC property that indicates the in-transport */
 +public static final String IN_TRANSPORT = IN_TRANSPORT;
 +/** The Synapse MC property that marks if the message was denied
 on the accessed transport */
 +public static final String TRANSPORT_DENIED = TRANSPORT_DENIED;
  /** The Synapse MC property that marks the message as a OUT_ONLY
 message */
  public static final String OUT_ONLY = OUT_ONLY;
  /** The Synapse MC property that states that existing WS-A
 headers in the envelope should
 @@ -168,12 +172,6 @@
  /** The Synapse MC property that marks to Exception to be thrown
 on SOAPFault(Retry on SOAPFault)*/
  public static final String RETRY_ON_SOAPFAULT =
 RETRY_ON_SOAPFAULT;

 -//Properties for Rest API transport level validation
 -/** The Synapse MC property that indicates the in-transport */
 -public static final String IN_TRANSPORT = IN_TRANSPORT;
 -/** The Synapse MC property that marks if the message was denied
 on the accessed transport */
 -public static final String TRANSPORT_DENIED = TRANSPORT_DENIED;
 -
  /**
   * The name of the property which specifies the operation name
 that is
   * invoked by an endpoint