You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/04/23 14:22:55 UTC
svn commit: r1675588 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/
tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/
tobago-example/tobago-example-demo/src/main/java/org/...
Author: lofwyr
Date: Thu Apr 23 12:22:54 2015
New Revision: 1675588
URL: http://svn.apache.org/r1675588
Log:
TOBAGO-1456: Mark NonFacesRequestServlet as deprecated
- using <f:viewParam> instead
Removed:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/nonfacesrequest/FishServlet.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/HtmlEditor.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/nonfacesrequest/FishPond.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/non-faces-request.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/x-fish-pond.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java Thu Apr 23 12:22:54 2015
@@ -36,6 +36,10 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+/**
+ * @deprecated since Tobago 2.0.8 - Please use <f:initParam> instead - see also TOBAGO-1456
+ */
+@Deprecated
public abstract class NonFacesRequestServlet extends HttpServlet {
private static final long serialVersionUID = -7448621953821447997L;
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/HtmlEditor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/HtmlEditor.java?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/HtmlEditor.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/HtmlEditor.java Thu Apr 23 12:22:54 2015
@@ -43,6 +43,20 @@ public class HtmlEditor implements Seria
FacesContext.getCurrentInstance(),
"content/35-wysiwyg/00-tinymce/tinymce/js/tinymce/tinymce.min.js")
.size() != 0;
+ text = "<h1>Sonne</h1>"
+ + "<p>Die Sonne ist ein Stern in der Galaxie MilchstraÃe. "
+ + "Sie ist ein Hauptreihenstern (Zwergstern) und steht im Zentrum des Sonnensystems, "
+ + "das sie durch ihre Gravitation dominiert."
+ + "Hauptbestandteile"
+ + "<ul>\n"
+ + "<li>Wasserstoff: 92,1 %</li>\n"
+ + "<li>Helium: 7,8 %</li>\n"
+ + "<li>Sauerstoff: 500 ppm</li>\n"
+ + "<li>Kohlenstoff: 230 ppm</li>\n"
+ + "<li>Neon: 100 ppm</li>\n"
+ + "<li>Stickstoff: 70 ppm</li>\n"
+ + "</ul></p>"
+ + "<p>Quelle: Wikipedia</p>";
}
public String getText() {
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/nonfacesrequest/FishPond.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/nonfacesrequest/FishPond.java?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/nonfacesrequest/FishPond.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/nonfacesrequest/FishPond.java Thu Apr 23 12:22:54 2015
@@ -22,48 +22,57 @@ package org.apache.myfaces.tobago.exampl
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Map;
import java.util.HashMap;
+import java.util.Map;
import java.util.Random;
public class FishPond {
private static final Logger LOG = LoggerFactory.getLogger(FishPond.class);
- private Map<String, String> fishes;
+ private Map<Integer, String> fishes;
- private String selectedFish;
+ private Integer selectedFishId = null;
public FishPond() {
- fishes = new HashMap<String, String>();
- fishes.put("0", "Scholle");
- fishes.put("1", "Hai");
- fishes.put("2", "Luce");
- fishes.put("3", "Halibut");
- fishes.put("4", "Tamboril");
+ fishes = new HashMap<Integer, String>();
+ fishes.put(0, "Scholle");
+ fishes.put(1, "Hai");
+ fishes.put(2, "Luce");
+ fishes.put(3, "Halibut");
+ fishes.put(4, "Tamboril");
+ }
+
+ public void action() {
+ LOG.info("Event is called! selectedFishId='{}'", selectedFishId);
+ // not needed for this example
}
public String random() {
final Random random = new Random(System.currentTimeMillis());
+ selectedFishId = random.nextInt(fishes.size());
- selectedFish = fishes.get("" + random.nextInt(fishes.size()));
-
- LOG.info("select via random: '" + selectedFish + "'");
+ LOG.info("select via random: '" + getSelectedFish() + "'");
- return "/content/90-non-faces-request/x-fish-pond.xhtml";
+ return null; // is AJAX
}
- public String select(final String id) {
- selectedFish = fishes.get(id);
-
- LOG.info("select via id: '" + selectedFish + "'");
-
+ public String select(final Integer fishId) {
+ selectedFishId = fishId;
+ LOG.info("select via id: '" + getSelectedFish() + "'");
return "/content/90-non-faces-request/x-fish-pond.xhtml";
}
public String getSelectedFish() {
- return selectedFish;
+ return fishes.get(selectedFishId);
}
+ public Integer getSelectedFishId() {
+ return selectedFishId;
+ }
+ public void setSelectedFishId(Integer selectedFishId) {
+ this.selectedFishId = selectedFishId;
+ LOG.info("setSelectedFishId via setter: '" + selectedFishId + "'");
+ }
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml Thu Apr 23 12:22:54 2015
@@ -17,47 +17,50 @@
* limitations under the License.
-->
-<ui:composition xmlns:f="http://java.sun.com/jsf/core"
- xmlns:tc="http://myfaces.apache.org/tobago/component"
- xmlns:tx="http://myfaces.apache.org/tobago/extension"
- xmlns:ui="http://java.sun.com/jsf/facelets">
- <f:view locale="#{clientConfigController.locale}">
- <tc:page applicationIcon="icon/favicon.ico" label="#{overviewBundle.pageTitle} - #{title}" id="page">
-
- <tc:script file="script/demo.js"/>
-
- <f:facet name="resize">
- <tc:command immediate="true"/>
- </f:facet>
-
- <f:facet name="menuBar">
- <ui:include src="/menu.xhtml"/>
- </f:facet>
-
- <f:facet name="layout">
- <tc:gridLayout border="0" columns="*;4*" margin="10px" rows="100px;auto;*;auto"/>
- </f:facet>
-
- <tc:panel>
- <tc:gridLayoutConstraint columnSpan="2"/>
- <ui:include src="/header.xhtml"/>
- </tc:panel>
-
- <tc:panel>
- <tc:gridLayoutConstraint rowSpan="3"/>
- <ui:include src="/navigation.xhtml"/>
- </tc:panel>
-
- <tc:messages/>
-
- <tc:box label="#{title}" id="content">
- <ui:insert/>
- </tc:box>
-
- <tc:panel>
- <ui:include src="/footer.xhtml"/>
- </tc:panel>
-
- </tc:page>
- </f:view>
-</ui:composition>
+<f:view locale="#{clientConfigController.locale}"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:insert name="metadata"/>
+
+ <tc:page applicationIcon="icon/favicon.ico" label="#{overviewBundle.pageTitle} - #{title}" id="page">
+
+ <tc:script file="script/demo.js"/>
+
+ <f:facet name="resize">
+ <tc:command immediate="true"/>
+ </f:facet>
+
+ <f:facet name="menuBar">
+ <ui:include src="/menu.xhtml"/>
+ </f:facet>
+
+ <f:facet name="layout">
+ <tc:gridLayout border="0" columns="*;4*" margin="10px" rows="100px;auto;*;auto"/>
+ </f:facet>
+
+ <tc:panel>
+ <tc:gridLayoutConstraint columnSpan="2"/>
+ <ui:include src="/header.xhtml"/>
+ </tc:panel>
+
+ <tc:panel>
+ <tc:gridLayoutConstraint rowSpan="3"/>
+ <ui:include src="/navigation.xhtml"/>
+ </tc:panel>
+
+ <tc:messages/>
+
+ <tc:box label="#{title}" id="content">
+ <ui:insert/>
+ </tc:box>
+
+ <tc:panel>
+ <ui:include src="/footer.xhtml"/>
+ </tc:panel>
+
+ </tc:page>
+</f:view>
+
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml Thu Apr 23 12:22:54 2015
@@ -154,19 +154,6 @@
<url-pattern>/org/apache/myfaces/tobago/sandbox/*</url-pattern>
</servlet-mapping>
- <!-- Non-Faces-Request Demo -->
-
- <servlet>
- <servlet-name>FishServlet</servlet-name>
- <servlet-class>org.apache.myfaces.tobago.example.demo.nonfacesrequest.FishServlet</servlet-class>
- <load-on-startup>3</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>FishServlet</servlet-name>
- <url-pattern>/FishServlet</url-pattern>
- </servlet-mapping>
-
<!-- Error Page -->
<error-page>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/non-faces-request.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/non-faces-request.xhtml?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/non-faces-request.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/non-faces-request.xhtml Thu Apr 23 12:22:54 2015
@@ -21,19 +21,23 @@
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
- <ui:param name="title" value="Non-Faces-Request Demo: Start"/>
+ <ui:param name="title" value="Non-Faces-Request Demo: Start"/>
- <tc:panel>
- <p>
- Use these external links:<br/>
+ <tc:panel>
+ <p>
+ This demo works with <f:viewParam> which is only available with Facelets (not with JSP pages) <br/>
+ </p>
- <a href="#{request.contextPath}/FishServlet?id=0">#{request.contextPath}/FishServlet?id=0</a><br/>
- <a href="#{request.contextPath}/FishServlet?id=1">#{request.contextPath}/FishServlet?id=1</a><br/>
- <a href="#{request.contextPath}/FishServlet?id=2">#{request.contextPath}/FishServlet?id=2</a><br/>
- <a href="#{request.contextPath}/FishServlet?id=3">#{request.contextPath}/FishServlet?id=3</a><br/>
- <a href="#{request.contextPath}/FishServlet?id=4">#{request.contextPath}/FishServlet?id=4</a><br/>
- </p>
+ <p>
+ Use these links from external applications:<br/>
- </tc:panel>
+ <a href="#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=0&dswid=#{request.parameterMap['dswid'][0]}">#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=0&dswid=#{request.parameterMap['dswid'][0]}</a><br/>
+ <a href="#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=1&dswid=#{request.parameterMap['dswid'][0]}">#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=1&dswid=#{request.parameterMap['dswid'][0]}</a><br/>
+ <a href="#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=2&dswid=#{request.parameterMap['dswid'][0]}">#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=2&dswid=#{request.parameterMap['dswid'][0]}</a><br/>
+ <a href="#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=3&dswid=#{request.parameterMap['dswid'][0]}">#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=3&dswid=#{request.parameterMap['dswid'][0]}</a><br/>
+ <a href="#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=4&dswid=#{request.parameterMap['dswid'][0]}">#{request.contextPath}/faces/content/90-non-faces-request/x-fish-pond.xhtml?fishId=4&dswid=#{request.parameterMap['dswid'][0]}</a><br/>
+ </p>
+
+ </tc:panel>
</ui:composition>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/x-fish-pond.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/x-fish-pond.xhtml?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/x-fish-pond.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/90-non-faces-request/x-fish-pond.xhtml Thu Apr 23 12:22:54 2015
@@ -22,23 +22,31 @@
xmlns:tx="http://myfaces.apache.org/tobago/extension"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
- <ui:param name="title" value="Non-Faces-Request Demo: Fish Pont"/>
+ <ui:param name="title" value="Non-Faces-Request Demo: Fish Pont"/>
- <tc:panel>
+ <ui:define name="metadata">
+ <f:metadata>
+ <f:viewParam name="fishId" value="#{fishPond.selectedFishId}" />
+ <f:event type="preRenderView" listener="#{fishPond.action}"/>
+ </f:metadata>
+ </ui:define>
+
+ <tc:panel id="pond">
+
+ <f:facet name="layout">
+ <tc:gridLayout rows="auto;auto" margin="20px"/>
+ </f:facet>
- <f:facet name="layout">
- <tc:gridLayout rows="auto;auto" margin="20px"/>
- </f:facet>
-
- <tx:in label="Selected:" value="#{fishPond.selectedFish}" readonly="true"/>
-
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout columns="auto;*"/>
- </f:facet>
- <tc:button label="random" action="#{fishPond.random}"/>
- </tc:panel>
+ <tx:in label="Selected:" value="#{fishPond.selectedFish}" readonly="true"/>
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="auto;auto;*"/>
+ </f:facet>
+ <tc:button label="random" action="#{fishPond.random}" renderedPartially="pond :page:header:headerInfo"/>
+ <tc:button label="back to start" action="/content/90-non-faces-request/non-faces-request.xhtml"/>
</tc:panel>
+ </tc:panel>
+
</ui:composition>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=1675588&r1=1675587&r2=1675588&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Thu Apr 23 12:22:54 2015
@@ -60,6 +60,7 @@
<entry key="nonFacesResponse">Non Faces Resp.</entry>
<entry key="toolBarCustomizer">User Customized UI</entry>
<entry key="faceletsAsResources">Facelets As Resource</entry>
+ <entry key="non-faces-request">Non Faces Request (Facelets only)</entry>
<entry key="reference_intro">Ref. (under constr.)</entry>
<entry key="reference_command">Command</entry>