public static String convertSampleAccordingToMediaType( Object content, String mediaTypeAsString, String representationName) { MetadataService ms = new MetadataService(); MediaType mediaType = MediaType.valueOf(mediaTypeAsString); if (!supportedExtensions.contains(ms.getExtension(mediaType))) { return null; } String text; try { text = new JacksonRepresentation<>(mediaType, content).getText(); } catch (IOException e) { throw new RuntimeException(e); } if (ms.getAllMediaTypes("xml").contains(mediaType)) { text = text.replaceAll("HashMap", representationName); } return text; }
public static String convertSampleAccordingToMediaType( Object content, String mediaTypeAsString, String representationName) { MetadataService ms = new MetadataService(); MediaType mediaType = MediaType.valueOf(mediaTypeAsString); if (!supportedExtensions.contains(ms.getExtension(mediaType))) { return null; } String text; try { text = new JacksonRepresentation<>(mediaType, content).getText(); } catch (IOException e) { throw new RuntimeException(e); } if (ms.getAllMediaTypes("xml").contains(mediaType)) { text = text.replaceAll("HashMap", representationName); } return text; }
public static String convertSampleAccordingToMediaType( Object content, String mediaTypeAsString, String representationName) { MetadataService ms = new MetadataService(); MediaType mediaType = MediaType.valueOf(mediaTypeAsString); if (!supportedExtensions.contains(ms.getExtension(mediaType))) { return null; } String text; try { text = new JacksonRepresentation<>(mediaType, content).getText(); } catch (IOException e) { throw new RuntimeException(e); } if (ms.getAllMediaTypes("xml").contains(mediaType)) { text = text.replaceAll("HashMap", representationName); } return text; }
public static String convertSampleAccordingToMediaType( Object content, String mediaTypeAsString, String representationName) { MetadataService ms = new MetadataService(); MediaType mediaType = MediaType.valueOf(mediaTypeAsString); if (!supportedExtensions.contains(ms.getExtension(mediaType))) { return null; } String text; try { text = new JacksonRepresentation<>(mediaType, content).getText(); } catch (IOException e) { throw new RuntimeException(e); } if (ms.getAllMediaTypes("xml").contains(mediaType)) { text = text.replaceAll("HashMap", representationName); } return text; }
public static String convertSampleAccordingToMediaType( Object content, String mediaTypeAsString, String representationName) { MetadataService ms = new MetadataService(); MediaType mediaType = MediaType.valueOf(mediaTypeAsString); if (!supportedExtensions.contains(ms.getExtension(mediaType))) { return null; } String text; try { text = new JacksonRepresentation<>(mediaType, content).getText(); } catch (IOException e) { throw new RuntimeException(e); } if (ms.getAllMediaTypes("xml").contains(mediaType)) { text = text.replaceAll("HashMap", representationName); } return text; }
.getEntity().getMediaType(); List<MediaType> amts = getMetadataService() .getAllMediaTypes( methodAnnotationInfo .getInput());