* We are reusing the SOAP code to process this request. We then use Axiom to serialize the
* resulting EC2 Amazon object into XML to return to the client.
*/
private void describeAvailabilityZones( HttpServletRequest request, HttpServletResponse response )
throws ADBException, XMLStreamException, IOException {
EC2DescribeAvailabilityZones EC2request = new EC2DescribeAvailabilityZones();
// -> load in all the "ZoneName.n" parameters if any
Enumeration<?> names = request.getParameterNames();
while( names.hasMoreElements()) {
String key = (String)names.nextElement();
if (key.startsWith("ZoneName")) {
String[] value = request.getParameterValues( key );
if (null != value && 0 < value.length) EC2request.addZone( value[0] );
}
}
// add filters
EC2Filter[] filterSet = extractFilters( request );
if ( filterSet != null ) {
EC2AvailabilityZonesFilterSet afs = new EC2AvailabilityZonesFilterSet();
for( int i=0; i < filterSet.length; i++ ) {
afs.addFilter(filterSet[i]);
}
EC2request.setFilterSet( afs );
}
// -> execute the request
DescribeAvailabilityZonesResponse EC2response = EC2SoapServiceImpl.toDescribeAvailabilityZonesResponse( ServiceProvider.getInstance().getEC2Engine().handleRequest( EC2request ));
serializeResponse(response, EC2response);