java - Vaadin 7 示例在部署到 tomcat 7 时显示 "Cookies Disabled"消息

标签 java eclipse cookies tomcat7 vaadin7

我正在努力解决一个让我困惑的问题,让我思考问题是否来自 tomcat 还是 vaadin。

应用程序:我创建的应用程序是您可以使用 eclipse 和 vaadin 7 插件构建的起始项目,它构建一个带有按钮的页面。每当您单击该按钮时,下面就会出现一行文本,单击次数越多,就会添加更多行。

问题:这个应用程序在 eclipse 上运行,就像带有 tomcat 服务器的魅力一样。但是,当我部署到在 apache 服务器上运行的 tomcat 7 服务器时,无论我使用什么浏览器(IE、Firefox 和 Chrome),我都会收到“Cookies Disabled”消息,甚至删除所有安全性并接受每个浏览器的所有 cookie,它似乎不起作用。

它生成的代码如下: EvotestUI.java

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
@Theme("evotest")
public class EvotestUI extends UI {

@WebServlet(value = "/*", asyncSupported = false)
@VaadinServletConfiguration(productionMode = false, ui = EvotestUI.class)
public static class Servlet extends VaadinServlet {
}

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    Button button = new Button("Click Me");
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            layout.addComponent(new Label("Thank you for clicking"));
        }
    });
    layout.addComponent(button);
}

}

ivysettings.xml

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<settings defaultResolver="default" />
<resolvers>
<chain name="default">
<!-- Public Maven repository -->
<ibiblio name="public" m2compatible="true" />
<!-- Vaadin Add-on repository -->
<ibiblio name="vaadin-addons" usepoms="true" m2compatible="true"root="http://maven.vaadin.com/vaadin-addons" />
<!-- Vaadin snapshots repository -->
<ibiblio name="vaadin-snapshots" usepoms="true" m2compatible="true" root="https://oss.sonatype.org/content/repositories/vaadin-snapshots" />
<!-- Repository used for Vaadin modified smartsprites library -->
<dual name="custom-smartsprites">
<filesystem name="smartsprites-ivy">
<ivy pattern="${basedir}/ivymodule/[module]-ivy-[revision].xml" />
</filesystem>
<url name="smartsprites-artifact">
<artifact pattern="http://dev.vaadin.com/svn/versions/6.8/build/smartsprites/lib/[artifact](-[revision]).[ext]" />
</url>
</dual>
</chain>
</resolvers>
<modules>
<!-- Vaadin patched SmartSprites -->
<module organisation="com.carrotsearch" name="smartsprites" revision="0.2.3-itmill" resolver="custom-smartsprites" />
</modules>
</ivysettings>

ivy.xml

<?xml version="1.0"?>
<!DOCTYPE ivy-module [<!ENTITY vaadin.version "7.1.12">]>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.example" module="v7proj" />
<configurations>
    <!-- The default configuration, which should be deployed to the server -->
    <conf name="default" />
    <!-- A configuration only needed when compiling the widget set. Should 
        not be deployed to the server -->
    <conf name="widgetset-compile" />
    <!-- A configuration used in compilation of server side classes only.
        Should be deployed to the server -->
    <conf name="nodeploy" />
</configurations>
<dependencies defaultconf="default" defaultconfmapping="default->default">
    <!-- The core server part of Vaadin -->
    <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />

    <!-- Vaadin themes -->
    <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />

    <!-- Push support -->
    <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />

    <!-- Servlet 3.0 API -->
    <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="nodeploy->default" />

    <!-- Precompiled DefaultWidgetSet -->
    <dependency org="com.vaadin" name="vaadin-client-compiled"
        rev="&vaadin.version;" />

    <!-- Vaadin client side, needed for widget set compilation -->
    <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
         conf="widgetset-compile->default" />

    <!-- Compiler for custom widget sets. Should not be deployed -->
    <dependency org="com.vaadin" name="vaadin-client-compiler"
        rev="&vaadin.version;" conf="widgetset-compile->default" />
</dependencies>
</ivy-module>

最佳答案

这是使用 httponly 的 tomcat 服务器中的一个错误。我更改服务器配置后问题解决了。谢谢

关于java - Vaadin 7 示例在部署到 tomcat 7 时显示 "Cookies Disabled"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22924411/

相关文章:

java - map api v2 android : Binary XML file line #2 error

eclipse - 为eclipse中的所有源文件添加标准注释头

java - 调用特定方法时创建断点

javascript - 无法在 JavaScript 中设置 cookie

authentication - 如何防止刷新时删除 auth0 session cookie?

java - 将一串多个句子拆分成单个句子,并用 html 标签包围它们

java - Spring 依赖注入(inject)超越基础教程

java - 将存储过程消息直接打印到 Java 控制台

eclipse - Eclipse中的错误,在“安装软件”屏幕中不显示任何内容

internet-explorer - 如何在 IE 中手动创建 cookie