package uk.ac.ebi.quickgo.annotation.download.http;

import java.nio.charset.Charset;
import org.springframework.http.MediaType;

/**
 * Hold the definitions of MediaTypes used in downloads, and their components.
 * @author Tony Wardell
 * Date: 27/04/2017
 * Time: 10:38
 * Created with IntelliJ IDEA.
 */
public class MediaTypeFactory {
    private static final String TEXT_TYPE = "text";
    private static final String APPLICATION_TYPE = "application";
    private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

    public static final String TSV_SUB_TYPE = "tsv";
    public static final String GAF_SUB_TYPE = "gaf";
    public static final String GPAD_SUB_TYPE = "gpad";
    private static final String EXCEL_SUB_TYPE = "vnd.ms-excel";

    public static final String TSV_MEDIA_TYPE_STRING = TEXT_TYPE + "/" + TSV_SUB_TYPE;
    public static final String GAF_MEDIA_TYPE_STRING = TEXT_TYPE + "/" + GAF_SUB_TYPE;
    public static final String GPAD_MEDIA_TYPE_STRING = TEXT_TYPE + "/" + GPAD_SUB_TYPE;
    public static final String EXCEL_MEDIA_TYPE_STRING = APPLICATION_TYPE + "/" + EXCEL_SUB_TYPE;

    public static final MediaType TSV_MEDIA_TYPE = new MediaType(TEXT_TYPE, TSV_SUB_TYPE, DEFAULT_CHARSET);
    public static final MediaType GAF_MEDIA_TYPE = new MediaType(TEXT_TYPE, GAF_SUB_TYPE, DEFAULT_CHARSET);
    public static final MediaType GPAD_MEDIA_TYPE = new MediaType(TEXT_TYPE, GPAD_SUB_TYPE, DEFAULT_CHARSET);

    public static final MediaType EXCEL_MEDIA_TYPE = new MediaType(APPLICATION_TYPE, EXCEL_SUB_TYPE, DEFAULT_CHARSET);
}

@@ -686,38 +686,37 @@
  = %22gpad%22;%0A    p
-rivate
+ublic
  static final St
@@ -752,16 +752,71 @@
 -excel%22;
+%0A    public static final String JSON_SUB_TYPE = %22json%22;
 %0A%0A    pu
@@ -1169,16 +1169,112 @@
 UB_TYPE;
+%0A    public static final String JSON_MEDIA_TYPE_STRING = APPLICATION_TYPE + %22/%22 + JSON_SUB_TYPE;
 %0A%0A    pu
@@ -1590,24 +1590,24 @@
 _CHARSET);%0A%0A
+
     public s
@@ -1693,30 +1693,13 @@
 SUB_TYPE
-, DEFAULT_CHARSET
 );%0A%7D%0A

Add json media type string. Make excel and json subtypes public.