Skip to content

Commit

Permalink
Improve Intercepting Filter Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
iluwatar committed Oct 3, 2015
1 parent c27291f commit b4118bb
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
package com.iluwatar.intercepting.filter;

/**
*
* This is an app that checks whether the order request is valid through pre-processing done via {@link Filter}.
* Each field has its own corresponding {@link Filter}
*
* When a request enters a Web application, it often must pass several entrance
* tests prior to the main processing stage. For example,
* - Has the client been authenticated?
* - Does the client have a valid session?
* - Is the client's IP address from a trusted network?
* - Does the request path violate any constraints?
* - What encoding does the client use to send the data?
* - Do we support the browser type of the client?
* Some of these checks are tests, resulting in a yes or no answer that determines
* whether processing will continue. Other checks manipulate the incoming data
* stream into a form suitable for processing.
* <p>
* The classic solution consists of a series of conditional checks, with any failed
* check aborting the request. Nested if/else statements are a standard strategy,
* but this solution leads to code fragility and a copy-and-paste style of programming,
* because the flow of the filtering and the action of the filters is compiled into
* the application.
* <p>
* The key to solving this problem in a flexible and unobtrusive manner is to have a
* simple mechanism for adding and removing processing components, in which each
* component completes a specific filtering action. This is the Intercepting Filter
* pattern in action.
* <p>
* In this example we check whether the order request is valid through pre-processing
* done via {@link Filter}. Each field has its own corresponding {@link Filter}
* <p>
* @author joshzambales
*
*/
Expand Down

0 comments on commit b4118bb

Please sign in to comment.