<commit_before>/*
 *  Copyright (c) 2013, 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.
 */
package org.wso2.carbon.endpoint.ui.endpoints.http;

import org.apache.axiom.om.OMElement;
import org.apache.synapse.config.xml.endpoints.DefinitionFactory;
import org.apache.synapse.config.xml.endpoints.EndpointFactory;
import org.apache.synapse.endpoints.Template;
import org.apache.synapse.util.streaming_xpath.compiler.XPath1Parser.orExpr_return;
import org.wso2.carbon.endpoint.ui.endpoints.Endpoint;
import org.wso2.carbon.endpoint.ui.util.EndpointConfigurationHelper;

import com.damnhandy.uri.template.UriTemplate;


import java.util.Properties;

public class HttpEndpoint extends Endpoint {
	
	private String uriTemplate; 
    private String method;
    
	private boolean httpGet = false;
	private boolean httpPost = false;
	private boolean httpPush = false; 
	private boolean httpPut = false; 
	private boolean httpDelete = false;
	private boolean httpHead = false; 
	
	/*
	 * private boolean httpTrace = false; 
	 * private boolean httpConnect = false; 
	 */
	
    private String endpointName;

    private String suspendDurationOnFailure;
    private String maxSusDuration;
    private String susProgFactor;
    private String errorCodes;

    private String timedOutErrorCodes;
    private String retryDisabledErrorCodes;
    private String retryTimeout;
    private String retryDelay;
    private String timeoutAction;
    private String timeoutActionDuration;
    
    private String description = "";
    private String properties;

    public String getUriTemplate() {
    	return uriTemplate; 
    }
    
    public void setUriTemplate(String template) {
    	this.uriTemplate = template.replaceAll("&amp;","&"); 
    }
    
    public void setHttpGet(boolean get) {
    	this.httpGet = get;
    }
    
    public void setHttpPost(boolean post) {
    	this.httpPost = post;
    }    
    
    public void setHttpPush(boolean push) {
    	this.httpPush = push;
    }
    
    public void setHttpPut(boolean put) {
    	this.httpPut = put;
    }    
    
    public void setHttpDelete(boolean delete) {
    	this.httpDelete = delete;
    }
    
    public void setHttpHead(boolean head) {
    	this.httpHead = head;
    }
    
    public String getTagLocalName() {
        return "http";
    }
        
    public boolean isHttpGet() {
    	return httpGet;
    }
    
    public boolean isHttpPost() {
    	return httpPost; 
    }
    
    public boolean isHttpPush() {
    	return httpPush;
    }
    
    public boolean isHttpPut() {
    	return httpPut; 
    }
        
    public boolean isHttpDelete() {
    	return httpDelete; 
    }
    
    public boolean isHttpHead() {
    	return httpHead; 
    }
    

    public String getEndpointName() {
        return endpointName;
    }

    public void setEndpointName(String name) {
        this.endpointName = name;
    }

    public String getSuspendDurationOnFailure() {
        return suspendDurationOnFailure;
    }

    public void setSuspendDurationOnFailure(String suspendDurationOnFailure) {
        this.suspendDurationOnFailure = suspendDurationOnFailure;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
        
        if ("get".equals(method)) {
        	setHttpGet(true);
        } else if ("post".equals(method)) {
        	setHttpPost(true);
        } else if ("push".equals(method)) {
        	setHttpPush(true);
        } else if ("put".equals(method)) {
        	setHttpPut(true);
        } else if ("delete".equals(method)) {
        	setHttpDelete(true);
        } else if ("head".equals(method)) {
        	setHttpHead(true);
        } else {
        	setHttpGet(false);<commit_msg>applying patch by shafreen to fix ESBJAVA-3027<commit_after>/*
 *  Copyright (c) 2013, 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.
 */
package org.wso2.carbon.endpoint.ui.endpoints.http;

import org.apache.axiom.om.OMElement;
import org.apache.synapse.config.xml.endpoints.DefinitionFactory;
import org.apache.synapse.config.xml.endpoints.EndpointFactory;
import org.apache.synapse.endpoints.Template;
import org.wso2.carbon.endpoint.ui.endpoints.Endpoint;
import org.wso2.carbon.endpoint.ui.util.EndpointConfigurationHelper;

import java.util.Properties;

public class HttpEndpoint extends Endpoint {
	
	private String uriTemplate; 
    private String method;
    
	private boolean httpGet = false;
	private boolean httpPost = false;
	private boolean httpPush = false; 
	private boolean httpPut = false; 
	private boolean httpDelete = false;
	private boolean httpHead = false; 
	
	/*
	 * private boolean httpTrace = false; 
	 * private boolean httpConnect = false; 
	 */
	
    private String endpointName;

    private String suspendDurationOnFailure;
    private String maxSusDuration;
    private String susProgFactor;
    private String errorCodes;

    private String timedOutErrorCodes;
    private String retryDisabledErrorCodes;
    private String retryTimeout;
    private String retryDelay;
    private String timeoutAction;
    private String timeoutActionDuration;
    
    private String description = "";
    private String properties;

    public String getUriTemplate() {
    	return uriTemplate; 
    }
    
    public void setUriTemplate(String template) {
    	this.uriTemplate = template.replaceAll("&amp;","&"); 
    }
    
    public void setHttpGet(boolean get) {
    	this.httpGet = get;
    }
    
    public void setHttpPost(boolean post) {
    	this.httpPost = post;
    }    
    
    public void setHttpPush(boolean push) {
    	this.httpPush = push;
    }
    
    public void setHttpPut(boolean put) {
    	this.httpPut = put;
    }    
    
    public void setHttpDelete(boolean delete) {
    	this.httpDelete = delete;
    }
    
    public void setHttpHead(boolean head) {
    	this.httpHead = head;
    }
    
    public String getTagLocalName() {
        return "http";
    }
        
    public boolean isHttpGet() {
    	return httpGet;
    }
    
    public boolean isHttpPost() {
    	return httpPost; 
    }
    
    public boolean isHttpPush() {
    	return httpPush;
    }
    
    public boolean isHttpPut() {
    	return httpPut; 
    }
        
    public boolean isHttpDelete() {
    	return httpDelete; 
    }
    
    public boolean isHttpHead() {
    	return httpHead; 
    }
    

    public String getEndpointName() {
        return endpointName;
    }

    public void setEndpointName(String name) {
        this.endpointName = name;
    }

    public String getSuspendDurationOnFailure() {
        return suspendDurationOnFailure;
    }

    public void setSuspendDurationOnFailure(String suspendDurationOnFailure) {
        this.suspendDurationOnFailure = suspendDurationOnFailure;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
        
        if ("get".equalsIgnoreCase(method)) {
        	setHttpGet(true);
        } else if ("post".equalsIgnoreCase(method)) {
        	setHttpPost(true);
        } else if ("push".equalsIgnoreCase(method)) {
        	setHttpPush(true);
        } else if ("put".equalsIgnoreCase(method)) {
        	setHttpPut(true);
        } else if ("delete".equalsIgnoreCase(method)) {
        	setHttpDelete(true);
        } else if ("head".equalsIgnoreCase(method)) {
        	setHttpHead(true);
        } else {
        	setHttpGet(false);
{'fraction_non_alphanumeric': 0.08458864426419467, 'fraction_numerical': 0.0035921205098493627, 'mean_word_length': 2.7250755287009065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6278685', 'n_tokens_mistral': 2492, 'n_tokens_neox': 2424, 'n_words': 661}