/*
 * Copyright 2015 yihtserns.
 *
 * 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.apache.camel.spring;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.apache.camel.model.ToDefinition;

/**
 *
 * @author yihtserns
 */
@XmlTransient
public class HttpDefinition {

    @XmlRootElement(name = ToHttpDefinition.LOCAL_NAME, namespace = NamespaceUri.PRODUCERS)
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(namespace = NamespaceUri.PRODUCERS)
    public static class ToHttpDefinition extends ToDefinition {

        private static final String LOCAL_NAME = "http";

        @XmlAttribute(required = true)
        protected String url;
        @XmlAttribute
        protected Boolean disableStreamCache;

        @Override
        public String getUri() {
            StringBuilder sb = new StringBuilder(getProtocol()).append("://");
            sb.append(url);

            return sb.toString();
        }

        protected String getProtocol() {
            return LOCAL_NAME;
        }

        @Override
        public void setRef(String ref) {
            throw new UnsupportedOperationException("'ref' is read-only property");
        }

        @Override
        public void setUri(String uri) {
            throw new UnsupportedOperationException("'uri' is read-only property");
        }

    }

    @XmlRootElement(name = ToHttpsDefinition.LOCAL_NAME, namespace = NamespaceUri.PRODUCERS)
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(namespace = NamespaceUri.PRODUCERS)
    public static final class ToHttpsDefinition extends ToHttpDefinition {

        private static final String LOCAL_NAME = "https";

        @Override
        protected String getProtocol() {
            return LOCAL_NAME;
        }

    }
}

@@ -1263,16 +1263,22 @@
  static 
+final 
 class To
@@ -1374,24 +1374,276 @@
  %22http%22;%0D%0A%0D%0A
+        /**%0D%0A         * E.g.%0D%0A         * %3Cul%3E%0D%0A         * %3Cli%3Ehttp://example.org%3C/li%3E%0D%0A         * %3Cli%3Ehttps://example.org%3C/li%3E%0D%0A         * %3Cli%3Ehttp://example.org:80%3C/li%3E%0D%0A         * %3Cli%3Ehttps://example.org:443/path%3C/li%3E%0D%0A         * %3C/ul%3E%0D%0A         */%0D%0A
         @Xml
@@ -1672,39 +1672,37 @@
 rue)%0D%0A        pr
-otected
+ivate
  String url;%0D%0A  
@@ -1732,23 +1732,21 @@
       pr
-otec
+iva
 te
-d
  Boolean
@@ -1875,158 +1875,155 @@
 der(
-getProtocol()).append(%22://%22);%0D%0A            sb.append(url);%0D%0A%0D%0A            return sb.toString();%0D%0A        %7D%0D%0A%0D%0A        protected String getProtocol() %7B
+url);%0D%0A            if (disableStreamCache != null) %7B%0D%0A                sb.append(%22disableStreamCache=%22).append(disableStreamCache);%0D%0A            %7D%0D%0A
 %0D%0A  
@@ -2035,34 +2035,37 @@
      return 
-LOCAL_NAME
+sb.toString()
 ;%0D%0A        %7D
@@ -2390,449 +2390,8 @@
 %0D%0A%0D%0A
-    %7D%0D%0A%0D%0A    @XmlRootElement(name = ToHttpsDefinition.LOCAL_NAME, namespace = NamespaceUri.PRODUCERS)%0D%0A    @XmlAccessorType(XmlAccessType.FIELD)%0D%0A    @XmlType(namespace = NamespaceUri.PRODUCERS)%0D%0A    public static final class ToHttpsDefinition extends ToHttpDefinition %7B%0D%0A%0D%0A        private static final String LOCAL_NAME = %22https%22;%0D%0A%0D%0A        @Override%0D%0A        protected String getProtocol() %7B%0D%0A            return LOCAL_NAME;%0D%0A        %7D%0D%0A%0D%0A
     

Remove ToHttpsDefinition.