Main Page

From JEE Parameter Enc. Serv. Fil. (inactive) Wiki
Jump to: navigation, search

Contents

Overview

The JEE-Parameter-Encoding-Filter provides the exclusiv setting of character encoding for a Sevlets HTTP-Request. It's done by a magic Get-Parameter inside the URL of the corresponding Request.

Changlog

  • v1.1.0 - Extention of the JEE-Parameter-Encoding-Filter for special Liferay needs, specially the protecting of the character encoding against later changes (dafault:disables).
  • v1.0.0 - First release of JEE-Parameter-Encoding-Filter with configurable activation state (default:disables) and parameter name (default:_charset_).

Configuration

Configuration is done by the tarent-config project.

The following configuration key-value-pairs are supported:

Key Default Value First Supported Version Description
parameter-encoding-filter.enabled false 1.0.0 Feature-Flag for activation / deactivation filter's request processing without changing components web.xml
parameter-encoding-filter.parameter_name _charset_ 1.0.0 Name of the magic parameter for character encoding
parameter-encoding-filter.wrapping.enabled false 1.1.0 Feature-Flag for request wrapping and protecting against encoding changes

Integration Example

The following steps guides you through the integration of the JEE-Parameter-Encoding-Filter.

Step 1 - Download Jar-File

Use the Maven_Entries or download the last stable version from: http://maven-repo.evolvis.org/releases/org/evolvis/java/web/parameter-encoding-filter/ and integrate it into your project.

Step 2 - Project Integration

Integrate the parameter-encoding-filter.jar file into your component's build- and packing-process and add the following two entries into your component's web.xml:

 <filter>
   <filter-name>Parameter Encoding Filter</filter-name>
   <filter-class>org.evolvis.java.web.ParameterEncodingFilter</filter-class>
 </filter>
 <filter-mapping>
   <filter-name>Parameter Encoding Filter</filter-name>
   <url-pattern>/*</url-pattern>
 </filter-mapping>

Step 3 - Filter Configuration

Use your prefered tarent-config provider and setup the following key-value pairs:

# enabled filter's request processing
parameter-encoding-filter.enabled=true

# enable filter's request wrapping and protecting against encoding changes
parameter-encoding-filter.wrapping.enabled=true

# uncomment and change the default magic parameter name
#parameter-encoding-filter.parameter_name=_charset_

Step 4 - Redeployment

The last step is building + packaging of your component and redeploy (don't forget to change your tarent-config) ... now, if all gone right, you should be able to change the request encoding by using the magic parameter e.g.:

http://your.domain/path/to/page?_charset_=iso-8859-1

Maven Entries

Required repository:

 <repository>
   <id>evolvis-release-repository</id>
   <url>http://maven-repo.evolvis.org/releases/</url>
   <layout>default</layout>
 </repository>

Required artefact:

 <dependency>
   <groupId>org.evolvis.java.web</groupId>
   <artifactId>parameter-encoding-filter</artifactId>
   <version>1.1.0</version>
 </dependency>