You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2004/09/24 23:04:27 UTC

svn commit: rev 47173 - in incubator/beehive/trunk/netui: src/tags-html/org/apache/beehive/netui/tags/html src/util/org/apache/beehive/netui/util test/webapps/drt/coreWeb/WEB-INF

Author: dolander
Date: Fri Sep 24 14:04:26 2004
New Revision: 47173

Modified:
   incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
   incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java
   incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
   incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
Log:
THe FileUpload tag now reports an error when the WebApp doesn't support multipart request handling.
Changed the test webapp CoreWeb so it does support multipart request handling so the FileUpload tag can be tested.




Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java	(original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java	Fri Sep 24 14:04:26 2004
@@ -17,12 +17,13 @@
  */
 package org.apache.beehive.netui.tags.html;
 
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
 import org.apache.beehive.netui.tags.rendering.InputFileTag;
 import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
 import org.apache.beehive.netui.util.Bundle;
 
-import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.JspException;
 
 /**
@@ -244,8 +245,17 @@
      */
     public int doEndTag() throws JspException
     {
+        HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
+
+        // if we are not handling multipart requests then we can't output the file upload tag and we will
+        // report an error
+        if (!InternalUtils.isMultipartHandlingEnabled(req)) {
+            String s = Bundle.getString("Tags_FileMultiOff", null);
+            registerTagError(s, null);
+            return EVAL_PAGE;
+        }
+
         String idScript = null;
-        ServletRequest req = pageContext.getRequest();
 
         // Create the state for the input tag.
         String realName = doNaming();

Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java	(original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java	Fri Sep 24 14:04:26 2004
@@ -28,19 +28,14 @@
 
 /**
  * An option whose state is determined by its enclosing SelectOption.
+ * @jsptagref.tagdescription Renders a single <option> tag.
  *
-
- * @jsptagref.tagdescription
- * Renders a single <option> tag.
- * 
  * <p>The &lt;netui:selectOption> must have a parent {@link Select} tag.
- * 
+ *
  * <p>To dynamically generate a set of &lt;option> tags, point the {@link Select}
- * tag at a String[], {@link java.util.HashMap java.util.HashMap}, 
+ * tag at a String[], {@link java.util.HashMap java.util.HashMap},
  * or any object that implements {@link java.util.Map java.util.Map}.
- * 
- * @example 
- * The following sample generates a set of &lt;option> tags.
+ * @example The following sample generates a set of &lt;option> tags.
  * <pre>    &lt;netui:form action="submit">
  *        &lt;netui:select dataSource="{actionForm.selections}" size="5">
  *            &lt;netui:selectOption value="red" />
@@ -51,7 +46,6 @@
  *        &lt;/netui:select>
  *        &lt;netui:button type="submit" value="Submit"/>
  *    &lt;/netui:form></pre>
- *  
  * @netui:tag name="selectOption" description="An option whose state is determined by its enclosing netui:selectOption."
  * @netui.tldx:tag requiredparent="select"
  * requiredchild="label attribute"
@@ -120,13 +114,9 @@
     /**
      * Set if this option is disabled or not.
      * @param disabled - "true" or "false"
-     * @jsptagref.attributedescription
-     * Boolean. Determines whether the &lt;option> is disabled.
-     * 
+     * @jsptagref.attributedescription Boolean. Determines whether the &lt;option> is disabled.
      * @jsptagref.databindable Read Only
-     * 
      * @jsptagref.attributesyntaxvalue <i>boolean_disabled</i>
-     *
      * @netui:attribute required="false" rtexprvalue="true" type="boolean"
      * description="Determines whether the <option> is disabled."
      * @netui.tldx:attribute category="misc"
@@ -172,14 +162,10 @@
     /**
      * Set the value of this SelectOption.
      * @param value - the SelectOption value
-     * @jsptagref.attributedescription
-     * A literal or a data binding expression that determines the value submitted by the
+     * @jsptagref.attributedescription A literal or a data binding expression that determines the value submitted by the
      * &lt;option> tag.
-     * 
      * @jsptagref.databindable Read Only
-     * 
      * @jsptagref.attributesyntaxvalue <i>string_or_expression_value</i>
-     *
      * @netui:attribute required="true" rtexprvalue="true"
      * description="A literal or a data binding expression that determines the value submitted by the
      * <option> tag."
@@ -199,7 +185,7 @@
     {
 
         Tag parentTag = getParent();
-        while (! (parentTag instanceof Select))
+        while (!(parentTag instanceof Select))
             parentTag = parentTag.getParent();
 
         if (parentTag == null) {
@@ -269,7 +255,7 @@
 
         // the parent was validated in the doStartTag call
         Tag parentTag = getParent();
-        while (! (parentTag instanceof Select))
+        while (!(parentTag instanceof Select))
             parentTag = parentTag.getParent();
 
         assert (parentTag instanceof Select);
@@ -296,7 +282,7 @@
             _state.id = _id;
         }
 
-            _state.disabled = _disabled;
+        _state.disabled = _disabled;
 
         if (parentSelect.isMatched(_value))
             _state.selected = true;

Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
==============================================================================
--- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties	(original)
+++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties	Fri Sep 24 14:04:26 2004
@@ -101,6 +101,7 @@
 Tags_ParameterRenderError=The parameter type [{0}] was not recognized as a valid type.
 Tags_ParameterAccessError=The parameter type [{0}] was not recognized as a valid type, attempting to access argument ''{1}''.
 Tags_DataSourceExpressionError=An error occurred converting the data source "{0}" into an expression; {1}
+Tags_FileMultiOff=The FileUpload tag may not be used because Multipart Request Handling is turned off for this WebApp.
 
 DataSourceError=The expression "<b>{0}</b>" is an invalid expression for a <b>dataSource</b>.  Expressions in a dataSource must bind to a single property.
 TreeRootError=The expression "<b>{0}</b>" is invalid. Cause: {1}

Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml	(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml	Fri Sep 24 14:04:26 2004
@@ -47,6 +47,10 @@
         <forward-redirect-handler-class>pageFlowCore.forwards.Controller$Redirector</forward-redirect-handler-class>
     </pageflow-handlers>
 
+    <pageflow-config>
+        <multipart-handler>memory</multipart-handler>
+    </pageflow-config>
+
     <iterator-factories>
     </iterator-factories>