idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
34,800
public static SyncMapItemFetcher fetcher ( final String pathServiceSid , final String pathMapSid , final String pathKey ) { return new SyncMapItemFetcher ( pathServiceSid , pathMapSid , pathKey ) ; }
Create a SyncMapItemFetcher to execute fetch .
34,801
public static SyncMapItemDeleter deleter ( final String pathServiceSid , final String pathMapSid , final String pathKey ) { return new SyncMapItemDeleter ( pathServiceSid , pathMapSid , pathKey ) ; }
Create a SyncMapItemDeleter to execute delete .
34,802
public static SyncMapItemCreator creator ( final String pathServiceSid , final String pathMapSid , final String key , final Map < String , Object > data ) { return new SyncMapItemCreator ( pathServiceSid , pathMapSid , key , data ) ; }
Create a SyncMapItemCreator to execute create .
34,803
public static MediaDeleter deleter ( final String pathAccountSid , final String pathMessageSid , final String pathSid ) { return new MediaDeleter ( pathAccountSid , pathMessageSid , pathSid ) ; }
Create a MediaDeleter to execute delete .
34,804
public static MediaFetcher fetcher ( final String pathAccountSid , final String pathMessageSid , final String pathSid ) { return new MediaFetcher ( pathAccountSid , pathMessageSid , pathSid ) ; }
Create a MediaFetcher to execute fetch .
34,805
public static CredentialCreator creator ( final String pathAccountSid , final String pathCredentialListSid , final String username , final String password ) { return new CredentialCreator ( pathAccountSid , pathCredentialListSid , username , password ) ; }
Create a CredentialCreator to execute create .
34,806
public static CredentialFetcher fetcher ( final String pathAccountSid , final String pathCredentialListSid , final String pathSid ) { return new CredentialFetcher ( pathAccountSid , pathCredentialListSid , pathSid ) ; }
Create a CredentialFetcher to execute fetch .
34,807
public static CredentialUpdater updater ( final String pathAccountSid , final String pathCredentialListSid , final String pathSid ) { return new CredentialUpdater ( pathAccountSid , pathCredentialListSid , pathSid ) ; }
Create a CredentialUpdater to execute update .
34,808
public static CredentialDeleter deleter ( final String pathAccountSid , final String pathCredentialListSid , final String pathSid ) { return new CredentialDeleter ( pathAccountSid , pathCredentialListSid , pathSid ) ; }
Create a CredentialDeleter to execute delete .
34,809
public static ValidationToken fromHttpRequest ( String accountSid , String credentialSid , String signingKeySid , PrivateKey privateKey , HttpRequest request , List < String > signedHeaders ) throws IOException { Builder builder = new Builder ( accountSid , credentialSid , signingKeySid , privateKey ) ; String method = request . getRequestLine ( ) . getMethod ( ) ; builder . method ( method ) ; String uri = request . getRequestLine ( ) . getUri ( ) ; if ( uri . contains ( "?" ) ) { String [ ] uriParts = uri . split ( "\\?" ) ; builder . uri ( uriParts [ 0 ] ) ; builder . queryString ( uriParts [ 1 ] ) ; } else { builder . uri ( uri ) ; } builder . headers ( request . getAllHeaders ( ) ) ; builder . signedHeaders ( signedHeaders ) ; if ( request instanceof HttpEntityEnclosingRequest ) { HttpEntity entity = ( ( HttpEntityEnclosingRequest ) request ) . getEntity ( ) ; builder . requestBody ( CharStreams . toString ( new InputStreamReader ( entity . getContent ( ) , Charsets . UTF_8 ) ) ) ; } return builder . build ( ) ; }
Create a ValidationToken from an HTTP Request .
34,810
public Response request ( final Request request ) { request . setAuth ( username , password ) ; return httpClient . reliableRequest ( request ) ; }
Make a request to Twilio .
34,811
public static CredentialListMappingCreator creator ( final String pathAccountSid , final String pathDomainSid , final String credentialListSid ) { return new CredentialListMappingCreator ( pathAccountSid , pathDomainSid , credentialListSid ) ; }
Create a CredentialListMappingCreator to execute create .
34,812
public static CredentialListMappingFetcher fetcher ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new CredentialListMappingFetcher ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a CredentialListMappingFetcher to execute fetch .
34,813
public static CredentialListMappingDeleter deleter ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new CredentialListMappingDeleter ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a CredentialListMappingDeleter to execute delete .
34,814
public static WebhookFetcher fetcher ( final String pathServiceSid , final String pathChannelSid , final String pathSid ) { return new WebhookFetcher ( pathServiceSid , pathChannelSid , pathSid ) ; }
Create a WebhookFetcher to execute fetch .
34,815
public static WebhookUpdater updater ( final String pathServiceSid , final String pathChannelSid , final String pathSid ) { return new WebhookUpdater ( pathServiceSid , pathChannelSid , pathSid ) ; }
Create a WebhookUpdater to execute update .
34,816
public static WebhookDeleter deleter ( final String pathServiceSid , final String pathChannelSid , final String pathSid ) { return new WebhookDeleter ( pathServiceSid , pathChannelSid , pathSid ) ; }
Create a WebhookDeleter to execute delete .
34,817
public VoiceGrant setOutgoingApplication ( String outgoingApplicationSid , Map < String , Object > outgoingApplicationParams ) { this . outgoingApplicationSid = outgoingApplicationSid ; this . outgoingApplicationParams = outgoingApplicationParams ; return this ; }
Set the outgoing application .
34,818
@ SuppressWarnings ( "checkstyle:linelength" ) public Message update ( final TwilioRestClient client ) { Request request = new Request ( HttpMethod . POST , Domains . IPMESSAGING . toString ( ) , "/v1/Services/" + this . pathServiceSid + "/Channels/" + this . pathChannelSid + "/Messages/" + this . pathSid + "" , client . getRegion ( ) ) ; addPostParams ( request ) ; Response response = client . request ( request ) ; if ( response == null ) { throw new ApiConnectionException ( "Message update failed: Unable to connect to server" ) ; } else if ( ! TwilioRestClient . SUCCESS . apply ( response . getStatusCode ( ) ) ) { RestException restException = RestException . fromJson ( response . getStream ( ) , client . getObjectMapper ( ) ) ; if ( restException == null ) { throw new ApiException ( "Server Error, no content" ) ; } throw new ApiException ( restException . getMessage ( ) , restException . getCode ( ) , restException . getMoreInfo ( ) , restException . getStatus ( ) , null ) ; } return Message . fromJson ( response . getStream ( ) , client . getObjectMapper ( ) ) ; }
Make the request to the Twilio API to perform the update .
34,819
public static void main ( final String [ ] args ) throws TwiMLException , URISyntaxException { Say say = new Say . Builder ( "Hello World!" ) . voice ( Say . Voice . MAN ) . loop ( 5 ) . build ( ) ; VoiceResponse response = new VoiceResponse . Builder ( ) . say ( say ) . build ( ) ; System . out . println ( response . toXml ( ) ) ; Gather gather = new Gather . Builder ( ) . numDigits ( 10 ) . say ( new Say . Builder ( "Press 1" ) . build ( ) ) . build ( ) ; Redirect redirect = new Redirect . Builder ( new URI ( "https://example.com" ) ) . build ( ) ; response = new VoiceResponse . Builder ( ) . gather ( gather ) . redirect ( redirect ) . build ( ) ; System . out . println ( response . toXml ( ) ) ; Conference conference = new Conference . Builder ( "my room" ) . beep ( Conference . Beep . TRUE ) . build ( ) ; Dial dial = new Dial . Builder ( ) . callerId ( "+1 (555) 555-5555" ) . action ( new URI ( "https:///example.com" ) ) . hangupOnStar ( true ) . conference ( conference ) . build ( ) ; response = new VoiceResponse . Builder ( ) . dial ( dial ) . build ( ) ; System . out . println ( response . toXml ( ) ) ; }
TwiML example usage .
34,820
public static NotificationFetcher fetcher ( final String pathAccountSid , final String pathCallSid , final String pathSid ) { return new NotificationFetcher ( pathAccountSid , pathCallSid , pathSid ) ; }
Create a NotificationFetcher to execute fetch .
34,821
public static NotificationDeleter deleter ( final String pathAccountSid , final String pathCallSid , final String pathSid ) { return new NotificationDeleter ( pathAccountSid , pathCallSid , pathSid ) ; }
Create a NotificationDeleter to execute delete .
34,822
public static FieldValueFetcher fetcher ( final String pathAssistantSid , final String pathFieldTypeSid , final String pathSid ) { return new FieldValueFetcher ( pathAssistantSid , pathFieldTypeSid , pathSid ) ; }
Create a FieldValueFetcher to execute fetch .
34,823
public static FieldValueCreator creator ( final String pathAssistantSid , final String pathFieldTypeSid , final String language , final String value ) { return new FieldValueCreator ( pathAssistantSid , pathFieldTypeSid , language , value ) ; }
Create a FieldValueCreator to execute create .
34,824
public static FieldValueDeleter deleter ( final String pathAssistantSid , final String pathFieldTypeSid , final String pathSid ) { return new FieldValueDeleter ( pathAssistantSid , pathFieldTypeSid , pathSid ) ; }
Create a FieldValueDeleter to execute delete .
34,825
public static InstalledAddOnExtensionUpdater updater ( final String pathInstalledAddOnSid , final String pathSid , final Boolean enabled ) { return new InstalledAddOnExtensionUpdater ( pathInstalledAddOnSid , pathSid , enabled ) ; }
Create a InstalledAddOnExtensionUpdater to execute update .
34,826
public static AssetUpdater updater ( final String pathServiceSid , final String pathSid , final String friendlyName ) { return new AssetUpdater ( pathServiceSid , pathSid , friendlyName ) ; }
Create a AssetUpdater to execute update .
34,827
public static IpAddressCreator creator ( final String pathAccountSid , final String pathIpAccessControlListSid , final String friendlyName , final String ipAddress ) { return new IpAddressCreator ( pathAccountSid , pathIpAccessControlListSid , friendlyName , ipAddress ) ; }
Create a IpAddressCreator to execute create .
34,828
public static IpAddressFetcher fetcher ( final String pathAccountSid , final String pathIpAccessControlListSid , final String pathSid ) { return new IpAddressFetcher ( pathAccountSid , pathIpAccessControlListSid , pathSid ) ; }
Create a IpAddressFetcher to execute fetch .
34,829
public static IpAddressUpdater updater ( final String pathAccountSid , final String pathIpAccessControlListSid , final String pathSid ) { return new IpAddressUpdater ( pathAccountSid , pathIpAccessControlListSid , pathSid ) ; }
Create a IpAddressUpdater to execute update .
34,830
public static IpAddressDeleter deleter ( final String pathAccountSid , final String pathIpAccessControlListSid , final String pathSid ) { return new IpAddressDeleter ( pathAccountSid , pathIpAccessControlListSid , pathSid ) ; }
Create a IpAddressDeleter to execute delete .
34,831
public static TaskChannelCreator creator ( final String pathWorkspaceSid , final String friendlyName , final String uniqueName ) { return new TaskChannelCreator ( pathWorkspaceSid , friendlyName , uniqueName ) ; }
Create a TaskChannelCreator to execute create .
34,832
public static StepContextFetcher fetcher ( final String pathFlowSid , final String pathEngagementSid , final String pathStepSid ) { return new StepContextFetcher ( pathFlowSid , pathEngagementSid , pathStepSid ) ; }
Create a StepContextFetcher to execute fetch .
34,833
public static AssetVersionFetcher fetcher ( final String pathServiceSid , final String pathAssetSid , final String pathSid ) { return new AssetVersionFetcher ( pathServiceSid , pathAssetSid , pathSid ) ; }
Create a AssetVersionFetcher to execute fetch .
34,834
public static AssetVersionCreator creator ( final String pathServiceSid , final String pathAssetSid , final String path , final AssetVersion . Visibility visibility ) { return new AssetVersionCreator ( pathServiceSid , pathAssetSid , path , visibility ) ; }
Create a AssetVersionCreator to execute create .
34,835
public static DeploymentFetcher fetcher ( final String pathServiceSid , final String pathEnvironmentSid , final String pathSid ) { return new DeploymentFetcher ( pathServiceSid , pathEnvironmentSid , pathSid ) ; }
Create a DeploymentFetcher to execute fetch .
34,836
public static DeploymentCreator creator ( final String pathServiceSid , final String pathEnvironmentSid , final String buildSid ) { return new DeploymentCreator ( pathServiceSid , pathEnvironmentSid , buildSid ) ; }
Create a DeploymentCreator to execute create .
34,837
public void setConfig ( LogFileConfiguration config ) { this . config = config == null ? null : config . readOnlyCopy ( ) ; if ( config == null ) { Log . w ( DOMAIN , "Database.log.getFile().getConfig() is now null, meaning file logging is disabled. " + "Log files required for product support are not being generated." ) ; } updateConfig ( ) ; }
Sets the configuration currently to use on the file logger . Note that once it is set it can no longer be modified and doing so will throw an exception
34,838
public static String getSysInfo ( ) { String info = sysInfo . get ( ) ; if ( info == null ) { final String version = Build . VERSION . RELEASE ; final String model = Build . MODEL ; info = String . format ( Locale . ENGLISH , SYS_INFO , ( version . length ( ) <= 0 ) ? "0.0" : version , ( model . length ( ) <= 0 ) ? "unknown" : model ) ; sysInfo . compareAndSet ( null , info ) ; } return info ; }
This is information about the Android on which we are running .
34,839
public static PrecisionContextRoundedOperator of ( MathContext mathContext ) { Objects . requireNonNull ( mathContext ) ; if ( RoundingMode . UNNECESSARY . equals ( mathContext . getRoundingMode ( ) ) ) { throw new IllegalArgumentException ( "To create the MathContextRoundedOperator you cannot use the RoundingMode.UNNECESSARY on MathContext" ) ; } if ( mathContext . getPrecision ( ) <= 0 ) { throw new IllegalArgumentException ( "To create the MathContextRoundedOperator you cannot use the zero precision on MathContext" ) ; } return new PrecisionContextRoundedOperator ( mathContext ) ; }
Creates the rounded Operator from mathContext
34,840
protected void checkNumber ( Number number ) { Objects . requireNonNull ( number , "Number is required." ) ; if ( number . longValue ( ) > MAX_BD . longValue ( ) ) { throw new ArithmeticException ( "Value exceeds maximal value: " + MAX_BD ) ; } BigDecimal bd = MoneyUtils . getBigDecimal ( number ) ; if ( bd . precision ( ) > MAX_BD . precision ( ) ) { throw new ArithmeticException ( "Precision exceeds maximal precision: " + MAX_BD . precision ( ) ) ; } if ( bd . scale ( ) > SCALE ) { String val = MonetaryConfig . getConfig ( ) . get ( "org.javamoney.moneta.FastMoney.enforceScaleCompatibility" ) ; if ( val == null ) { val = "false" ; } if ( Boolean . parseBoolean ( val ) ) { throw new ArithmeticException ( "Scale of " + bd + " exceeds maximal scale: " + SCALE ) ; } else { if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . finest ( "Scale exceeds maximal scale of FastMoney (" + SCALE + "), implicit rounding will be applied to " + number ) ; } } } }
Internal method to check for correct number parameter .
34,841
void addRate ( CurrencyUnit term , LocalDate localDate , Number rate ) { RateType rateType = RateType . HISTORIC ; ExchangeRateBuilder builder ; if ( Objects . nonNull ( localDate ) ) { if ( localDate . equals ( LocalDate . now ( ) ) ) { rateType = RateType . DEFERRED ; } builder = new ExchangeRateBuilder ( ConversionContextBuilder . create ( context , rateType ) . set ( localDate ) . build ( ) ) ; } else { builder = new ExchangeRateBuilder ( ConversionContextBuilder . create ( context , rateType ) . build ( ) ) ; } builder . setBase ( ECBHistoricRateProvider . BASE_CURRENCY ) ; builder . setTerm ( term ) ; builder . setFactor ( DefaultNumberValue . of ( rate ) ) ; ExchangeRate exchangeRate = builder . build ( ) ; Map < String , ExchangeRate > rateMap = this . historicRates . get ( localDate ) ; if ( Objects . isNull ( rateMap ) ) { synchronized ( this . historicRates ) { rateMap = Optional . ofNullable ( this . historicRates . get ( localDate ) ) . orElse ( new ConcurrentHashMap < > ( ) ) ; this . historicRates . putIfAbsent ( localDate , rateMap ) ; } } rateMap . put ( term . getCurrencyCode ( ) , exchangeRate ) ; }
Method to add a currency exchange rate .
34,842
public Set < String > getProviderNames ( ) { Set < String > result = new HashSet < > ( ) ; for ( CurrencyProviderSpi spi : Bootstrap . getServices ( CurrencyProviderSpi . class ) ) { try { result . add ( spi . getProviderName ( ) ) ; } catch ( Exception e ) { Logger . getLogger ( DefaultMonetaryCurrenciesSingletonSpi . class . getName ( ) ) . log ( Level . SEVERE , "Error loading currency provider names for " + spi . getClass ( ) . getName ( ) , e ) ; } } return result ; }
Get the names of the currently loaded providers .
34,843
public ExchangeRate getExchangeRate ( MonetaryAmount amount ) { return this . rateProvider . getExchangeRate ( ConversionQueryBuilder . of ( conversionQuery ) . setBaseCurrency ( amount . getCurrency ( ) ) . build ( ) ) ; }
Get the exchange rate type that this provider instance is providing data for .
34,844
public static Money parse ( CharSequence text , MonetaryAmountFormat formatter ) { return from ( formatter . parse ( text ) ) ; }
Obtains an instance of Money from a text using specific formatter .
34,845
public static boolean isInfinityAndNotNaN ( Number number ) { if ( Double . class == number . getClass ( ) || Float . class == number . getClass ( ) ) { double dValue = number . doubleValue ( ) ; if ( ! Double . isNaN ( dValue ) && Double . isInfinite ( dValue ) ) { return true ; } } return false ; }
Just to don t break the compatibility . Don t use it
34,846
public boolean load ( ) { if ( ( lastLoaded + cacheTTLMillis ) <= System . currentTimeMillis ( ) ) { clearCache ( ) ; } if ( ! readCache ( ) ) { if ( shouldReadDataFromFallback ( ) ) { return loadFallback ( ) ; } } return true ; }
Loads the resource first from the remote resources if that fails from the fallback location .
34,847
public boolean loadRemote ( ) { for ( URI itemToLoad : remoteResources ) { try { return load ( itemToLoad , false ) ; } catch ( Exception e ) { LOG . log ( Level . INFO , "Failed to load resource: " + itemToLoad , e ) ; } } return false ; }
Try to load the resource from the remote locations .
34,848
public boolean loadFallback ( ) { try { if ( fallbackLocation == null ) { Logger . getLogger ( getClass ( ) . getName ( ) ) . warning ( "No fallback resource for " + this + ", loadFallback not supported." ) ; return false ; } load ( fallbackLocation , true ) ; clearCache ( ) ; return true ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "Failed to load fallback resource: " + fallbackLocation , e ) ; } return false ; }
Try to load the resource from the fallback resources . This will override any remote data already loaded and also will clear the cached data .
34,849
public boolean isAvailable ( ConversionQuery conversionQuery ) { return conversionQuery . getBaseCurrency ( ) . getCurrencyCode ( ) . equals ( conversionQuery . getCurrency ( ) . getCurrencyCode ( ) ) ; }
Check if this provider can provide a rate which is only the case if base and term are equal .
34,850
public static CurrencyUnitBuilder of ( String currencyCode , String providerName ) { return new CurrencyUnitBuilder ( currencyCode , CurrencyContextBuilder . of ( providerName ) . build ( ) ) ; }
Creates a new CurrencyUnitBuilder creates a simple CurrencyContext using the given provider name .
34,851
public CurrencyUnitBuilder setCurrencyCode ( String currencyCode ) { Objects . requireNonNull ( currencyCode , "currencyCode required" ) ; this . currencyCode = currencyCode ; this . currencyContext = CurrencyContextBuilder . of ( getClass ( ) . getSimpleName ( ) ) . build ( ) ; return this ; }
Allows to set the currency code for creating multiple instances using one Builder .
34,852
public static void checkAmountParameter ( MonetaryAmount amount , CurrencyUnit currencyUnit ) { requireNonNull ( amount , "Amount must not be null." ) ; final CurrencyUnit amountCurrency = amount . getCurrency ( ) ; if ( ! currencyUnit . getCurrencyCode ( ) . equals ( amountCurrency . getCurrencyCode ( ) ) ) { throw new MonetaryException ( "Currency mismatch: " + currencyUnit + '/' + amountCurrency ) ; } }
Method to check if a currency is compatible with this amount instance .
34,853
public static Collector < MonetaryAmount , ? , Map < CurrencyUnit , List < MonetaryAmount > > > groupByCurrencyUnit ( ) { return Collectors . groupingBy ( MonetaryAmount :: getCurrency ) ; }
Collector to group by CurrencyUnit
34,854
public static Collector < MonetaryAmount , MonetarySummaryStatistics , MonetarySummaryStatistics > summarizingMonetary ( CurrencyUnit currencyUnit ) { Supplier < MonetarySummaryStatistics > supplier = ( ) -> new DefaultMonetarySummaryStatistics ( currencyUnit ) ; return Collector . of ( supplier , MonetarySummaryStatistics :: accept , MonetarySummaryStatistics :: combine ) ; }
Creates a the summary of MonetaryAmounts .
34,855
public static Collector < MonetaryAmount , MonetarySummaryStatistics , MonetarySummaryStatistics > summarizingMonetary ( CurrencyUnit currencyUnit , ExchangeRateProvider provider ) { return summarizingMonetary ( currencyUnit ) ; }
reates a the summary of MonetaryAmounts .
34,856
public static Collector < MonetaryAmount , GroupMonetarySummaryStatistics , GroupMonetarySummaryStatistics > groupBySummarizingMonetary ( ) { return Collector . of ( GroupMonetarySummaryStatistics :: new , GroupMonetarySummaryStatistics :: accept , GroupMonetarySummaryStatistics :: combine ) ; }
of MonetaryAmount group by MonetarySummary
34,857
public static Predicate < MonetaryAmount > isBetween ( MonetaryAmount min , MonetaryAmount max ) { return isLessThanOrEqualTo ( max ) . and ( isGreaterThanOrEqualTo ( min ) ) ; }
Creates a filter using the isBetween predicate .
34,858
public static MonetaryAmount sum ( MonetaryAmount a , MonetaryAmount b ) { MoneyUtils . checkAmountParameter ( Objects . requireNonNull ( a ) , Objects . requireNonNull ( b . getCurrency ( ) ) ) ; return a . add ( b ) ; }
Adds two monetary together
34,859
public static BinaryOperator < MonetaryAmount > sum ( ExchangeRateProvider provider , CurrencyUnit currency ) { CurrencyConversion currencyConversion = provider . getCurrencyConversion ( currency ) ; return ( m1 , m2 ) -> currencyConversion . apply ( m1 ) . add ( currencyConversion . apply ( m2 ) ) ; }
return the sum and convert all values to specific currency using the provider if necessary
34,860
public static BinaryOperator < MonetaryAmount > min ( ExchangeRateProvider provider ) { return ( m1 , m2 ) -> { CurrencyConversion conversion = provider . getCurrencyConversion ( m1 . getCurrency ( ) ) ; if ( m1 . isGreaterThan ( conversion . apply ( m2 ) ) ) { return m2 ; } return m1 ; } ; }
return the minimum value if the monetary amounts have different currencies will converter first using the given ExchangeRateProvider
34,861
public static Collector < MonetaryAmount , MonetarySummaryStatistics , MonetarySummaryStatistics > summarizingMonetary ( CurrencyUnit currencyUnit , ExchangeRateProvider provider ) { Supplier < MonetarySummaryStatistics > supplier = ( ) -> new ExchangeRateMonetarySummaryStatistics ( currencyUnit , provider ) ; return Collector . of ( supplier , MonetarySummaryStatistics :: accept , MonetarySummaryStatistics :: combine ) ; }
of the summary of the MonetaryAmount
34,862
public byte [ ] getBlock ( String url , long offset , int length ) throws IOException { HttpMethod method = null ; try { method = new GetMethod ( url ) ; } catch ( IllegalArgumentException e ) { LOGGER . warning ( "Bad URL for block fetch:" + url ) ; throw new IOException ( "Url:" + url + " does not look like an URL?" ) ; } StringBuilder sb = new StringBuilder ( 16 ) ; sb . append ( ZiplinedBlock . BYTES_HEADER ) . append ( offset ) ; sb . append ( ZiplinedBlock . BYTES_MINUS ) . append ( ( offset + length ) - 1 ) ; String rangeHeader = sb . toString ( ) ; method . addRequestHeader ( ZiplinedBlock . RANGE_HEADER , rangeHeader ) ; long start = System . currentTimeMillis ( ) ; try { LOGGER . fine ( "Reading block:" + url + "(" + rangeHeader + ")" ) ; int status = http . executeMethod ( method ) ; if ( ( status == 200 ) || ( status == 206 ) ) { InputStream is = method . getResponseBodyAsStream ( ) ; byte [ ] block = new byte [ length ] ; ByteStreams . readFully ( is , block ) ; long elapsed = System . currentTimeMillis ( ) - start ; PerformanceLogger . noteElapsed ( "CDXBlockLoad" , elapsed , url ) ; return block ; } else { throw new IOException ( "Bad status for " + url ) ; } } finally { method . releaseConnection ( ) ; } }
Fetch a range of bytes from a particular URL . Note that the bytes are read into memory all at once so care should be taken with the length argument .
34,863
public static RequestMapper readSpringConfig ( String configPath , ServletContext servletContext ) { LOGGER . info ( "Loading from config file " + configPath ) ; currentContext = new FileSystemXmlApplicationContext ( "file:" + configPath ) ; Map < String , RequestHandler > beans = currentContext . getBeansOfType ( RequestHandler . class , false , false ) ; return new RequestMapper ( beans . values ( ) , servletContext ) ; }
Read the single Spring XML configuration file located at the specified path performing PropertyPlaceHolder interpolation extracting all beans which implement the RequestHandler interface and construct a RequestMapper for those RequestHandlers on the specified ServletContext .
34,864
public static String renderHTML ( Graph graph , String mapName , String imgUrl , String targets [ ] , String titles [ ] ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<map name=\"" ) . append ( mapName ) . append ( "\">" ) ; RegionGraphElement rge [ ] = graph . getRegions ( ) ; int count = rge . length ; for ( int i = 0 ; i < count ; i ++ ) { if ( targets [ i ] != null ) { Rectangle r = rge [ i ] . getBoundingRectangle ( ) ; sb . append ( "<area href=\"" ) . append ( targets [ i ] ) . append ( "\"" ) ; if ( titles [ i ] != null ) { sb . append ( " title=\"" ) . append ( titles [ i ] ) . append ( "\"" ) ; } sb . append ( " shape=\"rect\" coords=\"" ) ; sb . append ( r . x ) . append ( "," ) ; sb . append ( r . y ) . append ( "," ) ; sb . append ( r . x + r . width ) . append ( "," ) ; sb . append ( r . y + r . height ) . append ( "\" border=\"1\" />" ) ; } } sb . append ( "</map>" ) ; sb . append ( "<image src=\"" ) . append ( imgUrl ) . append ( "\"" ) ; sb . append ( " border=\"0\" width=\"" ) . append ( graph . width ) . append ( "\"" ) ; sb . append ( " height=\"" ) . append ( graph . height ) . append ( "\"" ) ; sb . append ( " usemap=\"#" ) . append ( mapName ) . append ( "\" />" ) ; return sb . toString ( ) ; }
Create both an HTML AREA map and an HTML IMG for a graph using provided href targets and titles within the AREA map .
34,865
public void render ( OutputStream target , Graph graph ) throws IOException { BufferedImage bi = new BufferedImage ( graph . width , graph . height , GraphConfiguration . imageType ) ; Graphics2D g2d = bi . createGraphics ( ) ; graph . draw ( g2d ) ; ImageIO . write ( bi , "png" , target ) ; }
Send a PNG format byte stream for the argument Graph to the provided OutputStream
34,866
public static DecodingResource forEncoding ( String contentEncoding , Resource source ) throws IOException { InputStream stream = decodingStream ( contentEncoding , source ) ; if ( stream == null ) { return null ; } return new DecodingResource ( source , stream ) ; }
Returns a DecodingResource that wraps an existing resource with a decompressor for the given Content - Encoding .
34,867
public void setCDXSources ( List < String > cdxs ) { sources = new ArrayList < SearchResultSource > ( ) ; for ( int i = 0 ; i < cdxs . size ( ) ; i ++ ) { CDXIndex index = new CDXIndex ( ) ; index . setPath ( cdxs . get ( i ) ) ; addSource ( index ) ; } }
Sets the list of files searched for queries against this SearchResultSource to the list of paths cdxs
34,868
public static Graph decode ( String encodedGraph , boolean noMonth ) throws GraphEncodingException { GraphConfiguration config = new GraphConfiguration ( ) ; if ( noMonth ) { config . valueHighlightColor = config . valueColor ; } return decode ( encodedGraph , config ) ; }
convert a String - encoded graph into a usable Graph object using default GraphConfiguration
34,869
public static Graph decode ( String encodedGraph , GraphConfiguration config ) throws GraphEncodingException { String parts [ ] = encodedGraph . split ( DELIM ) ; int numRegions = parts . length - 2 ; if ( parts . length < 1 ) { throw new GraphEncodingException ( "No regions defined!" ) ; } int width ; int height ; try { width = Integer . parseInt ( parts [ 0 ] ) ; } catch ( NumberFormatException e ) { throw new GraphEncodingException ( "Bad integer width:" + parts [ 0 ] ) ; } try { height = Integer . parseInt ( parts [ 1 ] ) ; } catch ( NumberFormatException e ) { throw new GraphEncodingException ( "Bad integer width:" + parts [ 0 ] ) ; } RegionData data [ ] = new RegionData [ numRegions ] ; for ( int i = 0 ; i < numRegions ; i ++ ) { String regionParts [ ] = parts [ i + 2 ] . split ( REGION_DELIM ) ; if ( regionParts . length != 3 ) { throw new GraphEncodingException ( "Wrong number of parts in " + parts [ i + 2 ] ) ; } int highlightedValue = Integer . parseInt ( regionParts [ 1 ] ) ; int values [ ] = decodeHex ( regionParts [ 2 ] ) ; data [ i ] = new RegionData ( regionParts [ 0 ] , highlightedValue , values ) ; } return new Graph ( width , height , data , config ) ; }
convert a String - encoded graph into a usable Graph object using the provided GraphConfiguration .
34,870
public static String encode ( Graph g ) { RegionGraphElement rge [ ] = g . getRegions ( ) ; RegionData data [ ] = new RegionData [ rge . length ] ; for ( int i = 0 ; i < data . length ; i ++ ) { data [ i ] = rge [ i ] . getData ( ) ; } return encode ( g . width , g . height , data ) ; }
Convert a complete Graph into an opaque String that can later be re - assembled into a Graph object . Note that GraphConfiguration information is NOT encoded into the opaque String .
34,871
public static String encode ( int width , int height , RegionData data [ ] ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( width ) . append ( DELIM ) ; sb . append ( height ) ; boolean first = false ; for ( RegionData datum : data ) { if ( first ) { first = false ; } else { sb . append ( DELIM ) ; } sb . append ( datum . getLabel ( ) ) . append ( REGION_DELIM ) ; sb . append ( datum . getHighlightedValue ( ) ) . append ( REGION_DELIM ) ; sb . append ( encodeHex ( datum . getValues ( ) ) ) ; } return sb . toString ( ) ; }
Convert a Graph fields into an opaque String that can later be re - assembled into a Graph object . Note that GraphConfiguration information is NOT encoded into the opaque String .
34,872
public String processIfMatches ( final I input ) { String uriAsString = input . getUri ( ) ; String text = input . getTextToProcess ( ) ; Matcher m = patternImpl . matcher ( uriAsString ) ; if ( ! m . find ( ) ) { if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( "Rule " + getClass ( ) . getSimpleName ( ) + ": skipped " + uriAsString ) ; } return text ; } String result = new String ( text ) ; for ( PatternBasedTextProcessor proc : processors ) { result = proc . process ( result ) ; } if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( "Rule " + getClass ( ) . getSimpleName ( ) + ": processed " + uriAsString ) ; } return result ; }
Processes the given URI if it matches the configured pattern .
34,873
public static ArrayList < ResultsPartition > get ( CaptureSearchResults results , WaybackRequest wbRequest ) { return get ( results , wbRequest , null ) ; }
Determine the correct ResultsPartitioner to use given the SearchResults search range and use that to break the SearchResults into partitions .
34,874
public ValueGraphElement getElement ( int i ) { if ( ( i < 0 ) || ( i >= values . length ) ) { throw new NoSuchElementException ( ) ; } int minHeight = config . valueMinHeight ; float value = ( ( float ) values [ i ] ) / ( ( float ) maxValue ) ; float usableHeight = height - minHeight ; int valueHeight = ( int ) ( usableHeight * value ) + minHeight ; int elX = Graph . xlateX ( width , values . length , i ) ; int elW = Graph . xlateX ( width , values . length , i + 1 ) - elX ; int elY = height - valueHeight ; boolean hot = i == highlightValue ; return new ValueGraphElement ( x + elX , y + elY , elW , valueHeight , hot , config ) ; }
return the i th ValueGraphElement
34,875
public synchronized void setMembers ( String [ ] urls ) { HashMap < String , RangeMember > newMembers = new HashMap < String , RangeMember > ( ) ; for ( int i = 0 ; i < urls . length ; i ++ ) { if ( members . containsKey ( urls [ i ] ) ) { newMembers . put ( urls [ i ] , members . get ( urls [ i ] ) ) ; } else { RangeMember newMember = new RangeMember ( ) ; newMember . setUrlBase ( urls [ i ] ) ; newMembers . put ( urls [ i ] , newMember ) ; } } members = newMembers ; }
Update the list of members of this group . Members that disappear are lost but members that remain across the operation retain their state .
34,876
public static String getAllStats ( OutputFormat format ) { StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; Collection < PerfStatEntry > stats = perfStats . get ( ) . values ( ) ; switch ( format ) { case JSON : sb . append ( '{' ) ; for ( PerfStatEntry entry : stats ) { if ( entry . count > 0 ) { if ( first ) { first = false ; } else { sb . append ( ',' ) ; } sb . append ( '"' ) . append ( entry . name ) . append ( "\":" ) ; if ( entry . isErr ) sb . append ( "null" ) ; else sb . append ( entry . total ) ; } } sb . append ( '}' ) ; break ; default : sb . append ( "[" ) ; for ( PerfStatEntry entry : stats ) { if ( entry . count > 0 ) { if ( first ) { first = false ; } else { sb . append ( ", " ) ; } sb . append ( entry . toString ( ) ) ; } } sb . append ( "]" ) ; break ; } return sb . toString ( ) ; }
Format all stats in the format specified .
34,877
public void resolvePageUrls ( ) { String pageUrl = result . getOriginalUrl ( ) ; String captureDate = result . getCaptureTimestamp ( ) ; String existingBaseHref = TagMagix . getBaseHref ( sb ) ; if ( existingBaseHref == null ) { insertAtStartOfHead ( "<base href=\"" + pageUrl + "\" />" ) ; } else { pageUrl = existingBaseHref ; } String markups [ ] [ ] = { { "FRAME" , "SRC" } , { "META" , "URL" } , { "LINK" , "HREF" } , { "SCRIPT" , "SRC" } , { TagMagix . ANY_TAGNAME , "background" } } ; for ( String tagAttr [ ] : markups ) { TagMagix . markupTagREURIC ( sb , uriConverter , captureDate , pageUrl , tagAttr [ 0 ] , tagAttr [ 1 ] ) ; } TagMagix . markupCSSImports ( sb , uriConverter , captureDate , pageUrl ) ; TagMagix . markupStyleUrls ( sb , uriConverter , captureDate , pageUrl ) ; }
Update URLs inside the page so those URLs which must be correct at page load time resolve correctly to absolute URLs .
34,878
public void resolveAllPageUrls ( ) { String pageUrl = result . getOriginalUrl ( ) ; String captureDate = result . getCaptureTimestamp ( ) ; String existingBaseHref = TagMagix . getBaseHref ( sb ) ; if ( existingBaseHref != null ) { pageUrl = existingBaseHref ; } ResultURIConverter ruc = new SpecialResultURIConverter ( uriConverter ) ; String markups [ ] [ ] = { { "FRAME" , "SRC" } , { "META" , "URL" } , { "LINK" , "HREF" } , { "SCRIPT" , "SRC" } , { "IMG" , "SRC" } , { "A" , "HREF" } , { "AREA" , "HREF" } , { "OBJECT" , "CODEBASE" } , { "OBJECT" , "CDATA" } , { "APPLET" , "CODEBASE" } , { "APPLET" , "ARCHIVE" } , { "EMBED" , "SRC" } , { "IFRAME" , "SRC" } , { TagMagix . ANY_TAGNAME , "background" } } ; for ( String tagAttr [ ] : markups ) { TagMagix . markupTagREURIC ( sb , ruc , captureDate , pageUrl , tagAttr [ 0 ] , tagAttr [ 1 ] ) ; } TagMagix . markupCSSImports ( sb , uriConverter , captureDate , pageUrl ) ; TagMagix . markupStyleUrls ( sb , uriConverter , captureDate , pageUrl ) ; }
Update all URLs inside the page so they resolve correctly to absolute URLs within the Wayback service .
34,879
public void writeToOutputStream ( OutputStream os ) throws IOException { if ( sb == null ) { throw new IllegalStateException ( "No interal StringBuffer" ) ; } byte [ ] b ; try { b = getBytes ( ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } os . write ( b ) ; }
Write the contents of the page to the client .
34,880
public static File ensureDir ( String path , String name ) throws IOException { if ( ( path == null ) || ( path . length ( ) == 0 ) ) { throw new IOException ( "No configuration for (" + name + ")" ) ; } File dir = new File ( path ) ; if ( dir . exists ( ) ) { if ( ! dir . isDirectory ( ) ) { throw new IOException ( "Dir(" + name + ") at (" + path + ") exists but is not a directory!" ) ; } } else { if ( ! dir . mkdirs ( ) ) { throw new IOException ( "Unable to create dir(" + name + ") at (" + path + ")" ) ; } } return dir ; }
Ensure that the path pointed to by path is a directory if possible
34,881
public void setRenderingHints ( Graphics2D g2d ) { g2d . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_OFF ) ; g2d . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; }
Set whatever redneringHints are needed to properly draw the graph ie . AntiAliasing etc .
34,882
public String getLocalized ( String key ) { if ( bundle != null ) { try { return bundle . getString ( key ) ; } catch ( Exception e ) { } } return key ; }
Access a localized string associated with key from the ResourceBundle likely the UI . properties file .
34,883
public void init ( ) throws ConfigurationException { if ( index == null ) { throw new ConfigurationException ( "No index target" ) ; } if ( ! index . isUpdatable ( ) ) { throw new ConfigurationException ( "ResourceIndex is not updatable" ) ; } if ( incoming == null ) { throw new ConfigurationException ( "No incoming" ) ; } if ( runInterval > 0 ) { thread = new UpdateThread ( this , runInterval ) ; thread . start ( ) ; } }
start the background index merging thread
34,884
public void parseHeaders ( ) throws IOException { if ( ! parsedHeader ) { arcRecord . skipHttpHeader ( ) ; Header [ ] headers = arcRecord . getHttpHeaders ( ) ; if ( headers != null ) { for ( int i = 0 ; i < headers . length ; i ++ ) { String value = headers [ i ] . getValue ( ) ; String name = headers [ i ] . getName ( ) ; metaData . put ( HTTP_HEADER_PREFIX + name , value ) ; if ( name . toUpperCase ( ) . contains ( HttpHeaderOperation . HTTP_TRANSFER_ENC_HEADER ) ) { if ( value . toUpperCase ( ) . contains ( HttpHeaderOperation . HTTP_CHUNKED_ENCODING_HEADER ) ) { setChunkedEncoding ( ) ; } } } } Map < String , Object > headerMetaMap = arcRecord . getMetaData ( ) . getHeaderFields ( ) ; Set < String > keys = headerMetaMap . keySet ( ) ; Iterator < String > itr = keys . iterator ( ) ; while ( itr . hasNext ( ) ) { String metaKey = itr . next ( ) ; Object value = headerMetaMap . get ( metaKey ) ; String metaValue = "" ; if ( value != null ) { metaValue = value . toString ( ) ; } metaData . put ( ARC_META_PREFIX + metaKey , metaValue ) ; } parsedHeader = true ; } }
parse the headers on the underlying ARC record and extract all
34,885
public String resultToReplayUrl ( CaptureSearchResult result ) { if ( uriConverter == null ) { return null ; } String url = result . getOriginalUrl ( ) ; String captureDate = result . getCaptureTimestamp ( ) ; return uriConverter . makeReplayURI ( captureDate , url ) ; }
Create a replay URL for the given CaptureSearchResult
34,886
public String urlForPage ( int pageNum ) { WaybackRequest wbRequest = getWbRequest ( ) ; return wbRequest . getAccessPoint ( ) . getQueryPrefix ( ) + "query?" + wbRequest . getQueryArguments ( pageNum ) ; }
Create a self - referencing URL that will drive to the given page simplifying rendering pagination
34,887
public void forward ( HttpServletRequest request , HttpServletResponse response , final String target ) throws ServletException , IOException { if ( target . startsWith ( "/WEB-INF/classes" ) || target . startsWith ( "/WEB-INF/lib" ) || target . matches ( "^/WEB-INF/.+\\.xml" ) ) { throw new IOException ( "Not allowed" ) ; } this . contentJsp = target ; this . originalRequestURL = request . getRequestURL ( ) . toString ( ) ; request . setAttribute ( FERRET_NAME , this ) ; RequestDispatcher dispatcher = request . getRequestDispatcher ( target ) ; if ( dispatcher == null ) { throw new IOException ( "No dispatcher for " + target ) ; } dispatcher . forward ( request , response ) ; }
Store this UIResults object in the given HttpServletRequest then forward the request to target in this case an image html file . jsp any file which can return a complete document . Specifically this means that if target is a . jsp it must render it s own header and footer .
34,888
public static UIResults extractException ( HttpServletRequest httpRequest ) throws ServletException { UIResults results = ( UIResults ) httpRequest . getAttribute ( FERRET_NAME ) ; if ( results == null ) { throw new ServletException ( "No attribute.." ) ; } if ( results . exception == null ) { throw new ServletException ( "No WaybackException.." ) ; } if ( results . wbRequest == null ) { throw new ServletException ( "No WaybackRequest.." ) ; } if ( results . uriConverter == null ) { throw new ServletException ( "No ResultURIConverter.." ) ; } return results ; }
Extract an Exception UIResults from the HttpServletRequest . Probably used by a . jsp responsible for actual drawing errors for the user . private
34,889
public static UIResults extractCaptureQuery ( HttpServletRequest httpRequest ) throws ServletException { UIResults results = ( UIResults ) httpRequest . getAttribute ( FERRET_NAME ) ; if ( results == null ) { throw new ServletException ( "No attribute.." ) ; } if ( results . wbRequest == null ) { throw new ServletException ( "No WaybackRequest.." ) ; } if ( results . uriConverter == null ) { throw new ServletException ( "No ResultURIConverter.." ) ; } if ( results . captureResults == null ) { throw new ServletException ( "No CaptureSearchResults.." ) ; } return results ; }
Extract a CaptureQuery UIResults from the HttpServletRequest . Probably used by a . jsp responsible for actually drawing search results for the user .
34,890
public static UIResults extractUrlQuery ( HttpServletRequest httpRequest ) throws ServletException { UIResults results = ( UIResults ) httpRequest . getAttribute ( FERRET_NAME ) ; if ( results == null ) { throw new ServletException ( "No attribute.." ) ; } if ( results . wbRequest == null ) { throw new ServletException ( "No WaybackRequest.." ) ; } if ( results . uriConverter == null ) { throw new ServletException ( "No ResultURIConverter.." ) ; } if ( results . urlResults == null ) { throw new ServletException ( "No UrlSearchResults.." ) ; } return results ; }
Extract a UrlQuery UIResults from the HttpServletRequest . Probably used by a . jsp responsible for actually drawing search results for the user .
34,891
public static UIResults extractReplay ( HttpServletRequest httpRequest ) throws ServletException { UIResults results = ( UIResults ) httpRequest . getAttribute ( FERRET_NAME ) ; if ( results == null ) { throw new ServletException ( "No attribute.." ) ; } if ( results . wbRequest == null ) { throw new ServletException ( "No WaybackRequest.." ) ; } if ( results . uriConverter == null ) { throw new ServletException ( "No ResultURIConverter.." ) ; } if ( results . captureResults == null ) { throw new ServletException ( "No CaptureSearchResults.." ) ; } if ( results . result == null ) { throw new ServletException ( "No CaptureSearchResult.." ) ; } if ( results . resource == null ) { throw new ServletException ( "No Resource.." ) ; } return results ; }
Extract a Replay UIResults from the HttpServletRequest . Probably used by a . jsp insert responsible for rendering content into replayed Resources to enhance the Replay experience .
34,892
public String getTargetSite ( ) { try { String urlstr = wbRequest . getRequestUrl ( ) ; if ( urlstr == null ) return null ; URL url = new URL ( urlstr ) ; return url . getHost ( ) ; } catch ( MalformedURLException ex ) { return null ; } }
return hostname portion of request URL .
34,893
private void populateFileList ( ResourceFileList list , File root , boolean recurse ) throws IOException { if ( root . isDirectory ( ) ) { File [ ] files = root . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { if ( file . isFile ( ) && filter . accept ( root , file . getName ( ) ) ) { ResourceFileLocation location = new ResourceFileLocation ( file . getName ( ) , file . getAbsolutePath ( ) ) ; list . add ( location ) ; } else if ( recurse && file . isDirectory ( ) ) { populateFileList ( list , file , recurse ) ; } } } } else { LOGGER . warning ( root . getAbsolutePath ( ) + " is not a directory." ) ; return ; } }
add all files matching this . filter beneath root to list recursing if recurse is set .
34,894
public synchronized void shutdownDB ( ) throws DatabaseException { if ( db != null ) { db . close ( ) ; db = null ; } if ( env != null ) { env . close ( ) ; env = null ; } }
shut down the BDB .
34,895
public void copyToOutputStream ( OutputStream o ) throws IOException { long left = end - start ; int BUFF_SIZE = 4096 ; byte buf [ ] = new byte [ BUFF_SIZE ] ; RandomAccessFile raf = new RandomAccessFile ( file , "r" ) ; try { raf . seek ( start ) ; while ( left > 0 ) { int amtToRead = ( int ) Math . min ( left , BUFF_SIZE ) ; int amtRead = raf . read ( buf , 0 , amtToRead ) ; if ( amtRead < 0 ) { throw new IOException ( "Not enough to read! EOF before expected region end" ) ; } o . write ( buf , 0 , amtRead ) ; left -= amtRead ; } } finally { raf . close ( ) ; } }
Copy this record to the provided OutputStream
34,896
public void setPrefix ( String prefix ) { this . prefix = prefix ; if ( this . prefix != null && this . prefix . isEmpty ( ) ) this . prefix = null ; }
prefix prepended to the name of headers preserved .
34,897
public static void registerHandler ( RequestHandler handler , RequestMapper mapper ) { String name = null ; int internalPort = 8080 ; if ( handler instanceof AbstractRequestHandler ) { name = ( ( AbstractRequestHandler ) handler ) . getAccessPointPath ( ) ; internalPort = ( ( AbstractRequestHandler ) handler ) . getInternalPort ( ) ; } if ( name == null ) { name = handler . getBeanName ( ) ; if ( name != null ) { LOGGER . warning ( "Request handler with bean name " + name + " does not provide explict " + "access point path. Will try to use the beanname to infer. This fallback " + "is DEPRECATED and will be removed in the future. Please update configuration " + "to explicitly set 'accessPointPath' property (and 'internalPort' if needed)." ) ; } } if ( name != null ) { if ( name . equals ( RequestMapper . GLOBAL_PRE_REQUEST_HANDLER ) ) { LOGGER . info ( "Registering Global-pre request handler:" + handler ) ; mapper . addGlobalPreRequestHandler ( handler ) ; } else if ( name . equals ( RequestMapper . GLOBAL_POST_REQUEST_HANDLER ) ) { LOGGER . info ( "Registering Global-post request handler:" + handler ) ; mapper . addGlobalPostRequestHandler ( handler ) ; } else { try { boolean registered = registerPort ( name , handler , mapper ) || registerPortPath ( name , handler , mapper ) || registerHostPort ( name , handler , mapper ) || registerHostPortPath ( name , handler , mapper ) || registerURIPatternPath ( name , internalPort , handler , mapper ) ; if ( ! registered ) { LOGGER . severe ( "Unable to register (" + name + ")" ) ; } } catch ( NumberFormatException e ) { LOGGER . severe ( "FAILED parseInt(" + name + ")" ) ; } } } else { LOGGER . info ( "Unable to register RequestHandler - null beanName" ) ; } if ( handler instanceof ShutdownListener ) { ShutdownListener s = ( ShutdownListener ) handler ; mapper . addShutdownListener ( s ) ; } }
Extract the RequestHandler objects beanName parse it and register the RequestHandler with the RequestMapper according to the beanNames semantics .
34,898
public static CaptureSearchResult parseCDXLineFlex ( String line ) { CaptureSearchResult result = new CaptureSearchResult ( ) ; return parseCDXLineFlex ( line , result ) ; }
Single place to do the flex cdx - line parsing logic
34,899
public static CaptureSearchResult parseCDXLineFlexFast ( String line ) { CaptureSearchResult result = new FastCaptureSearchResult ( ) ; return parseCDXLineFlex ( line , result ) ; }
Use FastCaptureSearchResult to