You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/08/15 03:42:32 UTC
svn commit: r431480 - in /tapestry/tapestry4/trunk: src/site/xdoc/components/
tapestry-framework/src/java/org/apache/tapestry/dojo/
tapestry-framework/src/java/org/apache/tapestry/html/
tapestry-framework/src/java/org/apache/tapestry/services/impl/ tap...
Author: jkuhnert
Date: Mon Aug 14 18:42:31 2006
New Revision: 431480
URL: http://svn.apache.org/viewvc?rev=431480&view=rev
Log:
Fixed a few no-brainer bugs/enhancements taken from JIRA.
Added new dojo specific parameters to @Shell like debugContainerId/parseWidgets/etc..
Exposed isSecure() method to WebRequest.
Updated documentation to reflect new abilities of the Form component wrt ajax as well as Shell changes.
Modified:
tapestry/tapestry4/trunk/src/site/xdoc/components/Form.xml
tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/ServletWebRequest.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java
tapestry/tapestry4/trunk/tapestry-portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java
Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/Form.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/Form.xml?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Form.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Form.xml Mon Aug 14 18:42:31 2006
@@ -227,6 +227,42 @@
application.
</td>
</tr>
+ <tr>
+ <td>updateComponents</td>
+ <td>String[],Collection</td>
+ <td>no</td>
+ <td></td>
+ <td>
+ In an asynchronous request, specifies which components should have their content
+ rendered back to the client. These are expected to be unique component ids.
+
+ <p>
+ See: <a href="../tapestry-framework/apidocs/org/apache/tapestry/services/ResponseBuilder.html">ResponseBuilder</a>
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td>json</td>
+ <td>boolean</td>
+ <td>no</td>
+ <td>false</td>
+ <td>
+ Causes the request to be asynchronous and the response to be captured/rendered via
+ the <a href="../tapestry-framework/apidocs/org/apache/tapestry/services/impl/JSONResponseBuilder.html">JSONResponseBuilder</a>
+ renderer.
+ </td>
+ </tr>
+ <tr>
+ <td>async</td>
+ <td>boolean</td>
+ <td>no</td>
+ <td>false</td>
+ <td>
+ Causes the request to be asynchronous and the response to be captured/rendered via
+ the <a href="../tapestry-framework/apidocs/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.html">DojoAjaxResponseBuilder</a>
+ renderer.
+ </td>
+ </tr>
</table>
<p>
Body:
Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml Mon Aug 14 18:42:31 2006
@@ -222,23 +222,37 @@
</td>
</tr>
<tr>
- <td>ajaxEnabled</td>
+ <td>debugEnabled</td>
<td>boolean</td>
- <td>yes</td>
+ <td>no</td>
<td>true</td>
<td>
- Controls whether or not the
- <a href="../tapestry-framework/apidocs/org/apache/tapestry/dojo/AjaxShellDelegate.html">
- AjaxShellDelegate
- </a> is used to write out javascript include headers for dojo and tapestry core javascript
- libraries.
+ Turns browser level logging completely on/off.
+ </td>
+ </tr>
+ <tr>
+ <td>debugContainerId</td>
+ <td>String</td>
+ <td>no</td>
+ <td>debug</td>
+ <td>
+ Sets the html element node id of the element you would like all browser debug content to
+ go to, if you have logging turned on.
<p>
- <strong>WARNING:</strong> Turning this off effectively disables javascript for many standard
- tapestry operations, such as form validation. Be careful about turning it off unless you know
- it is what you want. Most of the dynamic ajax features aren't used by default unless you
- specifically use a component / parmater that causes them to happen.
+ For example, if you had an element on your html page with id="myElement" you would
+ set the debugContainerId to "myElement".
</p>
+ </td>
+ </tr>
+ <tr>
+ <td>parseWidgets</td>
+ <td>boolean</td>
+ <td>no</td>
+ <td>false</td>
+ <td>
+ Tells dojo whether or not to parse widgets by traversing the entire dom node of your
+ document. It is highly reccomended that you keep this at its default value of false.
</td>
</tr>
<tr>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java Mon Aug 14 18:42:31 2006
@@ -51,6 +51,10 @@
private boolean _debug;
+ private boolean _parseWidgets;
+
+ private String _debugContainerId;
+
/**
* {@inheritDoc}
*/
@@ -61,11 +65,11 @@
// first configure dojo, has to happen before package include
StringBuffer str = new StringBuffer("<script type=\"text/javascript\">");
str.append("djConfig = { isDebug: ").append(_debug).append(",")
- .append(" debugContainerId:'debug',")
+ .append(" debugContainerId:'").append(_debugContainerId).append("',")
.append(" baseRelativePath:\"")
.append(_assetService.getLink(true,
_dojoPath.getResourceLocation().getPath()).getAbsoluteURL())
- .append("\", preventBackButtonFix: false, parseWidgets: false };")
+ .append("\", preventBackButtonFix: false, parseWidgets:").append(_parseWidgets).append("}")
.append(" </script>\n\n ");
// include the core dojo.js package
@@ -121,6 +125,29 @@
_debug = debug;
}
+ /**
+ * Sets the html element node id of the element you would like all browser
+ * debug content to go to.
+ *
+ * @param debugContainerId the debugContainerId to set
+ */
+ public void setDebugContainerId(String debugContainerId)
+ {
+ _debugContainerId = debugContainerId;
+ }
+
+ /**
+ * Tells dojo whether or not to parse widgets by traversing the entire
+ * dom node of your document. It is highly reccomended that you keep this
+ * at its default value of false.
+ *
+ * @param parseWidgets the parseWidgets to set
+ */
+ public void setParseWidgets(boolean parseWidgets)
+ {
+ _parseWidgets = parseWidgets;
+ }
+
/**
* Sets a valid path to the base dojo javascript installation
* directory.
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc Mon Aug 14 18:42:31 2006
@@ -1,170 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2004, 2005 The Apache Software Foundation
-
- Licensed 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.
+ Copyright 2004, 2005 The Apache Software Foundation
+
+ Licensed 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.
-->
<!DOCTYPE component-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
-
-<component-specification class="org.apache.tapestry.html.Shell" allow-informal-parameters="no">
-
- <description>
- Provides the outer tags in an HTML page: <html>, <head> and <title>.
- </description>
-
- <parameter name="title"
- required="yes">
- <description>
- The title for the page.
- </description>
- </parameter>
-
- <parameter
- name="raw"
- default-value="false">
- <description>
- If false (the default), then HTML characters in the title are escaped. If
- true, then value is emitted exactly as is.
- </description>
- </parameter>
+<component-specification class="org.apache.tapestry.html.Shell" allow-informal-parameters="no">
- <parameter name="stylesheet">
<description>
- If specified, provides an external stylesheet for the page.
+ Provides the outer tags in an HTML page: <html>, <head> and <title>.
</description>
- </parameter>
-
- <parameter name="stylesheets">
- <description>
- Array or collection of stylesheet assets.
- </description>
- </parameter>
-
- <parameter name="doctype"
- default-value='literal:HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"'>
- <description>
- Used to specify the full definition of the DOCTYPE element in the response page,
- for example 'math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd"'
-
- The default value is for the HTML 4.01 Transitional DTD.
-
- The list of currently valid DOCTYPE settings can be found here:
- http://www.w3.org/QA/2002/04/valid-dtd-list.html
- If the parameter is null or empty, no DOCTYPE tag will be rendered
- </description>
- </parameter>
-
- <parameter
- name="renderContentType"
- default-value="true">
- <description>
- Determines whether to render an http-equiv element with the Content Type of this response.
- </description>
- </parameter>
-
- <parameter
- name="refresh">
- <description>
- If specified, the page will refresh itself after the specified delay (in seconds).
- </description>
- </parameter>
-
- <parameter
- name="delegate">
- <description>
- If specified, the delegate is rendered before the close of the <head>
- tag (typically used to provide <meta> tags).
- </description>
- </parameter>
-
- <parameter name="renderBaseTag" default-value="true" >
- <description>
- Specifies whether or not to render the html basetag element in the document
- head.
- </description>
- </parameter>
-
- <parameter name="disableCaching" default-value="false" >
- <description>
- If set, causes a META tag to be written with a value of no-cache to prevent browser caching of
- whichever page is rendered.
- </description>
- </parameter>
-
- <parameter name="ajaxDelegate"
- default-value="bean:coreAjaxDelegate" >
- <description>
- If specified, allows for the default ajaxDelegate that renders the dojo script
- includes to be overriden.
- </description>
- </parameter>
-
- <parameter name="browserLogLevel" default-value="literal:WARNING">
- <description>
- Sets the default browser based log level. Default value is INFO. Uses
- the dojo.logging API.
- </description>
- </parameter>
-
- <parameter name="debugEnabled" default-value="ognl:true">
- <description>
- Allows turning browser debug logging statements on/off.
- </description>
- </parameter>
-
- <parameter name="tapestrySource"
- default-value="asset:defaultTapestrySource" >
- <description>
- If specified, allows for the default tapestry source included to be overriden.
- </description>
- </parameter>
-
- <parameter name="dojoSource"
- default-value="asset:defaultDojoSource" >
- <description>
- If specified, allows for the default dojo source included to be overriden.
- </description>
- </parameter>
-
- <parameter name="dojoPath"
- default-value="asset:defaultDojoPath" >
- <description>
- Specifies the default path to the root dojo folder, not the dojo.js file itself. This
- is used by the djConfig.baseRelativePath javascript configuration variable in dojo.
- </description>
- </parameter>
-
- <inject property="valueConverter" object="service:tapestry.coerce.ValueConverter"/>
- <inject property="pageService" object="engine-service:page"/>
- <inject property="applicationSpecification" object="infrastructure:applicationSpecification"/>
- <inject property="baseTagWriter" object="service:tapestry.url.BaseTagWriter"/>
- <inject property="assetService" object="service:tapestry.services.Asset"/>
-
- <bean name="coreAjaxDelegate" class="org.apache.tapestry.dojo.AjaxShellDelegate">
- <set name="dojoSource" value="dojoSource" />
- <set name="assetService" value="assetService" />
- <set name="dojoPath" value="dojoPath" />
- <set name="tapestrySource" value="tapestrySource" />
- <set name="logLevel" value="browserLogLevel" />
- <set name="debug" value="debugEnabled" />
- </bean>
-
- <asset name="defaultDojoSource" path="classpath:/dojo/dojo.js" />
- <asset name="defaultDojoPath" path="classpath:/dojo/" />
- <asset name="defaultTapestrySource" path="classpath:/tapestry/core.js" />
+ <parameter name="title" required="yes">
+ <description>The title for the page.</description>
+ </parameter>
+
+ <parameter name="raw" default-value="false">
+ <description>
+ If false (the default), then HTML characters in the title are escaped. If true, then
+ value is emitted exactly as is.
+ </description>
+ </parameter>
+
+
+ <parameter name="stylesheet">
+ <description>If specified, provides an external stylesheet for the page.</description>
+ </parameter>
+
+ <parameter name="stylesheets">
+ <description>Array or collection of stylesheet assets.</description>
+ </parameter>
+
+ <parameter name="doctype"
+ default-value='literal:HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"'>
+ <description>
+ Used to specify the full definition of the DOCTYPE element in the response page, for
+ example 'math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd"'
+
+ The default value is for the HTML 4.01 Transitional DTD.
+
+ The list of currently valid DOCTYPE settings can be found here:
+ http://www.w3.org/QA/2002/04/valid-dtd-list.html
+
+ If the parameter is null or empty, no DOCTYPE tag will be rendered
+ </description>
+ </parameter>
+
+ <parameter name="renderContentType" default-value="true">
+ <description>
+ Determines whether to render an http-equiv element with the Content Type of this
+ response.
+ </description>
+ </parameter>
+
+ <parameter name="refresh">
+ <description>
+ If specified, the page will refresh itself after the specified delay (in seconds).
+ </description>
+ </parameter>
+
+ <parameter name="delegate">
+ <description>
+ If specified, the delegate is rendered before the close of the <head> tag
+ (typically used to provide <meta> tags).
+ </description>
+ </parameter>
+
+ <parameter name="renderBaseTag" default-value="true">
+ <description>
+ Specifies whether or not to render the html basetag element in the document head.
+ </description>
+ </parameter>
+
+ <parameter name="disableCaching" default-value="false">
+ <description>
+ If set, causes a META tag to be written with a value of no-cache to prevent browser
+ caching of whichever page is rendered.
+ </description>
+ </parameter>
+
+ <parameter name="ajaxDelegate" default-value="bean:coreAjaxDelegate">
+ <description>
+ If specified, allows for the default ajaxDelegate that renders the dojo script includes
+ to be overriden.
+ </description>
+ </parameter>
+
+ <parameter name="browserLogLevel" default-value="literal:WARNING">
+ <description>
+ Sets the default browser based log level. Default value is INFO. Uses the dojo.logging
+ API.
+ </description>
+ </parameter>
+
+ <parameter name="debugEnabled" default-value="ognl:true">
+ <description>Allows turning browser debug logging statements on/off.</description>
+ </parameter>
+
+ <parameter name="debugContainerId" default-value="literal:debug">
+ <description>
+ Sets the html element node id of the element you would like all browser debug content to
+ go to, if you have logging turned on.
+ </description>
+ </parameter>
+
+ <parameter name="parseWidgets" default-value="ognl:false">
+ <description>
+ Tells dojo whether or not to parse widgets by traversing the entire dom node of your
+ document. It is highly reccomended that you keep this at its default value of false.
+ </description>
+ </parameter>
+
+ <parameter name="tapestrySource" default-value="asset:defaultTapestrySource">
+ <description>
+ If specified, allows for the default tapestry source included to be overriden.
+ </description>
+ </parameter>
+
+ <parameter name="dojoSource" default-value="asset:defaultDojoSource">
+ <description>
+ If specified, allows for the default dojo source included to be overriden.
+ </description>
+ </parameter>
+
+ <parameter name="dojoPath" default-value="asset:defaultDojoPath">
+ <description>
+ Specifies the default path to the root dojo folder, not the dojo.js file itself. This is
+ used by the djConfig.baseRelativePath javascript configuration variable in dojo.
+ </description>
+ </parameter>
+
+ <inject property="valueConverter" object="service:tapestry.coerce.ValueConverter" />
+ <inject property="pageService" object="engine-service:page" />
+ <inject property="applicationSpecification" object="infrastructure:applicationSpecification" />
+ <inject property="baseTagWriter" object="service:tapestry.url.BaseTagWriter" />
+ <inject property="assetService" object="service:tapestry.services.Asset" />
+
+ <bean name="coreAjaxDelegate" class="org.apache.tapestry.dojo.AjaxShellDelegate">
+ <set name="dojoSource" value="dojoSource" />
+ <set name="assetService" value="assetService" />
+ <set name="dojoPath" value="dojoPath" />
+ <set name="tapestrySource" value="tapestrySource" />
+ <set name="logLevel" value="browserLogLevel" />
+ <set name="debug" value="debugEnabled" />
+ <set name="debugContainerId" value="debugContainerId" />
+ <set name="parseWidgets" value="parseWidgets" />
+ </bean>
+
+ <asset name="defaultDojoSource" path="classpath:/dojo/dojo.js" />
+ <asset name="defaultDojoPath" path="classpath:/dojo/" />
+ <asset name="defaultTapestrySource" path="classpath:/tapestry/core.js" />
</component-specification>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java Mon Aug 14 18:42:31 2006
@@ -127,8 +127,11 @@
*/
protected void parseParameters(IRequestCycle cycle)
{
- Object[] updateParts = cycle
- .getParameters(ServiceConstants.UPDATE_PARTS);
+ Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS);
+
+ if (updateParts == null)
+ return;
+
for(int i = 0; i < updateParts.length; i++)
_parts.add(updateParts[i].toString());
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/ServletWebRequest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/ServletWebRequest.java?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/ServletWebRequest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/ServletWebRequest.java Mon Aug 14 18:42:31 2006
@@ -49,7 +49,7 @@
{
Defense.notNull(request, "request");
Defense.notNull(response, "response");
-
+
_servletRequest = request;
_servletResponse = response;
}
@@ -218,5 +218,10 @@
public boolean isUserInRole(String role)
{
return _servletRequest.isUserInRole(role);
+ }
+
+ public boolean isSecure()
+ {
+ return _servletRequest.isSecure();
}
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java Mon Aug 14 18:42:31 2006
@@ -192,4 +192,12 @@
* false if the user has not been authenticated.
*/
boolean isUserInRole(String role);
+
+ /**
+ * Taken from {@link HttpServletWebRequest}. Indicates if this request is coming in on
+ * a SSL/secure connection.
+ *
+ * @return True if secure, false otherwise.
+ */
+ boolean isSecure();
}
Modified: tapestry/tapestry4/trunk/tapestry-portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java?rev=431480&r1=431479&r2=431480&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java Mon Aug 14 18:42:31 2006
@@ -176,4 +176,9 @@
{
return _portletRequest.isUserInRole(role);
}
+
+ public boolean isSecure()
+ {
+ return _portletRequest.isSecure();
+ }
}