public ServerRedirect addServerMapping ( String sourceHost , String destinationHost , String hostHeader ) { JSONObject response = null ; ArrayList < BasicNameValuePair > params = new ArrayList < BasicNameValuePair > ( ) ; params . add ( new BasicNameValuePair ( "srcUrl" , sourceHost ) ) ; params . add ( new BasicNameValuePair ( "destUrl" , destinationHost ) ) ; params . add ( new BasicNameValuePair ( "profileIdentifier" , this . _profileName ) ) ; if ( hostHeader != null ) { params . add ( new BasicNameValuePair ( "hostHeader" , hostHeader ) ) ; } try { BasicNameValuePair paramArray [ ] = new BasicNameValuePair [ params . size ( ) ] ; params . toArray ( paramArray ) ; response = new JSONObject ( doPost ( BASE_SERVER , paramArray ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } return getServerRedirectFromJSON ( response ) ; }
Add a new server mapping to current profile