/*
 * Copyright 2017 Benik Arakelyan
 *
 * 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 com.jsunsoft.http;

import org.apache.http.HttpEntity;

import java.nio.charset.Charset;

public class ContentType {
    private final String mimeType;
    private final Charset charset;

    private ContentType(String mimeType, Charset charset) {
        this.mimeType = mimeType;
        this.charset = charset;
    }

    public String getMimeType() {
        return mimeType;
    }

    public Charset getCharset() {
        return charset;
    }

    public static ContentType create(String mimeType, Charset charset) {
        return new ContentType(mimeType, charset);
    }

    public static ContentType create(String mimeType) {
        return new ContentType(mimeType, null);
    }

    static ContentType create(org.apache.http.entity.ContentType ct) {
        return new ContentType(ct.getMimeType(), ct.getCharset());
    }

    static ContentType create(HttpEntity httpEntity) {
        return create(org.apache.http.entity.ContentType.getOrDefault(httpEntity));
    }
}

@@ -621,16 +621,47 @@
 .http;%0A%0A
+import org.apache.http.Consts;%0A
 import o
@@ -687,16 +687,16 @@
 Entity;%0A
-
 %0Aimport 
@@ -749,16 +749,1395 @@
 tType %7B%0A
+    public static final ContentType APPLICATION_ATOM_XML = create(%0A            %22application/atom+xml%22, Consts.ISO_8859_1);%0A    public static final ContentType APPLICATION_FORM_URLENCODED = create(%0A            %22application/x-www-form-urlencoded%22, Consts.ISO_8859_1);%0A    public static final ContentType APPLICATION_JSON = create(%0A            %22application/json%22, Consts.UTF_8);%0A    public static final ContentType APPLICATION_OCTET_STREAM = create(%0A            %22application/octet-stream%22, (Charset) null);%0A    public static final ContentType APPLICATION_SVG_XML = create(%0A            %22application/svg+xml%22, Consts.ISO_8859_1);%0A    public static final ContentType APPLICATION_XHTML_XML = create(%0A            %22application/xhtml+xml%22, Consts.ISO_8859_1);%0A    public static final ContentType APPLICATION_XML = create(%0A            %22application/xml%22, Consts.ISO_8859_1);%0A    public static final ContentType MULTIPART_FORM_DATA = create(%0A            %22multipart/form-data%22, Consts.ISO_8859_1);%0A    public static final ContentType TEXT_HTML = create(%0A            %22text/html%22, Consts.ISO_8859_1);%0A    public static final ContentType TEXT_PLAIN = create(%0A            %22text/plain%22, Consts.ISO_8859_1);%0A    public static final ContentType TEXT_XML = create(%0A            %22text/xml%22, Consts.ISO_8859_1);%0A    public static final ContentType WILDCARD = create(%0A            %22*/*%22, (Charset) null);%0A%0A
     priv
@@ -2646,24 +2646,24 @@
 mimeType) %7B%0A
-
         retu
@@ -2697,32 +2697,227 @@
 , null);%0A    %7D%0A%0A
+    @Override%0A    public String toString() %7B%0A        return %22ContentType%7B%22 +%0A                %22mimeType='%22 + mimeType + '%5C'' +%0A                %22, charset=%22 + charset +%0A                '%7D';%0A    %7D%0A%0A
     static Conte

Add static content types