|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ServletRequestFilter.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* Joey and its relative products are published under the terms
|
|
| 3 |
* of the Apache Software License.
|
|
| 4 |
*/
|
|
| 5 |
package org.asyrinx.brownie.servlet;
|
|
| 6 |
|
|
| 7 |
import javax.servlet.http.HttpServletRequest;
|
|
| 8 |
|
|
| 9 |
import org.asyrinx.brownie.core.lang.StringUtils;
|
|
| 10 |
|
|
| 11 |
/**
|
|
| 12 |
* @author Akima
|
|
| 13 |
*/
|
|
| 14 |
public final class ServletRequestFilter { |
|
| 15 |
|
|
| 16 |
/**
|
|
| 17 |
*
|
|
| 18 |
*/
|
|
| 19 | 0 |
private ServletRequestFilter() {
|
| 20 | 0 |
super();
|
| 21 |
} |
|
| 22 |
|
|
| 23 |
/** パラメータをnullTrimするフィルタ */
|
|
| 24 | 0 |
public static HttpServletRequest nullTrim(HttpServletRequest req) { |
| 25 | 0 |
return new HttpServletRequestNullTrimFilter(req); |
| 26 |
} |
|
| 27 |
|
|
| 28 |
/** パラメータをtrimするフィルタ */
|
|
| 29 | 0 |
public static HttpServletRequest stringTrim(HttpServletRequest req) { |
| 30 | 0 |
return new HttpServletRequestStringTrimFilter(req); |
| 31 |
} |
|
| 32 |
|
|
| 33 |
/** パラメータをtrim と nullTrimするフィルタ */
|
|
| 34 | 0 |
public static HttpServletRequest trim(HttpServletRequest req) { |
| 35 | 0 |
return nullTrim(stringTrim(req));
|
| 36 |
} |
|
| 37 |
|
|
| 38 |
} |
|
| 39 |
/**
|
|
| 40 |
* <b>summary </b> <br>
|
|
| 41 |
* <br>
|
|
| 42 |
* パラメータをtrimするフィルタ <br>
|
|
| 43 |
* <b>detail </b> <br>
|
|
| 44 |
* <br>
|
|
| 45 |
*
|
|
| 46 |
* @author Akima Created on 2003/05/22
|
|
| 47 |
*/
|
|
| 48 |
|
|
| 49 |
class HttpServletRequestStringTrimFilter extends HttpServletRequestWrapper { |
|
| 50 | 0 |
public HttpServletRequestStringTrimFilter(HttpServletRequest impl) {
|
| 51 | 0 |
super(impl);
|
| 52 |
} |
|
| 53 |
|
|
| 54 | 0 |
public String getParameter(String name) {
|
| 55 | 0 |
final String result = super.getParameter(name);
|
| 56 | 0 |
if (result == null) |
| 57 | 0 |
return null; |
| 58 |
else
|
|
| 59 | 0 |
return result.trim();
|
| 60 |
} |
|
| 61 |
} |
|
| 62 |
/**
|
|
| 63 |
* <b>summary </b> <br>
|
|
| 64 |
* <br>
|
|
| 65 |
* パラメータをnullTrimするフィルタ <br>
|
|
| 66 |
* <b>detail </b> <br>
|
|
| 67 |
* <br>
|
|
| 68 |
*
|
|
| 69 |
* @author Akima Created on 2003/05/22
|
|
| 70 |
*/
|
|
| 71 |
|
|
| 72 |
class HttpServletRequestNullTrimFilter extends HttpServletRequestWrapper { |
|
| 73 | 0 |
public HttpServletRequestNullTrimFilter(HttpServletRequest impl) {
|
| 74 | 0 |
super(impl);
|
| 75 |
} |
|
| 76 |
|
|
| 77 | 0 |
public String getParameter(String name) {
|
| 78 | 0 |
return StringUtils.nullTrim(super.getParameter(name)); |
| 79 |
} |
|
| 80 |
} |
|
||||||||||