@Test(expected=InvalidPreferenceHeaderException.class) public void testFromPreferenceHeader$invalidValues$repeated_include_hints() throws Exception { ContentPreferencesUtils.fromPreferenceHeader("return=representation; include=\"http: }
public static ContentPreferences fromPreferenceHeader(String header) { checkNotNull("Preference header cannot be null"); String[] preferenceParts = header.split(";"); validatePrefix(header, preferenceParts[0]); ContentPreferencesBuilder builder = ContentPreferences.builder(); if(preferenceParts.length==1) { throw new InvalidPreferenceHeaderException("Could not parse preference ("+header+"): invalid return representation preference configuration"); } populatePreferences(builder,Arrays.copyOfRange(preferenceParts,1,preferenceParts.length,String[].class)); return builder.build(); }
ContentPreferencesUtils { public static ContentPreferences fromPreferenceHeader(String header) { checkNotNull("Preference header cannot be null"); String[] preferenceParts = header.split(";"); validatePrefix(header, preferenceParts[0]); ContentPreferencesBuilder builder = ContentPreferences.builder(); if(preferenceParts.length==1) { throw new InvalidPreferenceHeaderException("Could not parse preference ("+header+"): invalid return representation preference configuration"); } populatePreferences(builder,Arrays.copyOfRange(preferenceParts,1,preferenceParts.length,String[].class)); return builder.build(); } }
ContentPreferencesUtils { public static ContentPreferences fromPreferenceHeader(String header) { checkNotNull("Preference header cannot be null"); String[] preferenceParts = header.split(";"); validatePrefix(header, preferenceParts[0]); ContentPreferencesBuilder builder = ContentPreferences.builder(); if(preferenceParts.length==1) { throw new InvalidPreferenceHeaderException("Could not parse preference ("+header+"): invalid return representation preference configuration"); } populatePreferences(builder,Arrays.copyOfRange(preferenceParts,1,preferenceParts.length,String[].class)); return builder.build(); } private  ContentPreferencesUtils(); }
ContentPreferencesUtils { public static ContentPreferences fromPreferenceHeader(String header) { checkNotNull("Preference header cannot be null"); String[] preferenceParts = header.split(";"); validatePrefix(header, preferenceParts[0]); ContentPreferencesBuilder builder = ContentPreferences.builder(); if(preferenceParts.length==1) { throw new InvalidPreferenceHeaderException("Could not parse preference ("+header+"): invalid return representation preference configuration"); } populatePreferences(builder,Arrays.copyOfRange(preferenceParts,1,preferenceParts.length,String[].class)); return builder.build(); } private  ContentPreferencesUtils(); static ContentPreferences fromPreferenceHeader(String header); static String asPreferenceHeader(ContentPreferences contentPreferences); static String asPreferenceAppliedHeader(ContentPreferences contentPreferences); }
ContentPreferencesUtils { public static ContentPreferences fromPreferenceHeader(String header) { checkNotNull("Preference header cannot be null"); String[] preferenceParts = header.split(";"); validatePrefix(header, preferenceParts[0]); ContentPreferencesBuilder builder = ContentPreferences.builder(); if(preferenceParts.length==1) { throw new InvalidPreferenceHeaderException("Could not parse preference ("+header+"): invalid return representation preference configuration"); } populatePreferences(builder,Arrays.copyOfRange(preferenceParts,1,preferenceParts.length,String[].class)); return builder.build(); } private  ContentPreferencesUtils(); static ContentPreferences fromPreferenceHeader(String header); static String asPreferenceHeader(ContentPreferences contentPreferences); static String asPreferenceAppliedHeader(ContentPreferences contentPreferences); static final String PREFERENCE_APPLIED_HEADER; static final String PREFER_HEADER; }