Top Description Fields Constructors Methods
org.apache.catalina.valves.rewrite

public Class RandomizedTextRewriteMap

extends Object
implements RewriteMap
Class Inheritance
All Implemented Interfaces
org.apache.catalina.valves.rewrite.RewriteMap
Imports
java.io.BufferedReader, .IOException, .InputStreamReader, java.util.HashMap, .Map, .Random, org.apache.tomcat.util.file.ConfigFileLoader, .ConfigurationSource.Resource, org.apache.tomcat.util.res.StringManager

Implement a map for the txt: and rnd: mod_rewrite capabilities.

Field Summary

Modifier and TypeField and Description
private final Map<String, String[]>
private static final Random
protected static final StringManager

Constructor Summary

AccessConstructor and Description
public
RandomizedTextRewriteMap(String
the text file path
txtFilePath
,
boolean
if the map should produce random results
useRandom
)

Create a map from a text file according to the mod_rewrite syntax.

Method Summary

Modifier and TypeMethod and Description
public String
lookup(String
used by the actual implementation to generate a mapped value
key
)

Implements org.apache.catalina.valves.rewrite.RewriteMap.lookup.

Maps a key to a replacement value.

public String
setParameters(String
the optional parameter
params
)

Implements org.apache.catalina.valves.rewrite.RewriteMap.setParameters.

Optional parameter that can be defined through the RewriteMap directive in the rewrite.config file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private final Map<String, String[]> map
randomback to summary
private static final Random random
smback to summary
protected static final StringManager sm

Constructor Detail

RandomizedTextRewriteMapback to summary
public RandomizedTextRewriteMap(String txtFilePath, boolean useRandom)

Create a map from a text file according to the mod_rewrite syntax.

Parameters
txtFilePath:String

the text file path

useRandom:boolean

if the map should produce random results

Method Detail

lookupback to summary
public String lookup(String key)

Implements org.apache.catalina.valves.rewrite.RewriteMap.lookup.

Doc from org.apache.catalina.valves.rewrite.RewriteMap.lookup.

Maps a key to a replacement value.
The method is free to return null to indicate, that the default value from the RewriteRule directive should be used.

Parameters
key:String

used by the actual implementation to generate a mapped value

Returns:String

mapped value or null

Annotations
@Override
setParametersback to summary
public String setParameters(String params)

Implements org.apache.catalina.valves.rewrite.RewriteMap.setParameters.

Doc from org.apache.catalina.valves.rewrite.RewriteMap.setParameters.

Optional parameter that can be defined through the RewriteMap directive in the rewrite.config file.

Parameters
params:String

the optional parameter

Returns:String

value is currently ignored

Annotations
@Override