diff --git a/modules/distribution/src/api-resources/api_templates/default_api_template.xml b/modules/distribution/src/api-resources/api_templates/default_api_template.xml
index 91a8b59f..e69e8ade 100644
--- a/modules/distribution/src/api-resources/api_templates/default_api_template.xml
+++ b/modules/distribution/src/api-resources/api_templates/default_api_template.xml
@@ -1,72 +1,72 @@
-
-
-
-
-
-
-
-
-
-
-
- 500
- Status report
- Internal Server Error
- Faulty invoking through default API
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #if( $transport == "https" )
-
- #else
-
- #end
+
+
+
+
+
+
+
+
+
+
+
+ 500
+ Status report
+ Internal Server Error
+ Faulty invoking through default API
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #if( $transport == "https" )
+
+ #else
+
+ #end
-
-
- #if( $transport == "https" )
-
- #else
-
- #end
-
- 60000
- fault
-
-
- 1.0
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
+
+
+ #if( $transport == "https" )
+
+ #else
+
+ #end
+
+ 60000
+ fault
+
+
+ 1.0
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
diff --git a/modules/distribution/src/api-resources/api_templates/prototype_template.xml b/modules/distribution/src/api-resources/api_templates/prototype_template.xml
index c3687d36..05ffc526 100644
--- a/modules/distribution/src/api-resources/api_templates/prototype_template.xml
+++ b/modules/distribution/src/api-resources/api_templates/prototype_template.xml
@@ -18,63 +18,63 @@
##################### Define the macros ######################
- #macro ( print_if_exist $field $default)
+#macro ( print_if_exist $field $default)
#if($field && "$field" !="")
- $field
+ $field
#else
- $default
- #end
+ $default
#end
+#end
- #macro ( print_string_if_exist $field $default)
+#macro ( print_string_if_exist $field $default)
#if($field && "$field" !="")
- "$field"
+ "$field"
#else
- "$default"
- #end
+ "$default"
#end
+#end
- #macro ( print_if_exist_only $tagname $field)
+#macro ( print_if_exist_only $tagname $field)
#if($field && "$field" !="")
-<$tagname>$field$tagname>
+ <$tagname>$field$tagname>
#else
- ## print nothing.
- #end
+ ## print nothing.
#end
+#end
- #macro ( print_list $tagname $list)
+#macro ( print_list $tagname $list)
#if($list && "$list" !="" && $list.size() > 0)
-<$tagname>
- #foreach($item in $list)
- $item #if( $foreach.hasNext ), #end
- #end
- $tagname>
+ <$tagname>
+ #foreach($item in $list)
+ $item #if( $foreach.hasNext ), #end
+ #end
+ $tagname>
#else
- ## print nothing.
- #end
+ ## print nothing.
#end
+#end
- #macro ( timeout $config)
- #if( $config.get("actionSelect") == "neverTimeout" )
+#macro ( timeout $config)
+ #if( $config.get("actionSelect") == "neverTimeout" )
## print nothing.
- #elseif($config.get("actionDuration")|| $config.get("actionSelect"))
-
-#print_if_exist_only("duration" $config.get("actionDuration"))
-#print_if_exist_only("responseAction" $config.get("actionSelect"))
-
- #end
-
-#print_list( "errorCodes" $config.get("suspendErrorCode"))
-#print_if_exist_only("initialDuration" $config.get("suspendDuration"))
-#print_if_exist_only("maximumDuration" $config.get("suspendMaxDuration"))
-#print_if_exist( $config.get("factor") 1.0)
-
-
-#print_list("errorCodes" $config.get("retryErroCode"))
-#print_if_exist( $config.get("retryTimeOut") 0)
-#print_if_exist( $config.get("retryDelay") 0)
-
- #end
+ #elseif($config.get("actionDuration")|| $config.get("actionSelect"))
+
+ #print_if_exist_only("duration" $config.get("actionDuration"))
+ #print_if_exist_only("responseAction" $config.get("actionSelect"))
+
+ #end
+
+ #print_list( "errorCodes" $config.get("suspendErrorCode"))
+ #print_if_exist_only("initialDuration" $config.get("suspendDuration"))
+ #print_if_exist_only("maximumDuration" $config.get("suspendMaxDuration"))
+ #print_if_exist( $config.get("factor") 1.0)
+
+
+ #print_list("errorCodes" $config.get("retryErroCode"))
+ #print_if_exist( $config.get("retryTimeOut") 0)
+ #print_if_exist( $config.get("retryDelay") 0)
+
+#end
#macro ( http_endpoint $name $ep )
@@ -182,62 +182,62 @@
#if($apiIsBlocked)
## if API is blocked send the API Block message
-
-
-
-
- 700700
- API blocked
- This API has been blocked temporarily. Please try again later or contact the system administrators.
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 700700
+ API blocked
+ This API has been blocked temporarily. Please try again later or contact the system administrators.
+
+
+
+
+
+
+
+
+
- #else
- ## api not blocked
- #set ($resourceNo = 0)
- #foreach($resource in $resources)
+#else
+## api not blocked
+#set ($resourceNo = 0)
+#foreach($resource in $resources)
+#if($resource.getUriTemplate().contains("{") ||
+($resource.getUriTemplate().contains("*") && !$resource.getUriTemplate().endsWith("/*")))
+uri-template="$util.escapeXml($resource.getUriTemplate())"
+#else
+url-mapping="$resource.getUriTemplate()"
+#end
+methods="$resource.getMethodsAsString()" faultSequence=#print_string_if_exist($faultSequence "fault")>
-#if(!$resource.getMediationScript().equalsIgnoreCase("null"))
-
-
-
-
-
-
-
-
-
-#else
-
-#end
-#if($resource.getMethodsAsString().contains("GET")||$resource.getMethodsAsString().contains("DELETE"))
-
-#end
-
+
+
+
+
+
+
+
+
+
+ #else
+
+ #end
+ #if($resource.getMethodsAsString().contains("GET")||$resource.getMethodsAsString().contains("DELETE"))
+
+ #end
+
-
+
-
+
#set ($resourceNo = $resourceNo + 1)
#end ## end of resource iterator
## print the handlers
@@ -254,9 +254,9 @@
#end
- #end
- #if($apiStatus == 'PROTOTYPED')
- #end
- #end
- ## end of apiIsBlocked check
-
+#end
+#if($apiStatus == 'PROTOTYPED')
+#end
+#end
+## end of apiIsBlocked check
+
diff --git a/modules/distribution/src/api-resources/api_templates/velocity_template.xml b/modules/distribution/src/api-resources/api_templates/velocity_template.xml
index 49411d26..acec1df1 100644
--- a/modules/distribution/src/api-resources/api_templates/velocity_template.xml
+++ b/modules/distribution/src/api-resources/api_templates/velocity_template.xml
@@ -76,31 +76,31 @@
#end
- #macro ( http_endpoint $name $ep )
+#macro ( http_endpoint $name $ep )
-
-#timeout( $ep.get('config') )
-
-
-
- #end
+
+ #timeout( $ep.get('config') )
+
+
+
+#end
- #macro ( address_endpoint $name $ep )
+#macro ( address_endpoint $name $ep )
-#set( $advance_ep = $ep.get("config") )
-
+ #timeout( $ep.get('config') )
+
+
+
#end
->
-#timeout( $ep.get('config') )
-
-
-
- #end
#macro ( draw_endpoint $type $endpoint_config )
@@ -126,16 +126,16 @@ optimize="$advance_ep.get("optimize")"
-
-
+
+
-
-
-
-
-
+
+
+
+
+
@@ -146,8 +146,8 @@ optimize="$advance_ep.get("optimize")"
-
-
+
+
#else
@@ -193,18 +193,18 @@ optimize="$advance_ep.get("optimize")"
#if($endpoints.get("endpoint_type") == "address")
- #address_endpoint("${ep_name}_0" $endpoints)
+ #address_endpoint("${ep_name}_0" $endpoints)
#else
- #http_endpoint("${ep_name}_0" $endpoints)
+ #http_endpoint("${ep_name}_0" $endpoints)
#end
#set( $i = 1)
#foreach($endpoint in $failover_endpoints)
- #if($endpoint.get("endpoint_type") == "address")
- #address_endpoint("${ep_name}_$i" $endpoint)
- #else
- #http_endpoint("${ep_name}_$i" $endpoint)
- #end
- #set( $i = $i + 1)
+ #if($endpoint.get("endpoint_type") == "address")
+ #address_endpoint("${ep_name}_$i" $endpoint)
+ #else
+ #http_endpoint("${ep_name}_$i" $endpoint)
+ #end
+ #set( $i = $i + 1)
#end
@@ -223,19 +223,19 @@ optimize="$advance_ep.get("optimize")"
#end>
#set( $i = 0)
#foreach($endpoint in $endpoints)
- #if($endpoint.get("endpoint_type") == "address")
- #address_endpoint("${ep_name}_$i" $endpoint)
- #else
- #http_endpoint("${ep_name}_$i" $endpoint)
- #end
- #set( $i = $i + 1)
+ #if($endpoint.get("endpoint_type") == "address")
+ #address_endpoint("${ep_name}_$i" $endpoint)
+ #else
+ #http_endpoint("${ep_name}_$i" $endpoint)
+ #end
+ #set( $i = $i + 1)
#end
- #elseif ($endpointClass == "default")
+#elseif ($endpointClass == "default")
-
-
+
+
#end
@@ -367,9 +367,9 @@ optimize="$advance_ep.get("optimize")"
#if($apiStatus == 'PROTOTYPED')
#end
## end of apiIsBlocked check
-
-
-
-
-
+
+
+
+
+
diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml
index 862b70b0..bd414507 100644
--- a/modules/distribution/src/assembly/bin.xml
+++ b/modules/distribution/src/assembly/bin.xml
@@ -218,6 +218,8 @@
**/application-authentication.xml
**/broker.xml
**/log4j.properties
+ **/nhttp.properties
+ **/passthru-http.properties
diff --git a/modules/distribution/src/repository/conf/etc/webapp-publisher-config.xml b/modules/distribution/src/repository/conf/etc/webapp-publisher-config.xml
index 3ba039f2..d67a0cf9 100644
--- a/modules/distribution/src/repository/conf/etc/webapp-publisher-config.xml
+++ b/modules/distribution/src/repository/conf/etc/webapp-publisher-config.xml
@@ -30,7 +30,7 @@
true
- true
+ false
diff --git a/modules/distribution/src/repository/conf/nhttp.properties b/modules/distribution/src/repository/conf/nhttp.properties
new file mode 100644
index 00000000..56abe765
--- /dev/null
+++ b/modules/distribution/src/repository/conf/nhttp.properties
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2005-2010, WSO2 Inc. (http://wso2.com) All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This file contains the configuration parameters used by the Non-blocking HTTP transport
+
+#http.socket.timeout=60000
+#http.socket.buffer-size=8192
+#http.tcp.nodelay=1
+#http.connection.stalecheck=0
+
+# Uncomment the following property for an AIX based deployment
+#http.nio.interest-ops-queueing=true
+
+# HTTP Sender thread pool parameters
+#snd_t_core=20
+#snd_t_max=100
+#snd_alive_sec=5
+#snd_qlen=-1
+#snd_io_threads=2
+
+# HTTP Listener thread pool parameters
+#lst_t_core=20
+#lst_t_max=100
+#lst_alive_sec=5
+#lst_qlen=-1
+#lst_io_threads=2
+nhttp.rest.dispatcher.service=__MultitenantDispatcherService
+
+rest_uri_api_regex=\\w+://.+:\\d+/t/.*|\\w+://.+\\w+/t/.*|^(/t/).*
+rest_uri_proxy_regex=\\w+://.+:\\d+/services/t/.*|\\w+://.+\\w+/services/t/.*|^(/services/t/)
+
+# This property is crucial for automated tests
+http.socket.reuseaddr=true
\ No newline at end of file
diff --git a/modules/distribution/src/repository/conf/passthru-http.properties b/modules/distribution/src/repository/conf/passthru-http.properties
new file mode 100644
index 00000000..6645b8d1
--- /dev/null
+++ b/modules/distribution/src/repository/conf/passthru-http.properties
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2005-2010, WSO2 Inc. (http://wso2.com) All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+## This file contains the configuration parameters used by the Pass-through HTTP transport
+
+## Nhttp tuning parameters
+#http.socket.timeout=60000
+#http.connection.timeout=0
+#http.socket.buffer-size=8192
+#http.socket.linger=-1
+#http.nio.select-interval=1000
+#http.tcp.nodelay=true
+#http.connection.stalecheck=false
+#http.socket.reuseaddr=false
+
+## Uncomment the following for AIX based deployments
+#http.nio.interest-ops-queueing=true
+
+## Pass-through HTTP transport specific tuning parameters
+worker_pool_size_core=400
+worker_pool_size_max=500
+#worker_thread_keepalive_sec=60
+#worker_pool_queue_length=-1
+#io_threads_per_reactor=2
+io_buffer_size=16384
+#http.max.connection.per.host.port=32767
+
+## Other parameters
+#http.user.agent.preserve=false
+#http.server.preserve=true
+#http.connection.disable.keepalive=false
+
+# URI configurations that determine if it requires custom rest dispatcher
+rest_uri_api_regex=\\w+://.+:\\d+/t/.*|\\w+://.+\\w+/t/.*|^(/t/).*
+rest_uri_proxy_regex=\\w+://.+:\\d+/services/t/.*|\\w+://.+\\w+/services/t/.*|^(/services/t/)
+
+# This property is crucial for automated tests
+http.socket.reuseaddr=true
\ No newline at end of file