/** * Set content type for the resource. * <p> * This is a shorthand for * {@link #setContentTypeResolver(ContentTypeResolver)} with resolver which * always returns {@code contentType} * * @param contentType * resource content type, not <code>null</code> * @return this resource */ public StreamResource setContentType(String contentType) { if (resolver == null) { throw new IllegalArgumentException("Content type cannot be null"); } setContentTypeResolver((resource, context) -> contentType); return this; }