如何将一个robots.txt文件添加到Vaadin应用程序中?如何使用CDI集成将robots.txt添加到Vaadin 7应用程序?
我发现几乎没有任何关系,但是我发现我没有支持这样的文件。
我使用Vaadin 7.1.1与JBoss 7.1.1和Vaadin-CDI集成。
我的解决方法的做法是:通过添加RobotsUI
的项目,在URL http://localhost:8080/App/robots.txt
成为访问。
@CDIUI(value="robots.txt")
public class RobotsUI extends UI {
@Override
protected void init(VaadinRequest request) {
// Send a response with mimetype
// `text/plain` with self defined content.
}
}
我的问题是:我怎么能提供一个自编,text/plain
回应?
感谢您的帮助:-)
不错的主意,解决Vaadin之外的问题。于是我基于我的答案,此外避免了JAR包。谢谢! – aboger