You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/08/10 02:14:25 UTC
svn commit: r684384 - in /myfaces/commons/branches/jsf_11:
myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/
myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/
myfaces-commons-examples/ myfaces-c...
Author: lu4242
Date: Sat Aug 9 17:14:25 2008
New Revision: 684384
URL: http://svn.apache.org/viewvc?rev=684384&view=rev
Log:
backport of trunk features
Added:
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedListStateWrapper.java
- copied, changed from r684339, myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java
myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedStateWrapper.java
- copied, changed from r684339, myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java
Removed:
myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java
myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java
Modified:
myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java
myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp
myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/main/resources/org/apache/myfaces/commons/Messages.properties
myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AbstractCompareToValidator.java
myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java Sat Aug 9 17:14:25 2008
@@ -43,6 +43,7 @@
public static final String CONVERTER_ID = "org.apache.myfaces.commons.converter.Enum";
public static final String ENUM_ID = "org.apache.myfaces.commons.converter.EnumConverter.ENUM";
public static final String ENUM_NO_CLASS_ID = "org.apache.myfaces.commons.converter.EnumConverter.ENUM_NO_CLASS";
+ public static final String ENUM_NO_ENUM_CLASS = "org.apache.myfaces.commons.converter.EnumConverter.ENUM_NO_ENUM_CLASS";
private Class targetClass;
@@ -100,6 +101,13 @@
ENUM_NO_CLASS_ID,
params));
}
+ if (!targetClass.isEnum())
+ {
+ Object[] params = new Object[]{value, MessageUtils.getLabel(facesContext, uiComponent)};
+ throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
+ ENUM_NO_ENUM_CLASS,
+ params));
+ }
}
// find the first constant value of the targetClass and return as a String
@@ -130,7 +138,8 @@
/**
* The enum class to be used for this converter as reference
*
- * @JSFProperty
+ * @JSFProperty
+ * required = "true"
*/
public Class getTargetClass()
{
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java Sat Aug 9 17:14:25 2008
@@ -79,7 +79,7 @@
}
catch (ConverterException exception)
{
- fail();
+ fail(exception.getMessage());
}
}
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml Sat Aug 9 17:14:25 2008
@@ -67,6 +67,12 @@
</repositories>
<dependencies>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<scope>compile</scope>
@@ -93,4 +99,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java?rev=684384&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java Sat Aug 9 17:14:25 2008
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.servlet;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class SourceCodeServlet extends HttpServlet
+{
+ public void doGet(HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException
+ {
+ String webPage = req.getServletPath();
+
+ // remove the '*.source' suffix that maps to this servlet
+ int chopPoint = webPage.lastIndexOf(".source");
+
+ webPage = webPage.substring(0, chopPoint);
+
+ if(webPage.endsWith(".jsf"))
+ {
+ int jsfChopPoint = webPage.lastIndexOf(".jsf");
+
+ webPage = webPage.substring(0, jsfChopPoint);
+
+ webPage += ".jsp"; // replace jsf with jsp
+
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else if(webPage.endsWith(".jsp"))
+ {
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else if(webPage.endsWith(".jspx"))
+ {
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else if(webPage.endsWith(".xhtml"))
+ {
+ // get the actual file location of the requested resource
+ String realPath = getServletConfig().getServletContext().getRealPath(webPage);
+
+ outputFile(res, realPath);
+ }
+ else
+ {
+ int beginChopPoint = webPage.lastIndexOf("/");
+ int extensionChopPoint = webPage.lastIndexOf(".java");
+
+ webPage = webPage.substring(beginChopPoint+1,extensionChopPoint);
+
+ try
+ {
+
+ // get the actual file location of the requested resource; try it in classes first
+ String realPath = getServletConfig().getServletContext().getRealPath("/WEB-INF/classes/"+webPage.replace('.','/')+".java");
+
+ outputFile(res, realPath);
+ }
+ catch(Exception e)
+ {
+ //classes hasn't worked. How about src?
+ String realPath = getServletConfig().getServletContext().getRealPath("/WEB-INF/src/"+webPage.replace('.','/')+".java");
+
+ outputFile(res, realPath);
+ }
+
+ }
+ }
+
+ private void outputFile(HttpServletResponse res, String realPath)
+ throws IOException
+ {
+ // output an HTML page
+ res.setContentType("text/plain");
+
+ // print some html
+ ServletOutputStream out = res.getOutputStream();
+
+ // print the file
+ InputStream in = null;
+ try
+ {
+ in = new BufferedInputStream(new FileInputStream(realPath));
+ int ch;
+ while ((ch = in.read()) !=-1)
+ {
+ out.print((char)ch);
+ }
+ }
+ finally {
+ if (in != null) in.close(); // very important
+ }
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/servlet/SourceCodeServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java?rev=684384&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java Sat Aug 9 17:14:25 2008
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.examples.validate;
+
+public enum EducationLevel
+{
+ NONE,
+ PRIMARY,
+ SECUNDARY,
+ UNIVERSITY,
+ MASTER,
+ DOCTOR
+}
\ No newline at end of file
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/EducationLevel.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java?rev=684384&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java Sat Aug 9 17:14:25 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.examples.validate;
+
+public class ValidateEnum
+{
+
+ private EducationLevel level;
+
+ public EducationLevel getLevel()
+ {
+ return level;
+ }
+
+ public void setLevel(EducationLevel level)
+ {
+ this.level = level;
+ }
+
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/examples/validate/ValidateEnum.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties Sat Aug 9 17:14:25 2008
@@ -6,6 +6,7 @@
validate_email = Email
validate_credit = Credit Card
validate_url = Url
+validate_enum = Enumeration (NONE,PRIMARY,SECUNDARY,UNIVERSITY,MASTER,DOCTOR)
validate_regexp = Regular Expression(bat,cat,rat are valid values)
validate_isbn = ISBN
validate_base = Base value
@@ -14,4 +15,4 @@
validate_greaterthan = Validate Greater Than
validate_greaterthanequal = Validate Greater Than Equal
validate_lessthan = Validate Less Than
-validate_lessthanequal = Validate Less Than Equal
\ No newline at end of file
+validate_lessthanequal =Validate Less Than Equal
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml Sat Aug 9 17:14:25 2008
@@ -2,21 +2,22 @@
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-
<faces-config>
- <managed-bean>
- <managed-bean-name>dataFieldHolder</managed-bean-name>
- <managed-bean-class>
- org.apache.myfaces.commons.examples.DataFieldHolder
- </managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
- <!-- validation -->
- <managed-bean>
- <managed-bean-name>validateForm</managed-bean-name>
- <managed-bean-class>
- org.apache.myfaces.examples.validate.ValidateForm
- </managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>dataFieldHolder</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.commons.examples.DataFieldHolder</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <!-- validation -->
+ <managed-bean>
+ <managed-bean-name>validateForm</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.validate.ValidateForm</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>validateEnum</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.validate.ValidateEnum</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/web.xml Sat Aug 9 17:14:25 2008
@@ -1,75 +1,76 @@
<?xml version="1.0"?>
<!--
- * 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.
+ * 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.
-->
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
<description>MyProject web.xml</description>
<!--optional: context-param>
<description>Comma separated list of URIs of (additional) faces config files.
- (e.g. /WEB-INF/my-config.xml)
- See JSF 1.0 PRD2, 10.3.2
- Attention: You do not need to put /WEB-INF/faces-config.xml in here.
+ (e.g. /WEB-INF/my-config.xml)
+ See JSF 1.0 PRD2, 10.3.2
+ Attention: You do not need to put /WEB-INF/faces-config.xml in here.
</description>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/examples-config.xml</param-value>
- </context-param-->
+ </context-param-->
<context-param>
- <description>State saving method: "client" or "server" (= default)
- See JSF Specification 2.5.3</description>
+ <description>State saving method: "client" or "server" (= default) See JSF Specification 2.5.3</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
- <description>Only applicable if state saving method is "server" (= default).
- Defines the amount (default = 20) of the latest views are stored in session.</description>
+ <description>
+ Only applicable if state saving method is "server" (= default). Defines the amount (default = 20) of the
+ latest views are stored in session.
+ </description>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>20</param-value>
</context-param>
<context-param>
- <description>Only applicable if state saving method is "server" (= default).
- If true (default) the state will be serialized to a byte stream before it
- is written to the session.
- If false the state will not be serialized to a byte stream.</description>
+ <description>
+ Only applicable if state saving method is "server" (= default). If true (default) the state will be
+ serialized to a byte stream before it is written to the session. If false the state will not be serialized
+ to a byte stream.
+ </description>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <description>Only applicable if state saving method is "server" (= default) and if
- org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default)
- If true (default) the serialized state will be compressed before it
- is written to the session. If false the state will not be compressed.</description>
+ <description>
+ Only applicable if state saving method is "server" (= default) and if
+ org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default) If true (default) the serialized state
+ will be compressed before it is written to the session. If false the state will not be compressed.
+ </description>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <description>This parameter tells MyFaces if javascript code should be allowed in the
- rendered HTML output.
- If javascript is allowed, command_link anchors will have javascript code
- that submits the corresponding form.
- If javascript is not allowed, the state saving info and nested parameters
- will be added as url parameters.
- Default: "true"</description>
+ <description>
+ This parameter tells MyFaces if javascript code should be allowed in the rendered HTML output. If javascript
+ is allowed, command_link anchors will have javascript code that submits the corresponding form. If
+ javascript is not allowed, the state saving info and nested parameters will be added as url parameters.
+ Default: "true"
+ </description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
@@ -78,55 +79,49 @@
<param-value>false</param-value>
</context-param>
<context-param>
- <description>If true, rendered HTML code will be formatted, so that it is "human readable".
- i.e. additional line separators and whitespace will be written, that do not
- influence the HTML code.
- Default: "true"</description>
+ <description>
+ If true, rendered HTML code will be formatted, so that it is "human readable". i.e. additional line
+ separators and whitespace will be written, that do not influence the HTML code. Default: "true"
+ </description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <description>If true, a javascript function will be rendered that is able to restore the
- former vertical scroll on every request. Convenient feature if you have pages
- with long lists and you do not want the browser page to always jump to the top
- if you trigger a link or button action that stays on the same page.
- Default: "false"</description>
+ <description>
+ If true, a javascript function will be rendered that is able to restore the former vertical scroll on every
+ request. Convenient feature if you have pages with long lists and you do not want the browser page to always
+ jump to the top if you trigger a link or button action that stays on the same page. Default: "false"
+ </description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
- <description>Used for encrypting view state. Only relevant for client side
- state saving. See MyFaces wiki/web site documentation for instructions
- on how to configure an application for diffenent encryption strengths.
+ <description>
+ Used for encrypting view state. Only relevant for client side state saving. See MyFaces wiki/web site
+ documentation for instructions on how to configure an application for diffenent encryption strengths.
</description>
<param-name>org.apache.myfaces.SECRET</param-name>
<param-value>NzY1NDMyMTA=</param-value>
</context-param>
<context-param>
- <description>
- Validate managed beans, navigation rules and ensure that forms are not nested.
- </description>
+ <description>Validate managed beans, navigation rules and ensure that forms are not nested.</description>
<param-name>org.apache.myfaces.VALIDATE</param-name>
<param-value>true</param-value>
</context-param>
-
+
<context-param>
- <description>
- Treat readonly same as if disabled attribute was set for select elements.
- </description>
+ <description>Treat readonly same as if disabled attribute was set for select elements.</description>
<param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
<param-value>true</param-value>
- </context-param>
-
+ </context-param>
+
<context-param>
- <description>
- Define partial state saving as true/false.
- </description>
+ <description>Define partial state saving as true/false.</description>
<param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
<param-value>false</param-value>
- </context-param>
+ </context-param>
<!-- Faces Servlet -->
<servlet>
@@ -135,12 +130,22 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <servlet-name>SourceCodeServlet</servlet-name>
+ <servlet-class>org.apache.myfaces.commons.servlet.SourceCodeServlet</servlet-class>
+ </servlet>
+
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>SourceCodeServlet</servlet-name>
+ <url-pattern>*.source</url-pattern>
+ </servlet-mapping>
+
<!-- Welcome files -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp?rev=684384&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp Sat Aug 9 17:14:25 2008
@@ -0,0 +1,78 @@
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/converters"
+ prefix="mcc"%>
+<%@ taglib uri="http://myfaces.apache.org/commons/validators"
+ prefix="mcv"%>
+
+<html>
+
+<%@include file="inc/head.inc"%>
+
+<!--
+/*
+ * 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.
+ */
+//-->
+
+<body>
+
+<!--
+managed beans used:
+ validateForm
+-->
+
+<f:view>
+
+ <f:loadBundle
+ basename="org.apache.myfaces.examples.resource.example_messages"
+ var="example_messages" />
+
+ <h:panelGroup id="body">
+
+ <h:form id="form1">
+ <h:messages showDetail="false" showSummary="true" ></h:messages>
+ <h:panelGrid columns="3">
+
+ <h:outputLabel for="enum"
+ value="#{example_messages['validate_enum']}" />
+ <h:inputText id="enum" value="#{validateEnum.level}" required="true">
+ <mcc:convertEnum
+ targetClass="org.apache.myfaces.examples.validate.EducationLevel" />
+ </h:inputText>
+ <h:message id="enumError" for="enum" styleClass="error" />
+
+ <h:panelGroup />
+ <h:commandButton id="validateButton"
+ value="#{example_messages['button_submit']}"
+ action="#{validateForm.submit}" />
+ <h:panelGroup />
+
+ </h:panelGrid>
+ </h:form>
+
+ </h:panelGroup>
+
+</f:view>
+
+<%@include file="inc/page_footer.jsp"%>
+
+</body>
+
+</html>
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/convertEnum.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp Sat Aug 9 17:14:25 2008
@@ -46,7 +46,13 @@
</h:outputLink>
<h:outputLink value="validateCSV.jsf">
<f:verbatim>ValidateCSV</f:verbatim>
- </h:outputLink>
+ </h:outputLink>
+ <h:outputLink value="validateUrl.jsf">
+ <f:verbatim>ValidateUrl</f:verbatim>
+ </h:outputLink>
+ <h:outputLink value="convertEnum.jsf">
+ <f:verbatim>ConvertEnum</f:verbatim>
+ </h:outputLink>
</h:panelGrid>
</h:form>
@@ -54,4 +60,4 @@
</body>
-</html>
\ No newline at end of file
+</html>
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/inc/page_footer.jsp Sat Aug 9 17:14:25 2008
@@ -2,3 +2,5 @@
<br/>
<a href="home.jsf">[HOME]</a>
+
+<a href="<%=request.getRequestURI()%>.source">[SOURCE]</a>
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/main/resources/org/apache/myfaces/commons/Messages.properties
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/main/resources/org/apache/myfaces/commons/Messages.properties?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/main/resources/org/apache/myfaces/commons/Messages.properties (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/main/resources/org/apache/myfaces/commons/Messages.properties Sat Aug 9 17:14:25 2008
@@ -30,4 +30,12 @@
org.apache.myfaces.commons.validator.csv.SUFFIX= - on entry #{0}
org.apache.myfaces.commons.validator.csv.INVALID_SEPARATOR=invalid separator {0}
org.apache.myfaces.commons.validator.Url.INVALID = The given url {0} is invalid
-org.apache.myfaces.commons.validator.ISBN.INVALID = The given isbn {0} is invalid
\ No newline at end of file
+org.apache.myfaces.commons.validator.ISBN.INVALID =The given isbn {0} is invalid
+org.apache.myfaces.commons.validator.CompareTo.INVALID ={0} value <{1}> must be {2} {3} value <{4}>
+org.apache.myfaces.commons.validator.CompareTo.INVALID_detail ={0} value <{1}> must be {2} {3} value <{4}>
+org.apache.myfaces.commons.converter.EnumConverter.ENUM = Conversion Error.
+org.apache.myfaces.commons.converter.EnumConverter.ENUM_detail = {2} : The given value {0} does not match with any enum value as {1}.
+org.apache.myfaces.commons.converter.EnumConverter.ENUM_NO_CLASS = No target class selected.
+org.apache.myfaces.commons.converter.EnumConverter.ENUM_NO_CLASS_detail = {1} \: enum targetClass for converter does not exists.
+org.apache.myfaces.commons.converter.EnumConverter.ENUM_NO_ENUM_CLASS = Class is not an enum.
+org.apache.myfaces.commons.converter.EnumConverter.ENUM_NO_ENUM_CLASS_detail ={1} \: The class selected as targetClass for the converter is not an enum.
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AbstractCompareToValidator.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AbstractCompareToValidator.java?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AbstractCompareToValidator.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AbstractCompareToValidator.java Sat Aug 9 17:14:25 2008
@@ -138,9 +138,8 @@
* <p>The message identifier of the {@link FacesMessage} to be created if
* the comparison check fails.</p>
*/
- // public static final String COMPARE_TO_MESSAGE_ID = "org.apache.myfaces.CompareTo.INVALID";
- public static final String COMPARE_TO_MESSAGE_ID = "{0} value <{1}> must be {2} {3} value <{4}>";
-
+ public static final String COMPARE_TO_MESSAGE_ID = "org.apache.myfaces.commons.validator.CompareTo.INVALID";
+
public AbstractCompareToValidator(){
super();
}
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java?rev=684384&r1=684383&r2=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java Sat Aug 9 17:14:25 2008
@@ -31,7 +31,7 @@
/**
- * Base validator implementation for Tomahawk validators.
+ * Base validator implementation for Apache MyFaces Commons Validators.
*
* @JSFValidator
* configExcluded = "true"
@@ -260,7 +260,7 @@
{
lst.add(saveAttachedState(context, it.next()));
}
- return new AttachedListStateWrapper(lst);
+ return new _AttachedListStateWrapper(lst);
}
else if (attachedObject instanceof StateHolder)
{
@@ -270,7 +270,7 @@
}
else
{
- return new AttachedStateWrapper(attachedObject.getClass(),
+ return new _AttachedStateWrapper(attachedObject.getClass(),
((StateHolder)attachedObject).saveState(context));
}
}
@@ -280,7 +280,7 @@
}
else
{
- return new AttachedStateWrapper(attachedObject.getClass(), null);
+ return new _AttachedStateWrapper(attachedObject.getClass(), null);
}
}
@@ -290,9 +290,9 @@
{
if (context == null) throw new NullPointerException("context");
if (stateObj == null) return null;
- if (stateObj instanceof AttachedListStateWrapper)
+ if (stateObj instanceof _AttachedListStateWrapper)
{
- List lst = ((AttachedListStateWrapper)stateObj).getWrappedStateList();
+ List lst = ((_AttachedListStateWrapper)stateObj).getWrappedStateList();
List restoredList = new ArrayList(lst.size());
for (Iterator it = lst.iterator(); it.hasNext(); )
{
@@ -300,9 +300,9 @@
}
return restoredList;
}
- else if (stateObj instanceof AttachedStateWrapper)
+ else if (stateObj instanceof _AttachedStateWrapper)
{
- Class clazz = ((AttachedStateWrapper)stateObj).getClazz();
+ Class clazz = ((_AttachedStateWrapper)stateObj).getClazz();
Object restoredObject;
try
{
@@ -318,7 +318,7 @@
}
if (restoredObject instanceof StateHolder)
{
- Object wrappedState = ((AttachedStateWrapper)stateObj).getWrappedStateObject();
+ Object wrappedState = ((_AttachedStateWrapper)stateObj).getWrappedStateObject();
((StateHolder)restoredObject).restoreState(context, wrappedState);
}
return restoredObject;
Copied: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedListStateWrapper.java (from r684339, myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedListStateWrapper.java?p2=myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedListStateWrapper.java&p1=myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java&r1=684339&r2=684384&rev=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedListStateWrapper.java Sat Aug 9 17:14:25 2008
@@ -25,13 +25,13 @@
* @author Manfred Geiler (latest modification by $Author: bdudney $)
* @version $Revision: 225333 $ $Date: 2005-07-26 17:49:19 +0200 (Di, 26 Jul 2005) $
*/
-class AttachedListStateWrapper
+class _AttachedListStateWrapper
implements Serializable
{
private static final long serialVersionUID = -3958718149793179776L;
private List _wrappedStateList;
- public AttachedListStateWrapper(List wrappedStateList)
+ public _AttachedListStateWrapper(List wrappedStateList)
{
_wrappedStateList = wrappedStateList;
}
Copied: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedStateWrapper.java (from r684339, myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedStateWrapper.java?p2=myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedStateWrapper.java&p1=myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java&r1=684339&r2=684384&rev=684384&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/_AttachedStateWrapper.java Sat Aug 9 17:14:25 2008
@@ -24,7 +24,7 @@
* @author Manfred Geiler (latest modification by $Author: bdudney $)
* @version $Revision: 225333 $ $Date: 2005-07-26 17:49:19 +0200 (Di, 26 Jul 2005) $
*/
-class AttachedStateWrapper
+class _AttachedStateWrapper
implements Serializable
{
private static final long serialVersionUID = 4948301780259917764L;
@@ -35,7 +35,7 @@
* @param clazz null means wrappedStateObject is a List of state objects
* @param wrappedStateObject
*/
- public AttachedStateWrapper(Class clazz, Object wrappedStateObject)
+ public _AttachedStateWrapper(Class clazz, Object wrappedStateObject)
{
if (wrappedStateObject != null && !(wrappedStateObject instanceof Serializable))
{