Package com.exedio.cops
Class Cop
- java.lang.Object
-
- com.exedio.cops.Cop
-
public abstract class Cop extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addParameter(String key, boolean value)
void
addParameter(String key, int value, int defaultValue)
void
addParameter(String key, long value, long defaultValue)
void
addParameter(String key, Cop value)
<E extends Enum<E>>
voidaddParameter(String key, E value, E defaultValue)
void
addParameter(String key, String value)
Does nothing, ifvalue==null
.void
addParameterCompact(String key, long value, long defaultValue)
static String[]
authorizeBasic(HttpServletRequest request)
Deprecated.static String
encode(String st)
Deprecated.UseXMLEncoder.encode(String)
insteadstatic String
encodeNaturalLanguageSegment(String s)
static String
encodeXml(String st)
Deprecated.UseXMLEncoder.encode(String)
insteadString
getAbsoluteURL(String token)
String
getAbsoluteURL(HttpServletRequest request)
static boolean
getBooleanParameter(HttpServletRequest request, String name)
static HttpServletRequest
getCopParameter(HttpServletRequest request, String name)
static <E extends Enum<E>>
EgetEnumParameter(HttpServletRequest request, String name, E defaultValue)
static int
getIntParameter(HttpServletRequest request, String name, int defaultValue)
static long
getLongParameter(HttpServletRequest request, String name, long defaultValue)
static long
getLongParameterCompact(HttpServletRequest request, String name, long defaultValue)
String
getSecureURL(HttpServletRequest request)
static String
getToken(HttpServletRequest request)
String
getURL(HttpServletRequest request)
static boolean
isPost(HttpServletRequest request)
protected boolean
needsSecure()
Specifies, whether this cop should use http or https.boolean
redirectToCanonical(HttpServletRequest request, HttpServletResponse response)
static void
rejectAuthorizeBasic(HttpServletResponse response, String realm)
Deprecated.String
toString()
-
-
-
Constructor Detail
-
Cop
protected Cop(String pathInfo)
-
-
Method Detail
-
addParameter
public final void addParameter(String key, boolean value)
-
addParameter
public final void addParameter(String key, int value, int defaultValue)
-
addParameter
public final void addParameter(String key, long value, long defaultValue)
-
addParameter
public final <E extends Enum<E>> void addParameter(String key, E value, E defaultValue)
-
getEnumParameter
public static <E extends Enum<E>> E getEnumParameter(HttpServletRequest request, String name, E defaultValue)
-
addParameterCompact
public final void addParameterCompact(String key, long value, long defaultValue)
-
addParameter
public final void addParameter(String key, String value)
Does nothing, ifvalue==null
.
-
needsSecure
protected boolean needsSecure()
Specifies, whether this cop should use http or https. Return true to use https. Return false to use any of these, which uses the previously used protocol. This default implementation returns null.
-
getAbsoluteURL
public final String getAbsoluteURL(HttpServletRequest request)
-
getToken
public static String getToken(HttpServletRequest request)
- See Also:
getAbsoluteURL(String)
-
getAbsoluteURL
public final String getAbsoluteURL(String token)
- See Also:
getToken(HttpServletRequest)
-
getURL
public final String getURL(HttpServletRequest request)
-
getSecureURL
public final String getSecureURL(HttpServletRequest request)
-
redirectToCanonical
public final boolean redirectToCanonical(HttpServletRequest request, HttpServletResponse response)
-
isPost
public static final boolean isPost(HttpServletRequest request)
-
getBooleanParameter
public static final boolean getBooleanParameter(HttpServletRequest request, String name)
-
getIntParameter
public static final int getIntParameter(HttpServletRequest request, String name, int defaultValue)
-
getLongParameter
public static final long getLongParameter(HttpServletRequest request, String name, long defaultValue)
-
getLongParameterCompact
public static final long getLongParameterCompact(HttpServletRequest request, String name, long defaultValue)
-
getCopParameter
public static final HttpServletRequest getCopParameter(HttpServletRequest request, String name)
-
encode
@Deprecated public static final String encode(String st)
Deprecated.UseXMLEncoder.encode(String)
instead
-
encodeXml
@Deprecated public static final String encodeXml(String st)
Deprecated.UseXMLEncoder.encode(String)
instead
-
authorizeBasic
@Deprecated public static final String[] authorizeBasic(HttpServletRequest request)
Deprecated.
-
rejectAuthorizeBasic
@Deprecated public static final void rejectAuthorizeBasic(HttpServletResponse response, String realm)
Deprecated.
-
-