Liferay のポートレットを作成していて、ace:fileEntry コンポーネントが必要です。最終的に解決できた問題がいくつかありました。しかし今、私は理解できない問題に直面しています。
ace:fileEntry が含まれているビューページがオープンエンドの場合、プラス マイナス 90 秒後に「ネットワーク接続が中断されました」というメッセージがポップアップ表示され、ページをリロードする必要があります。いくつかの調査の後、ブラウザコンソールで次の行を見つけました。
[icepush.0086c.async-connection] closing previous connection...
[icepush.0086c.async-connection] connect...
[icepush.0086c.async-connection] empty response received
[icepush.0086c.async-connection] closing previous connection...
[icepush.0086c.async-connection] connect...
[icepush.0086c.async-connection] empty response received
[icepush.0086c.async-connection] closing previous connection...
[icepush.0086c.async-connection] connect...
[icepush.0086c.async-connection] empty response received
[icepush.0086c.async-connection] blocking connection stopped, too many empty responses received...
[icepush.0086c.async-connection] failed to connect, first retry...
[icepush.0086c] connection in trouble
[icepush.0086c.async-connection] closing previous connection...
[icepush.0086c.async-connection] connect...
[icepush.0086c.async-connection] empty response received
[icepush.0086c.async-connection] blocking connection stopped, too many empty responses received...
[icepush.0086c.async-connection] failed to connect, second retry...
[icepush.0086c] connection in trouble
[icepush.0086c.async-connection] closing previous connection...
[icepush.0086c.async-connection] connect...
[icepush.0086c.async-connection] empty response received
[icepush.0086c.async-connection] blocking connection stopped, too many empty responses received...
[icepush.0086c] connection to server was lost
以下のバージョンの Liferay と ICEFaces を使用しています。
- Liferay ポータル 6.1.20-EE-GA2
- Liferay-Faces-Bridge-Impl 3.1.2-ga3
- ICEFaces 3.3.0
私の web.xml は次のようになります。
<?xml version="1.0"?>
<web-app
version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!-- Instruct Mojarra to utilize JBoss-EL instead of the EL implementation provided by the servlet container. -->
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<!-- Instruct ICEfaces to abstain from adding a random query parameter to resource URLs (which it does by default -->
<!-- in order to prevent caching of JavaScript resources like bridge.js in a servlet-based webapp). -->
<context-param>
<param-name>org.icefaces.uniqueResourceURLs</param-name>
<param-value>false</param-value>
</context-param>
<!-- Production wegen Test ob bestimmte Messages verschwinden -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.icefaces.mandatoryResourceConfiguration</param-name>
<param-value>dataTable richTextEntry fileEntry</param-value>
</context-param>
<!-- Although the FacesServlet will not be invoked by any portlet requests, it is required to initialize JSF. -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/icefaces/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>mail/MailSession</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
私の face-config.xml は次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<lifecycle>
<phase-listener>com.liferay.faces.util.lifecycle.DebugPhaseListener</phase-listener>
<phase-listener>com.liferay.faces.util.lifecycle.ViewScopePhaseListener</phase-listener>
</lifecycle>
<navigation-rule>
<from-view-id>/views/*</from-view-id>
<navigation-case>
<from-outcome>warenkorb</from-outcome>
<to-view-id>/views/warenkorb.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>checkout</from-outcome>
<to-view-id>/views/bestellprozess.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>bestelluebersicht</from-outcome>
<to-view-id>/views/bestelluebersicht.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<to-view-id>/views/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/adminviews/*</from-view-id>
<navigation-case>
<from-outcome>neueKategorie</from-outcome>
<to-view-id>/adminviews/neueKategorie.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>verwaltungKategorie</from-outcome>
<to-view-id>/adminviews/verwaltungKategorie.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>neuerArtikel</from-outcome>
<to-view-id>/adminviews/neuerArtikel.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>absenderMail</from-outcome>
<to-view-id>/adminviews/absenderMail.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>bestaetigungsMail</from-outcome>
<to-view-id>/adminviews/bestaetigungsMail.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<to-view-id>/adminviews/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
ace:fileEntry が配置されている私の viewpage.xhtml は次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
<ui:composition template="/adminviews/index.xhtml">
<ui:define name="content">
<ace:panel header="Neuen Artikel anlegen">
<ice:form>
<ace:textEntry id="artikelnr"
label="Artikelnummer:"
labelPosition="left"
required="true"
requiredMessage="required"
value="#{addingBean.newArtikel.artikelnummer}">
</ace:textEntry>
<br />
<ace:textEntry id="bezeichnung"
label="Bezeichnung:"
labelPosition="left"
required="true"
requiredMessage="required"
value="#{addingBean.newArtikel.bezeichnung}">
</ace:textEntry>
<br />
<ace:textEntry id="preis"
label="Einzelpreis (netto):"
labelPosition="left"
required="true"
requiredMessage="required"
value="#{addingBean.newArtikel.preis1}">
</ace:textEntry>
<br />
<ace:textEntry id="bestand"
label="Bestand:"
labelPosition="left"
required="true"
requiredMessage="required"
value="#{addingBean.newArtikel.bestand}">
</ace:textEntry>
<br />
<ace:textAreaEntry id="beschreibung"
label="Beschreibung:"
labelPosition="left"
value="#{addingBean.newArtikel.beschreibung}">
</ace:textAreaEntry>
<br />
<ace:simpleSelectOneMenu label="Steuerschlüssel:"
labelPosition="left"
value="#{addingBean.steuerId}"
required="true">
<f:selectItem itemValue="" itemLabel="bitte auswählen ..." />
<f:selectItems value="#{requestBean.allSteuerItems}"/>
</ace:simpleSelectOneMenu>
<br />
<ace:simpleSelectOneMenu label="Kategorie:"
labelPosition="left"
value="#{addingBean.kategorieId}">
<f:selectItem itemValue="null" itemLabel="keine Kategorie" />
<f:selectItems value="#{requestBean.allKategorieItems}" />
</ace:simpleSelectOneMenu>
<br />
<ice:commandButton value="Speichern"
actionListener="#{addingBean.addArtikel}"
action="default"/>
</ice:form>
<ice:form>
<ice:commandButton value="Abbrechen"
action="default"/>
</ice:form>
<h:form id="bildupload">
<ace:fileEntry id="bild"
label="Bildupload"
fileEntryListener="#{addingBean.bildListener}"
maxFileCount="1"
relativePath="/images/"/>
<h:commandButton value="Upload"/>
</h:form>
<ace:messages/>
</ace:panel>
</ui:define>
</ui:composition>
</h:body>
</html>
あなたの誰かが問題を解決する方法を知っていますか、またはなぜこれが起こるのですか?