@Test
 public void customContentTypeWithPropertyAndCustomCharset() {
   ViewResolverProperties properties = new ViewResolverProperties();
   properties.setContentType(MimeTypeUtils.parseMimeType("text/plain;foo=bar"));
   properties.setCharset(Charset.forName("UTF-16"));
   assertThat(properties.getContentType(), hasToString("text/plain;charset=UTF-16;foo=bar"));
 }
 void updateSimpMessageHeadersFromStompHeaders() {
   if (getNativeHeaders() == null) {
     return;
   }
   String value = getFirstNativeHeader(STOMP_DESTINATION_HEADER);
   if (value != null) {
     super.setDestination(value);
   }
   value = getFirstNativeHeader(STOMP_CONTENT_TYPE_HEADER);
   if (value != null) {
     super.setContentType(MimeTypeUtils.parseMimeType(value));
   }
   StompCommand command = getCommand();
   if (StompCommand.MESSAGE.equals(command)) {
     value = getFirstNativeHeader(STOMP_SUBSCRIPTION_HEADER);
     if (value != null) {
       super.setSubscriptionId(value);
     }
   } else if (StompCommand.SUBSCRIBE.equals(command) || StompCommand.UNSUBSCRIBE.equals(command)) {
     value = getFirstNativeHeader(STOMP_ID_HEADER);
     if (value != null) {
       super.setSubscriptionId(value);
     }
   } else if (StompCommand.CONNECT.equals(command)) {
     protectPasscode();
   }
 }
Пример #3
0
	/**
	 * Return the content-type header value.
	 */
	public MimeType getContentType() {
		String value = getFirst(CONTENT_TYPE);
		return (StringUtils.hasLength(value) ? MimeTypeUtils.parseMimeType(value) : null);
	}
 @Test
 public void customContentTypeDefaultCharset() {
   ViewResolverProperties properties = new ViewResolverProperties();
   properties.setContentType(MimeTypeUtils.parseMimeType("text/plain"));
   assertThat(properties.getContentType(), hasToString("text/plain;charset=UTF-8"));
 }