| <?xml version="1.0"?> |
| <!-- |
| Copyright 2002,2004 The Apache Software Foundation. |
| |
| 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. |
| --> |
| <j:jelly |
| xmlns:j="jelly:core" |
| xmlns:http="jelly:http" |
| xmlns="jelly:jetty" |
| trim="false"> |
| |
| <j:set var="contextPathVar" value=""/> |
| <j:set var="testPort1" value="8100"/> |
| <j:set var="testPort2" value="8200"/> |
| <j:set var="testUri1" value="http://localhost:${testPort1}${contextPathVar}/test1.txt"/> |
| <j:set var="testUri2" value="http://localhost:${testPort2}${contextPathVar}/test1.txt"/> |
| |
| <jettyHttpServer var="httpServer1"> |
| <socketListener/> |
| </jettyHttpServer> |
| |
| <jettyHttpServer var="httpServer2"> |
| <socketListener port="${testPort2}"/> |
| </jettyHttpServer> |
| |
| <http:get var="mtc1" uri="${testUri1}"/> |
| <http:get var="mtc2" uri="${testUri2}"/> |
| |
| <j:if test='${mtc1.statusCode == 200}'> |
| <j:if test='${mtc2.statusCode == 200}'> |
| <j:if test='${mtc2.responseBodyAsString == mtc1.responseBodyAsString}'> |
| ${mtc2.responseBodyAsString} |
| </j:if> |
| </j:if> |
| </j:if> |
| <j:if test='${mtc1.statusCode != 200}'> |
| Results for mtc1 url are: |
| http return code = ${mtc1.statusCode} |
| http status text = '${mtc1.statusText}' |
| size of result = ${mtc1.responseBodyAsString.length()} |
| response time = ${mtc1.responseTime} |
| |
| <j:forEach items="${mtc1.responseHeaders}" var="header" indexVar="i"> |
| header[${i}] = ${header} |
| </j:forEach> |
| </j:if> |
| <j:if test='${mtc2.statusCode != 200}'> |
| Results for mtc2 url are: |
| http return code = ${mtc2.statusCode} |
| http status text = '${mtc2.statusText}' |
| size of result = ${mtc2.responseBodyAsString.length()} |
| response time = ${mtc2.responseTime} |
| |
| <j:forEach items="${mtc2.responseHeaders}" var="header" indexVar="i"> |
| header[${i}] = ${header} |
| </j:forEach> |
| </j:if> |
| ${httpServer2.stop()} |
| ${httpServer1.stop()} |
| |
| </j:jelly> |