public String extractPropertyFromURI ( String propName , String uri ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "extractPropertyFromURI" , new Object [ ] { propName , uri } ) ; String result = null ; // only something to do if uri is non-null & non-empty u if ( uri != null ) { uri = uri . trim ( ) ; if ( ! uri . equals ( "" ) ) { String [ ] parts = splitOnNonEscapedChar ( uri , ' ' , 2 ) ; // parts[1] (if present) is the NVPs, so only something to do if present & non-empty if ( parts . length >= 2 ) { String nvps = parts [ 1 ] . trim ( ) ; if ( ! nvps . equals ( "" ) ) { // break the nvps string into an array of name=value strings // Use a regular expression to split on an '&' only if it isn't preceeded by a '\'. String [ ] nvpArray = splitOnNonEscapedChar ( nvps , ' ' , - 1 ) ; // Search the array for the named property String propNameE = propName + "=" ; for ( int i = 0 ; i < nvpArray . length ; i ++ ) { String nvp = nvpArray [ i ] ; if ( nvp . startsWith ( propNameE ) ) { // everything after the = is the value result = nvp . substring ( propNameE . length ( ) ) ; break ; // exit the loop } } } } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "extractPropertyFromURI" , result ) ; return result ; }
Extract the value of the named property from URI . Find the named property in the name value pairs of the uri and return the value or null if the property is not present .