You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2008/03/21 02:20:55 UTC
svn commit: r639509 - in
/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src:
main/java/org/apache/myfaces/trinidaddemo/tagDemos/ main/webapp/WEB-INF/
main/webapp/demos/ main/webapp/demos/tags/ test/webapp/WEB-INF/
Author: gcrawford
Date: Thu Mar 20 18:20:51 2008
New Revision: 639509
URL: http://svn.apache.org/viewvc?rev=639509&view=rev
Log:
TRINIDAD-1022 add fileDownloadActionListener Demo
Added:
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/tagDemos/
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/tagDemos/TestFileDownloadBean.java
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/tags/
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/tags/fileDownloadActionListener.jspx
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/test/webapp/WEB-INF/faces-config.xml
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/demos.jspx
Added: myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/tagDemos/TestFileDownloadBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/tagDemos/TestFileDownloadBean.java?rev=639509&view=auto
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/tagDemos/TestFileDownloadBean.java (added)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/tagDemos/TestFileDownloadBean.java Thu Mar 20 18:20:51 2008
@@ -0,0 +1,37 @@
+/** Copyright (c) Oracle Corporation 2008. All rights reserved */
+package org.apache.myfaces.trinidaddemo.tagDemos;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import javax.faces.context.FacesContext;
+
+
+/**
+ * Bean class used to demo the fileDownloadActionListener tag
+ */
+public class TestFileDownloadBean
+{
+ public TestFileDownloadBean()
+ {
+ }
+
+
+ public void sendHelloFile(FacesContext context,
+ OutputStream outputStream) throws IOException
+ {
+ Writer out = new OutputStreamWriter(outputStream, "UTF-8");
+ out.write("Hi there!");
+ out.close();
+ }
+
+ public void errorHelloFile(FacesContext context,
+ OutputStream outputStream) throws IOException
+ {
+ throw new IOException("Error occurred");
+ }
+
+
+}
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=639509&r1=639508&r2=639509&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml Thu Mar 20 18:20:51 2008
@@ -172,6 +172,16 @@
session
</managed-bean-scope>
</managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>fileDownload</managed-bean-name>
+ <managed-bean-class>
+ org.apache.myfaces.trinidaddemo.tagDemos.TestFileDownloadBean
+ </managed-bean-class>
+ <managed-bean-scope>
+ session
+ </managed-bean-scope>
+ </managed-bean>
<managed-bean>
<managed-bean-name>messages</managed-bean-name>
@@ -1823,7 +1833,7 @@
<from-outcome>guide</from-outcome>
<to-view-id>/componentDemos.jspx</to-view-id>
<redirect/>
- </navigation-case>
+ </navigation-case>
<navigation-case>
<from-outcome>emaildemo</from-outcome>
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/demos.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/demos.jspx?rev=639509&r1=639508&r2=639509&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/demos.jspx (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/demos.jspx Thu Mar 20 18:20:51 2008
@@ -16,7 +16,7 @@
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-
+
-->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
@@ -53,6 +53,8 @@
<tr:commandLink text="Skin Demo" action="demos.skin" />
<tr:goLink text="Show Detail Disclosure Demo"
destination="showDetailDiscloseOne.jspx" />
+ <tr:goLink text="FileDownloadActionListener Demo"
+ destination="tags/fileDownloadActionListener.jspx" />
</tr:panelGroupLayout>
</tr:panelHeader>
Added: myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/tags/fileDownloadActionListener.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/tags/fileDownloadActionListener.jspx?rev=639509&view=auto
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/tags/fileDownloadActionListener.jspx (added)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/tags/fileDownloadActionListener.jspx Thu Mar 20 18:20:51 2008
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:tr="http://myfaces.apache.org/trinidad" version="1.2">
+ <jsp:directive.page contentType="text/html;charset=utf-8"/>
+ <f:view>
+ <tr:document title="fileDownloadActionListener Demo">
+ <tr:form>
+ <tr:panelGroupLayout layout="vertical">
+ <f:facet name="separator">
+ <tr:separator/>
+ </f:facet>
+ <tr:panelGroupLayout layout="horizontal">
+ <tr:goLink text="Feature Demos" destination="../demos.jspx"/>
+ <tr:spacer width="10"/>
+ <tr:goLink destination="http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_fileDownloadActionListener.html"
+ text="Tag Documentation"/>
+ </tr:panelGroupLayout>
+ <tr:outputFormatted styleUsage="instruction"
+ value="<b>fileDownloadActionListener</b>"/>
+ <tr:outputText value="Click any command component to download a file"/>
+ <tr:commandLink immediate="true" text="Command Link">
+ <tr:fileDownloadActionListener contentType="text/plain" filename="button.txt"
+ method="#{fileDownload.sendHelloFile}"/>
+ </tr:commandLink>
+ <tr:commandButton immediate="true" text="Command Button">
+ <tr:fileDownloadActionListener contentType="text/plain" filename="button.txt"
+ method="#{fileDownload.sendHelloFile}"/>
+ </tr:commandButton>
+ <tr:spacer height="20px"/>
+ <tr:outputText value="The example below shows the behavior if there is an error while processing on the server"/>
+ <tr:commandButton immediate="true" text="Click for Error">
+ <tr:fileDownloadActionListener contentType="text/plain" filename="button.txt"
+ method="#{fileDownload.errorHelloFile}"/>
+ </tr:commandButton>
+ </tr:panelGroupLayout>
+ </tr:form>
+ </tr:document>
+ </f:view>
+</jsp:root>
Added: myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/test/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/test/webapp/WEB-INF/faces-config.xml?rev=639509&view=auto
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/test/webapp/WEB-INF/faces-config.xml (added)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/test/webapp/WEB-INF/faces-config.xml Thu Mar 20 18:20:51 2008
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="windows-1252"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
+
+</faces-config>
\ No newline at end of file