private static ResponseSwitch getResponseSwitch(Object response)
  {
      // unwrap the response until we find a ResponseSwitch
      while (response != null)
      {
          if (response instanceof ResponseSwitch)
          {
              // found
              return (ResponseSwitch) response;
          }
          if (response instanceof ServletResponseWrapper)
          {
              // unwrap
              response = ((ServletResponseWrapper) response).getResponse();
          }
          // no more possibilities to find a ResponseSwitch
          break; 
      }
      return null; // not found
  }
private static ResponseSwitch getResponseSwitch ( Object response ) { while ( response != null ) { if ( response instanceof ResponseSwitch ) { return ( ResponseSwitch ) response ; } if ( response instanceof ServletResponseWrapper ) { response = ( ( ServletResponseWrapper ) response ) . getResponse ( ) ; } break ; } return null ; }
Trys to obtain a ResponseSwitch from the Response.
@param response
@return if found, the ResponseSwitch, null otherwise