Methods Summary |
---|
public boolean | equals(java.lang.Object that)
boolean rvalue = false;
if (that != null && that instanceof HttpMethodSpec) {
if (that == this) {
rvalue = true;
} else {
rvalue = this.hashCode() == ((HttpMethodSpec) that).hashCode();
}
}
return rvalue;
|
java.lang.String | getActions()
if (standardMap == 0 && extensionSet == null) {
return null;
}
synchronized(this) {
if (actions != null) {
return actions;
}
if (standardSpec != null) {
actions = getExtensionActions(standardSpec.getActions(),standardMap,
extensionSet);
} else {
actions = getStandardActions(exceptionList,standardMap);
}
}
return actions;
|
private java.lang.String | getExtensionActions(java.lang.String standardActions, int map, java.util.BitSet set)
ArrayList methods = null;
for(int i=set.nextSetBit(0); i>=0; i=set.nextSetBit(i+1)) {
if (methods == null) {
methods = new ArrayList();
}
methods.add(getExtensionMethod(i));
}
String rvalue;
if (methods == null) {
rvalue = standardActions;
} else {
Collections.sort(methods);
StringBuffer actBuf = new StringBuffer
(standardActions == null ?
(exceptionList ? exclaimationPoint : emptyString) :
standardActions);
for (int i = 0; i < methods.size(); i++) {
if (i > 0 || map > 0) {
actBuf.append(comma);
}
actBuf.append(methods.get(i));
}
rvalue = actBuf.toString();
}
return rvalue;
|
private static java.lang.String | getExtensionMethod(int bitPos)
synchronized (extensionMethods) {
if (bitPos >= 0 && bitPos < extensionMethods.size()) {
return (String) extensionMethods.get(bitPos);
} else {
throw new RuntimeException
("invalid (extensionMethods) bit position: '" + bitPos +
"' size: '" + extensionMethods.size() + " '");
}
}
|
static javax.security.jacc.HttpMethodSpec | getSpec(java.lang.String actions)
HttpMethodSpec rvalue;
if (actions == null || actions.equals(emptyString)) {
rvalue = allSpec;
} else {
BitSet set = new BitSet();
rvalue = getStandardSpec(actions,set);
if (!set.isEmpty()) {
rvalue = new HttpMethodSpec(rvalue,set);
}
}
return rvalue;
|
static javax.security.jacc.HttpMethodSpec | getSpec(java.lang.String[] methods)
HttpMethodSpec rvalue;
if (methods == null || methods.length == 0) {
rvalue = allSpec;
} else {
int map = 0;
BitSet set = new BitSet();
for (int i=0; i<methods.length; i++) {
Integer bit = (Integer) methodHash.get(methods[i]);
if (bit != null) {
map |= bit.intValue();
} else {
setExtensionBit(methods[i],set);
}
}
if (set.isEmpty()) {
rvalue = specArray[map];
} else {
rvalue = new HttpMethodSpec(specArray[map],set);
}
}
return rvalue;
|
private java.lang.String | getStandardActions(boolean isExceptionList, int map)
int bitValue = 1;
StringBuffer actBuf = null;
for (int i=0; i<mapSize; i++) {
if ((map & bitValue) == bitValue) {
if (actBuf == null) {
actBuf = new StringBuffer
(isExceptionList ? exclaimationPoint : emptyString);
} else {
actBuf.append(comma);
}
actBuf.append((String) methodKeys[i]);
}
bitValue = bitValue * 2;
}
if (actBuf == null) {
return isExceptionList ? exclaimationPoint : emptyString;
} else {
return actBuf.toString();
}
|
private static javax.security.jacc.HttpMethodSpec | getStandardSpec(java.lang.String actions, java.util.BitSet set)
boolean isExceptionList = false;
if (actions.charAt(0) == exclaimationPointChar) {
isExceptionList = true;
if (actions.length() < 2) {
throw new IllegalArgumentException
("illegal HTTP method Spec actions: '" + actions + "'");
}
actions = actions.substring(1);
}
int map = makeMethodSet(actions, set);
HttpMethodSpec rvalue;
if (isExceptionList) {
rvalue = exceptionSpecArray[map];
} else {
rvalue = specArray[map];
}
return rvalue;
|
public int | hashCode()
return (this.exceptionList ? 1 : 0) + (this.standardMap << 1) +
((this.extensionSet == null ? 0 : this.extensionSet.hashCode()) << mapSize +1);
|
boolean | implies(javax.security.jacc.HttpMethodSpec that)
boolean rvalue;
// null actions implies everything
if (this.standardMap == 0 && this.extensionSet == null) {
rvalue = true;
}
// only the null actions can implie the null actions
else if (that.standardMap == 0 && that.extensionSet == null) {
rvalue = false;
}
// both are an HttpMethodExceptionList
else if (this.exceptionList && that.exceptionList) {
rvalue = (this.standardMap & that.standardMap) == this.standardMap;
if (rvalue) {
if (this.extensionSet != null) {
if (that.extensionSet == null) {
rvalue = false;
} else {
BitSet clone = (BitSet) that.extensionSet.clone();
clone.and(this.extensionSet);
rvalue = clone.equals(this.extensionSet) ? true : false;
}
}
}
}
// neither is an HttpMethodExceptionList
else if (this.exceptionList == that.exceptionList) {
rvalue = (this.standardMap & that.standardMap) == that.standardMap;
if (rvalue) {
if (that.extensionSet != null) {
if (this.extensionSet == null) {
rvalue = false;
} else {
BitSet clone = (BitSet) that.extensionSet.clone();
clone.and(this.extensionSet);
rvalue = clone.equals(that.extensionSet);
}
}
}
}
// one or the other is an HttpMethodExceptionList
else if (this.exceptionList) {
rvalue = (this.standardMap & that.standardMap) == 0;
if (rvalue) {
if (that.extensionSet != null) {
if (this.extensionSet == null) {
rvalue = true;
} else {
rvalue = this.extensionSet.intersects
(that.extensionSet) ? false : true;
}
}
}
}
// an explicit list can never imply an exception list
else {
rvalue = false;
}
return rvalue;
|
private static int | makeMethodSet(java.lang.String actions, java.util.BitSet set)
int i = 0;
int mSet = 0;
int commaPos = 0;
while (commaPos >= 0 && i < actions.length()) {
commaPos = actions.indexOf(comma,i);
if (commaPos != 0) {
String method;
if (commaPos < 0) {
method = actions.substring(i);
} else {
method = actions.substring(i,commaPos);
}
Integer bit = (Integer) methodHash.get(method);
if (bit != null) {
mSet |= bit.intValue();
} else {
setExtensionBit(method,set);
}
i = commaPos + 1;
}
else {
throw new IllegalArgumentException
("illegal HTTP method Spec actions: '" + actions + "'");
}
}
return mSet;
|
private static void | setExtensionBit(java.lang.String method, java.util.BitSet set)
int bitPos;
synchronized (extensionMethods) {
bitPos = extensionMethods.indexOf(method);
if (bitPos < 0) {
bitPos = extensionMethods.size();
// *** should ensure method is syntactically legal
extensionMethods.add(method);
}
}
set.set(bitPos);
|
public java.lang.String | toString()
return getActions();
|