All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web.throttle-mediator.edit-mediator.jsp Maven / Gradle / Ivy

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%--
  ~  Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~  Licensed under the Apache License, Version 2.0 (the "License");
  ~  you may not use this file except in compliance with the License.
  ~  You may obtain a copy of the License at
  ~
  ~        http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing, software
  ~  distributed under the License is distributed on an "AS IS" BASIS,
  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~  See the License for the specific language governing permissions and
  ~  limitations under the License.
  --%>

<%@ page import="org.wso2.carbon.mediator.service.ui.Mediator" %>
<%@ page import="org.wso2.carbon.mediator.throttle.OnAcceptMediator" %>
<%@ page import="org.wso2.carbon.mediator.throttle.OnRejectMediator" %>
<%@ page import="org.wso2.carbon.mediator.throttle.ThrottleMediator" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.SequenceEditorHelper" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>





<%
    String throttleGroup = "";
    boolean inLine = false;
    boolean acceptInline = false;
    boolean rejectInline = false;
    String inLinePolicy = "", acceptKey = "", rejectKey = "";
    String key = "";
    String policyID = SequenceEditorHelper.getEditingMediatorPosition(session) + "_throttle_policy";
    Mediator mediator = SequenceEditorHelper.getEditingMediator(request, session);
    if (!(mediator instanceof ThrottleMediator)) {
        // todo : proper error handling
        throw new RuntimeException("Unable to edit the mediator");
    }
    ThrottleMediator throttleMediator = (ThrottleMediator) mediator;
    if (throttleMediator.getId() != null) {
        throttleGroup = throttleMediator.getId();
    }
    if (throttleMediator.getInLinePolicy() != null) {
        inLine = true;
        inLinePolicy = throttleMediator.getInLinePolicy().toString();
        Map policyXMLMap = (Map) request.getSession().getAttribute("throttle_policy_map");
        if (policyXMLMap == null) {
            policyXMLMap = new HashMap();
        }
        policyXMLMap.put(policyID, inLinePolicy);
        request.getSession().setAttribute("throttle_policy_map", policyXMLMap);
    } else if (throttleMediator.getPolicyKey() != null) {
        key = throttleMediator.getPolicyKey();
    }

    for (Mediator m : throttleMediator.getList()) {
        if (m instanceof OnAcceptMediator) {
            acceptInline = true;
        } else if (m instanceof OnRejectMediator) {
            rejectInline = true;
        }
    }

    if (!acceptInline && throttleMediator.getOnAcceptSeqKey() != null) {
        acceptKey = throttleMediator.getOnAcceptSeqKey();
    }
    if (!rejectInline && throttleMediator.getOnRejectSeqKey() != null) {
        rejectKey = throttleMediator.getOnRejectSeqKey();
    }
%>

*
"> "> "> ">

<% if (inLine) {%> <%} else {%> <%}%>

<% if (acceptInline) {%> <% } else {%> <%}%>

<% if (rejectInline) {%> <% } else {%> <%}%>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy