} else {
//check weather request come to webapps
if (CONTEXT_WEBAPPS.equals(urlContext)) {
//if tenant is active we will throttle other parameters such as bandwidth in/out
try {
TenantThrottlingInfo throttlingInfo =
throttlingAgent.getThrottlingInfoCache().
getTenantThrottlingInfo(tenantId);
if (throttlingInfo != null) {
String[] actions =
new String[]{StratosConstants.THROTTLING_WEBAPP_IN_BANDWIDTH_ACTION,
StratosConstants.THROTTLING_WEBAPP_OUT_BANDWIDTH_ACTION};
ThrottlingActionInfo actionInfo;
actionInfo = throttlingInfo.getThrottlingActionInfo(actions);
if (actionInfo != null && actionInfo.isBlocked()) {
String blockedMsg = actionInfo.getMessage();
String msg = "This action is blocked. Reason: "
+ blockedMsg;
log.error(msg);
response.sendError(509, msg);
}
}
} catch (Exception ex) {
String msg = "Error in sending throttling rule violation message." +
" Tenant Domain: " + tenantDomainName;
log.error(msg, ex);
return;
}
} else if (CONTEXT_SERVICES.equals(urlContext)) {
try {
TenantThrottlingInfo throttlingInfo =
throttlingAgent.getThrottlingInfoCache().
getTenantThrottlingInfo(tenantId);
if (throttlingInfo != null) {
String[] actions =
new String[]{StratosConstants.THROTTLING_SERVICE_IN_BANDWIDTH_ACTION,
StratosConstants.THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION};
ThrottlingActionInfo actionInfo;
actionInfo = throttlingInfo.getThrottlingActionInfo(actions);
if (actionInfo != null && actionInfo.isBlocked()) {
String blockedMsg = actionInfo.getMessage();
String msg = "This action is blocked. Reason: " +
blockedMsg;
log.error(msg);