public ServerRedirect getRedirect ( int id ) throws Exception { PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_SERVERS + " WHERE " + Constants . GENERIC_ID + " = ?" ) ; queryStatement . setInt ( 1 , id ) ; results = queryStatement . executeQuery ( ) ; if ( results . next ( ) ) { ServerRedirect curServer = new ServerRedirect ( results . getInt ( Constants . GENERIC_ID ) , results . getString ( Constants . SERVER_REDIRECT_REGION ) , results . getString ( Constants . SERVER_REDIRECT_SRC_URL ) , results . getString ( Constants . SERVER_REDIRECT_DEST_URL ) , results . getString ( Constants . SERVER_REDIRECT_HOST_HEADER ) ) ; curServer . setProfileId ( results . getInt ( Constants . GENERIC_PROFILE_ID ) ) ; return curServer ; } logger . info ( "Did not find the ID: {}" , id ) ; } catch ( SQLException e ) { throw e ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( queryStatement != null ) { queryStatement . close ( ) ; } } catch ( Exception e ) { } } return null ; }
Returns redirect information for the given ID