Skip to main content

ContentType

作为 html 为结果的响应,设置 ContentType 需要通过 @Produces 注解。如下:

@MappingTo("/my.html")
public class HtmlProduces {
@Any
@Produces("test/html")
public void testProduces1() {
invoker.renderTo("flt", "/my.flt");
}
}

::;tip 如果没有指定 @Produces 注释,Hasor 也不会主动设置 ContentType。 :::