rewrite-config-servlet 2.0.0.Beta3

org.ocpsoft.rewrite.servlet.config
Class EncodeQuery

java.lang.Object
  extended by org.ocpsoft.rewrite.servlet.config.EncodeQuery
All Implemented Interfaces:
Operation

public class EncodeQuery
extends Object
implements Operation

An Operation that encodes any or many Address query-parameters into a single parameter using the given ChecksumStrategy and EncodingStrategy. This can be used to effectively encrypt or obfuscate inbound and outbound query-parameters. Additionally, encoded parameters contain a checksum which can be used to reveal tampering, allowing for appropriate action to be taken on checksum verification failure.

For example:
?c=LTg1NDM0OTA1OSM&lang=en_US

The above query string contains multiple parameters. The value of parameter 'c' has been encoded using to(String) and has specified that lang be excluded via excluding(String...).

Author:
Lincoln Baxter, III

Method Summary
 EncodeQuery excluding(String... params)
          Exclude the given query-parameter names from encoding.
 EncodeQuery onChecksumFailure(Operation operation)
          Operation to be performed when the current ChecksumStrategy detects an inbound checksum failure.
static EncodeQuery params(String... params)
          Create a new EncodeQuery operation for the given query-parameter names.
 void perform(Rewrite event, EvaluationContext context)
           
 EncodeQuery to(String param)
          The name of the composite query-parameter to hold the encoded parameters.
 String toString()
           
 EncodeQuery withChecksumStrategy(ChecksumStrategy strategy)
          Use the given ChecksumStrategy when verifying and embedding checksums.
 EncodeQuery withEncodingStrategy(EncodingStrategy strategy)
          Use the given EncodingStrategy when performing encoding.
 EncodeQuery withInboundCorrection(boolean enable)
          Redirect inbound requests to an Address containing matching query-parameters to the encoded Address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

params

public static EncodeQuery params(String... params)
Create a new EncodeQuery operation for the given query-parameter names. Only encode those given parameters. If no parameter names are supplied, this will encode all query-parameters found in the Address .


excluding

public EncodeQuery excluding(String... params)
Exclude the given query-parameter names from encoding.


withEncodingStrategy

public EncodeQuery withEncodingStrategy(EncodingStrategy strategy)
Use the given EncodingStrategy when performing encoding.


withChecksumStrategy

public EncodeQuery withChecksumStrategy(ChecksumStrategy strategy)
Use the given ChecksumStrategy when verifying and embedding checksums.


withInboundCorrection

public EncodeQuery withInboundCorrection(boolean enable)
Redirect inbound requests to an Address containing matching query-parameters to the encoded Address.


onChecksumFailure

public EncodeQuery onChecksumFailure(Operation operation)
Operation to be performed when the current ChecksumStrategy detects an inbound checksum failure.


to

public EncodeQuery to(String param)
The name of the composite query-parameter to hold the encoded parameters.


perform

public void perform(Rewrite event,
                    EvaluationContext context)
Specified by:
perform in interface Operation

toString

public String toString()
Overrides:
toString in class Object

rewrite-config-servlet 2.0.0.Beta3

Copyright © 2013 OCPsoft. All Rights Reserved.