@ RequestMapping ( value = "api/edit/server" , method = RequestMethod . POST ) public @ ResponseBody ServerRedirect addRedirectToProfile ( Model model , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "profileIdentifier" , required = false ) String profileIdentifier , @ RequestParam ( value = "srcUrl" , required = true ) String srcUrl , @ RequestParam ( value = "destUrl" , required = true ) String destUrl , @ RequestParam ( value = "clientUUID" , required = true ) String clientUUID , @ RequestParam ( value = "hostHeader" , required = false ) String hostHeader ) throws Exception { if ( profileId == null && profileIdentifier == null ) { throw new Exception ( "profileId required" ) ; } if ( profileId == null ) { profileId = ProfileService . getInstance ( ) . getIdFromName ( profileIdentifier ) ; } int clientId = ClientService . getInstance ( ) . findClient ( clientUUID , profileId ) . getId ( ) ; int redirectId = ServerRedirectService . getInstance ( ) . addServerRedirectToProfile ( "" , srcUrl , destUrl , hostHeader , profileId , clientId ) ; return ServerRedirectService . getInstance ( ) . getRedirect ( redirectId ) ; }
Adds a redirect URL to the specified profile ID