You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/05/15 07:29:30 UTC
svn commit: r170197 [3/3] - in /incubator/beehive/trunk/netui/src:
compiler-core/org/apache/beehive/netui/compiler/grammar/
pageflow/org/apache/beehive/netui/pageflow/
pageflow/org/apache/beehive/netui/pageflow/config/
pageflow/org/apache/beehive/netui/pageflow/faces/
pageflow/org/apache/beehive/netui/pageflow/faces/internal/
pageflow/org/apache/beehive/netui/pageflow/handler/
pageflow/org/apache/beehive/netui/pageflow/interceptor/
pageflow/org/apache/beehive/netui/pageflow/interceptor/action/
pageflow/org/apache/beehive/netui/pageflow/interceptor/request/
pageflow/org/apache/beehive/netui/pageflow/internal/
pageflow/org/apache/beehive/netui/pageflow/validation/
pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/
scoping/org/apache/beehive/netui/pageflow/scoping/internal/
tags-databinding/org/apache/beehive/netui/tags/databinding/pageinput/
tags-html/org/apache/beehive/netui/tags/html/
tomcat-server/5x/org/apache/beehive/netui/tomcat/
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java Sat May 14 22:29:26 2005
@@ -22,7 +22,7 @@
/**
- * Class to handle our extensions to the Struts <form-bean> tag.
+ * Class to handle our extensions to the Struts <form-bean> element.
*/
public class PageFlowActionFormBean extends ActionFormBean
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionForward.java Sat May 14 22:29:26 2005
@@ -24,7 +24,7 @@
/**
- * Bean class to handle our extensions to the Struts <forward> tag.
+ * Bean class to handle our extensions to the Struts <forward> element.
*/
public class PageFlowActionForward extends ActionForward
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java Sat May 14 22:29:26 2005
@@ -24,8 +24,7 @@
/**
- * Bean class to handle our extensions to the Struts <action> tag.
- * @exclude
+ * Bean class to handle our extensions to the Struts <action> element.
*/
public class PageFlowActionMapping extends ActionMapping
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java Sat May 14 22:29:26 2005
@@ -26,6 +26,9 @@
import java.util.LinkedHashMap;
import java.util.Map;
+/**
+ * Bean class to handle our extensions to the Struts <controller> element.
+ */
public class PageFlowControllerConfig extends ControllerConfig
{
private static final String MEMORY_MULTIPART_HANDLER_CLASS = CommonsMultipartRequestHandler.class.getName();
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowExceptionConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowExceptionConfig.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowExceptionConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowExceptionConfig.java Sat May 14 22:29:26 2005
@@ -22,9 +22,8 @@
/**
- * Customization of the standard Struts class that corrresponds to <exception>.
- * @exclude
- */
+ * Class to handle our extensions to the Struts <exception> element.
+ */
public class PageFlowExceptionConfig extends ExceptionConfig
{
private boolean _isHandlerMethod;
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/PageFlowApplicationFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/PageFlowApplicationFactory.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/PageFlowApplicationFactory.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/PageFlowApplicationFactory.java Sat May 14 22:29:26 2005
@@ -23,7 +23,57 @@
import javax.faces.application.ApplicationFactory;
import javax.faces.application.Application;
-// TODO v1: rich needs to doc this when he gets all 10 of his fingers back
+/**
+ * JavaServer Faces application factory that enables Page Flow integration. It is activated like this in
+ * faces-config.xml:
+ * <blockquote>
+ * <code>
+ * <factory><br/>
+ * <application-factory>org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory</application-factory><br/>
+ * </factory>
+ * </code>
+ * </blockquote>
+ *
+ * JSF/Page Flow integration has the following features:
+ * <ul>
+ * <li>
+ * A JSF component like CommandLink or CommandButton can raise a Page Flow action simply by specifying the
+ * action name in its <code>action</code> attribute, like this:
+ * <blockquote>
+ * <code>
+ * <h:commandLink action="someAction" value="raise a Page Flow action"/>
+ * </code>
+ * </blockquote>
+ * The component can send a form bean to the action by adding a "submitFormBean" attribute with a binding
+ * expression that will determine the bean instance:
+ * <blockquote>
+ * <code>
+ * <h:commandLink action="someAction" value="submit a form bean to a Page Flow action"><br/>
+ * <f:attribute name="submitFormBean" value="backing.theForm"/><br/>
+ * </h:commandLink>
+ * </code>
+ * </blockquote>
+ * In the example above, the value returned from the backing bean's <code>getTheForm</code> method will be
+ * sent to the "someAction" action in the page flow.
+ * </li>
+ * <li>
+ * A {@link org.apache.beehive.netui.pageflow.FacesBackingBean} instance will be created whenever a
+ * corresponding JSF path is requested (e.g., an instance of FacesBackingBean-derived foo.MyPage will be created
+ * for the webapp-relative path "/foo/MyPage.faces"). The instance will be released (removed from the user
+ * session) when a non-matching path is requested. A faces backing bean can hold component references and
+ * event/command handlers, and it can raise actions with normal JSF command event handlers that are annotated
+ * with {@link org.apache.beehive.netui.pageflow.annotations.Jpf.CommandHandler @Jpf.CommandHandler}.
+ * The bean instance can be bound to with a JSF-style expression like <code>#{backing.myComponent}</code>.
+ * </li>
+ * <li>
+ * When a Page Flow action goes back to a JSF page through the <code>currentPage</code> or
+ * <code>previousPage</code> values for
+ * {@link org.apache.beehive.netui.pageflow.annotations.Jpf.Forward#navigateTo navigateTo}
+ * on {@link org.apache.beehive.netui.pageflow.annotations.Jpf.Forward @Jpf.Forward}, the page's backing
+ * bean and component tree are restored.
+ * </li>
+ * </ul>
+ */
public class PageFlowApplicationFactory
extends ApplicationFactory
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java Sat May 14 22:29:26 2005
@@ -35,9 +35,10 @@
import java.lang.reflect.Method;
import java.lang.reflect.Field;
-// TODO v1: rich needs to doc this when he gets all 10 of his fingers back
/**
- *
+ * Internal class used in JSF/Page Flow integration. This exists to cause form beans to be submitted to Page Flow
+ * actions raised from JSF command event handlers.
+ * @see org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
*/
public class BackingClassMethodBinding
extends MethodBinding
@@ -73,6 +74,11 @@
return _delegate.getExpressionString();
}
+ /**
+ * Before returning the result from the base MethodBinding, see if the bound method is annotated with
+ * Jpf.CommandHandler. If it is, look through the "raiseActions" annotation array for a form bean member variable
+ * associated with the action being raised. If one is found, set it in the request so it gets passed to the action.
+ */
public Object invoke( FacesContext context, Object params[] )
throws EvaluationException, MethodNotFoundException
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowActionListener.java Sat May 14 22:29:26 2005
@@ -27,6 +27,12 @@
import javax.faces.el.ValueBinding;
import javax.servlet.ServletRequest;
+/**
+ * Internal class used in JSF/Page Flow integration. This exists to pass form beans from JSF pages to Page Flow
+ * actions, and to abort event processing if {@link PageFlowNavigationHandler} forwarded to an action.
+ *
+ * @see org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
+ */
public class PageFlowActionListener
implements ActionListener
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowApplication.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowApplication.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowApplication.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowApplication.java Sat May 14 22:29:26 2005
@@ -39,7 +39,10 @@
import java.util.Iterator;
import java.util.Locale;
-// TODO v1: rich needs to doc this when he gets all 10 of his fingers back
+/**
+ * Internal class used in JSF/Page Flow integration. This is the main hook for overriding base JSF behavior.
+ * @see org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
+ */
public class PageFlowApplication
extends Application
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowNavigationHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowNavigationHandler.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowNavigationHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowNavigationHandler.java Sat May 14 22:29:26 2005
@@ -35,7 +35,11 @@
import org.apache.beehive.netui.util.logging.Logger;
-// TODO v1: rich needs to doc this when he gets all 10 of his fingers back
+/**
+ * Internal class used in JSF/Page Flow integration. This NavigationHandler raises Page Flow actions for JSF pages
+ * that are in Page Flow directories.
+ * @see org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
+ */
public class PageFlowNavigationHandler
extends NavigationHandler
{
@@ -127,6 +131,7 @@
}
}
+ // Fall back to base JSF navigation.
_baseHandler.handleNavigation( context, fromAction, outcome );
}
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java Sat May 14 22:29:26 2005
@@ -36,8 +36,19 @@
/**
- * Delegates in all cases except {@link #restoreView}, which prevents view restoration if we're in a request
- * forwarded by {@link PageFlowNavigationHandler}.
+ * Internal class used in JSF/Page Flow integration. Delegates in all cases except:
+ * <ul>
+ * <li>
+ * {@link #restoreView}, which prevents view restoration if we're in a request forwarded by
+ * {@link PageFlowNavigationHandler}.
+ * </li>
+ * <li>
+ * {@link #createView}, which integrates with the "navigateTo" feature in Page Flow to save/restore the
+ * component tree.
+ * </li>
+ * </ul>
+ *
+ * @see org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
*/
class PageFlowViewHandler
extends ViewHandler
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ActionForwardHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ActionForwardHandler.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ActionForwardHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ActionForwardHandler.java Sat May 14 22:29:26 2005
@@ -27,6 +27,9 @@
import org.apache.beehive.netui.pageflow.PageFlowStack;
import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor;
+/**
+ * Handler for action forward processing.
+ */
public interface ActionForwardHandler
extends Handler
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/FlowControllerHandlerContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/FlowControllerHandlerContext.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/FlowControllerHandlerContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/FlowControllerHandlerContext.java Sat May 14 22:29:26 2005
@@ -25,6 +25,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+/**
+ * Handler context for {@link FlowController}-related requests.
+ */
public class FlowControllerHandlerContext
extends RequestContext
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java Sat May 14 22:29:26 2005
@@ -21,6 +21,9 @@
import java.util.HashMap;
import java.io.Serializable;
+/**
+ * Class for encapsulating configuration properties associated with a {@link Handler}.
+ */
public class HandlerConfig
implements Serializable
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java Sat May 14 22:29:26 2005
@@ -36,6 +36,9 @@
import javax.servlet.ServletContext;
import java.io.Serializable;
+/**
+ * ServletContext-scoped container for various Page Flow {@link Handler} instances.
+ */
public class Handlers
implements Serializable
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/LoginHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/LoginHandler.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/LoginHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/LoginHandler.java Sat May 14 22:29:26 2005
@@ -22,7 +22,7 @@
/**
- * Handler for login/logout/roles/
+ * Handler for login/logout/roles.
*/
public interface LoginHandler
extends Handler
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java Sat May 14 22:29:26 2005
@@ -20,6 +20,9 @@
import java.util.List;
import java.util.LinkedList;
+/**
+ * Base class for all chains of {@link Interceptor}s.
+ */
public abstract class InterceptorChain
{
private LinkedList/*< Interceptor >*/ _chain = new LinkedList/*< Interceptor >*/();
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java Sat May 14 22:29:26 2005
@@ -21,6 +21,9 @@
import java.util.Map;
import java.util.HashMap;
+/**
+ * Class to hold configuration parameters for registered {@link Interceptor}s.
+ */
public class InterceptorConfig
implements Serializable
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java Sat May 14 22:29:26 2005
@@ -24,6 +24,9 @@
import java.io.Serializable;
import java.util.List;
+/**
+ * Base context for callbacks on {@link Interceptor}s.
+ */
public class InterceptorContext
implements Serializable
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorException.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorException.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorException.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorException.java Sat May 14 22:29:26 2005
@@ -17,6 +17,9 @@
*/
package org.apache.beehive.netui.pageflow.interceptor;
+/**
+ * Exception thrown during callbacks on {@link Interceptor}s.
+ */
public class InterceptorException
extends Exception
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java Sat May 14 22:29:26 2005
@@ -24,7 +24,7 @@
/**
- * Base class for page flow action interceptors. These are configured in /WEB-INF/netui-config.xml like this:
+ * Base class for page flow action interceptors. These are configured in /WEB-INF/beehive-netui-config.xml like this:
* <pre>
* <netui-config xmlns="http://beehive.apache.org/netui/2004/server/config">
* ...
@@ -53,7 +53,7 @@
*
* ...
* </netui-config>
-
+ *
* </pre>
*
* Note that a registered ActionInterceptor is created and cached as a single instance per ServletContext.
@@ -62,30 +62,111 @@
public abstract class ActionInterceptor
extends AbstractInterceptor
{
+ /**
+ * Callback invoked before the action is processed. During this method, {@link #setOverrideForward} may be called
+ * to:
+ * <ul>
+ * <li>change the destination URI and thus prevent the action from running, or,</li>
+ * <li>set the destination URI to <code>null</code> (no forwarding) and thus prevent the action from running, or,</li>
+ * <li>
+ * "inject" an entire nested page flow to run before the action is invoked. If the override forward URI
+ * is a nested page flow, then it will run until it raises one of its return actions. At that point,
+ * {@link #afterNestedIntercept} is called on <i>this interceptor</i>, which can again choose to override
+ * the forward or allow the original action to run.
+ * </li>
+ * </ul>
+ *
+ * {@link InterceptorChain#continueChain} is called to invoke the rest of the
+ * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
+ *
+ * @param context the current ActionInterceptorContext.
+ * @param chain the interceptor chain. Calling <code>continueChain</code> on this runs the rest of the interceptors.
+ */
public abstract void preAction( ActionInterceptorContext context, InterceptorChain chain )
throws InterceptorException;
+ /**
+ * Callback invoked before the action is processed. {@link #preAction} may be used instead.
+ */
public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
preAction( ( ActionInterceptorContext ) context, chain );
}
+ /**
+ * Callback invoked after the action is processed. During this method, {@link #setOverrideForward} may be called
+ * to:
+ * <ul>
+ * <li>change the destination URI and thus override the one returned from the action, or,</li>
+ * <li>set the destination URI to <code>null</code> (no forwarding).</li>
+ * </ul>
+ *
+ * {@link InterceptorChain#continueChain} is called to invoke the rest of the
+ * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
+ *
+ * @param context the current ActionInterceptorContext.
+ * @param chain the interceptor chain. Calling <code>continueChain</code> on this runs the rest of the interceptors.
+ */
public abstract void postAction( ActionInterceptorContext context, InterceptorChain chain )
throws InterceptorException;
+ /**
+ * Callback invoked after the action is processed. {@link #postAction} may be used instead.
+ */
public void postInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
postAction( ( ActionInterceptorContext ) context, chain );
}
+ /**
+ * Callback invoked after a nested page flow has been "injected" by {@link #preAction}, and before the original
+ * action has run. During this method, {@link #setOverrideForward} may be called to:
+ *
+ * <ul>
+ * <li>change the destination URI and thus prevent the action from running, or,</li>
+ * <li>set the destination URI to <code>null</code> (no forwarding) and thus prevent the action from running, or,</li>
+ * <li>
+ * "inject" an entire nested page flow to run before the action is invoked. If the override forward URI
+ * is a nested page flow, then it will run until it raises one of its return actions. At that point,
+ * {@link #afterNestedIntercept} is called on <i>this interceptor</i>, which can again choose to override
+ * the forward or allow the original action to run.
+ * </li>
+ * </ul>
+ *
+ * {@link InterceptorChain#continueChain} is called to invoke the rest of the
+ * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
+ *
+ * @param context an extension of {@link ActionInterceptorContext} which contains the return action from the
+ * injected nested page flow.
+ * @throws InterceptorException
+ */
public abstract void afterNestedIntercept( AfterNestedInterceptContext context )
throws InterceptorException;
+ /**
+ * Override the Forward, either before or after the target action is run. See {@link #preAction} and
+ * {@link #postAction} for information on how this is used.
+ *
+ * @param forward an InterceptorForward that will override the target action's forward; or <code>null</code> to
+ * cancel navigation.
+ * @param context the current ActionInterceptorContext.
+ */
protected void setOverrideForward( InterceptorForward forward, ActionInterceptorContext context )
{
context.setOverrideForward( forward, this );
}
+ /**
+ * Optional method that "wraps" the target action invocation. This is mainly useful for surrounding an action
+ * (and the rest of the interceptor chain) with try/catch/finally. This default implementation simply <i>returns</i>
+ * <code>continueChain</code> on the passed-in InterceptorChain, which allows the rest of the interceptors
+ * <i>and</i> the action to run.
+ *
+ * @param context the current ActionInterceptorContext.
+ * @param chain the interceptor chain. This chain is different from the ones passed to {@link #preAction} and
+ * {@link #postAction} in that the action invocation itself is included in it.
+ * @return the ActionForward returned by the action.
+ */
public Object wrapAction( ActionInterceptorContext context, InterceptorChain chain )
throws InterceptorException
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java Sat May 14 22:29:26 2005
@@ -39,7 +39,9 @@
import java.io.Serializable;
-
+/**
+ * Context passed to {@link ActionInterceptor} methods.
+ */
public class ActionInterceptorContext
extends RequestInterceptorContext
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/AfterNestedInterceptContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/AfterNestedInterceptContext.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/AfterNestedInterceptContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/AfterNestedInterceptContext.java Sat May 14 22:29:26 2005
@@ -23,6 +23,9 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
+/**
+ * Context passed to {@link ActionInterceptor#afterNestedIntercept}.
+ */
public class AfterNestedInterceptContext
extends ActionInterceptorContext
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/OriginalForward.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/OriginalForward.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/OriginalForward.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/OriginalForward.java Sat May 14 22:29:26 2005
@@ -27,9 +27,6 @@
import java.util.Iterator;
import java.io.Serializable;
-/**
- * @exclude
- */
class OriginalForward extends InterceptorForward
{
private Map _savedAttrs;
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java Sat May 14 22:29:26 2005
@@ -27,25 +27,48 @@
import java.io.Serializable;
+/**
+ * A request interceptor, which can run before and/or after a request. Request interceptors are configured in the
+ * <code><request-interceptors></code> element of WEB-INF/beehive-netui-config.xml.
+ */
public abstract class RequestInterceptor
extends AbstractInterceptor
{
+ /**
+ * Callback invoked before the request is processed. During this method, {@link #cancelRequest} may be called to
+ * cancel further request processing. {@link InterceptorChain#continueChain} is called to invoke the rest of the
+ * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
+ */
public abstract void preRequest( RequestInterceptorContext context, InterceptorChain chain )
throws InterceptorException;
+ /**
+ * Callback invoked before the request is processed. {@link #preRequest} may be used instead.
+ */
public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
preRequest( ( RequestInterceptorContext ) context, chain );
}
+ /**
+ * Callback invoked after the request is processed. {@link InterceptorChain#continueChain} should be called to
+ * invoke the rest of the interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
+ */
public abstract void postRequest( RequestInterceptorContext context, InterceptorChain chain )
throws InterceptorException;
+ /**
+ * Callback invoked after the request is processed. {@link #postRequest} may be used instead.
+ */
public void postInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
postRequest( ( RequestInterceptorContext ) context, chain );
}
+ /**
+ * Cancel the request. After this is called, no further processing will happen in the request.
+ * @param context the current RequestInterceptorContext.
+ */
protected void cancelRequest( RequestInterceptorContext context )
{
context.cancelRequest( this );
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java Sat May 14 22:29:26 2005
@@ -28,6 +28,9 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * Context passed to methods on {@link RequestInterceptor}.
+ */
public class RequestInterceptorContext
extends InterceptorContext
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java Sat May 14 22:29:26 2005
@@ -100,6 +100,7 @@
// Callback to the event reporter.
_eventReporter.exceptionRaised( ex, actionMapping, form, flowController, request, response );
+ long startTime = System.currentTimeMillis();
//
// Look up the ExceptionConfig that's associated with this Throwable.
@@ -168,7 +169,8 @@
ActionForward ret = invokeExceptionHandlerClass( context, ex, exceptionConfig, actionMapping, form );
// Callback to the event reporter.
- _eventReporter.exceptionHandled( ex, actionMapping, form, flowController, request, response, ret );
+ long timeTaken = System.currentTimeMillis() - startTime;
+ _eventReporter.exceptionHandled( ex, actionMapping, form, flowController, request, response, ret, timeTaken );
return ret;
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/ReturnToException.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/ReturnToException.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/ReturnToException.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/ReturnToException.java Sat May 14 22:29:26 2005
@@ -44,6 +44,10 @@
protected abstract String[] getMessageParts();
+ /**
+ * Tell whether the root cause may be session expiration in cases where the requested session ID is different than
+ * the actual session ID. In this case, the answer is <code>true</code>.
+ */
public boolean causeMayBeSessionExpiration()
{
return true;
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/validation/ValidatorRules.java Sat May 14 22:29:26 2005
@@ -25,6 +25,7 @@
import org.apache.struts.validator.Resources;
import org.apache.struts.validator.FieldChecks;
import org.apache.beehive.netui.pageflow.internal.InternalExpressionUtils;
+import org.apache.beehive.netui.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletContext;
@@ -32,11 +33,23 @@
public class ValidatorRules
extends FieldChecks
{
+ private static final Logger _log = Logger.getInstance( ValidatorRules.class );
+
+ /**
+ * Check if a given expression evaluates to <code>true</code>.
+ *
+ * @param bean the bean that validation is being performed on.
+ * @param va the <code>ValidatorAction</code> that is currently being performed.
+ * @param field the <code>Field</code> object associated with the current field being validated.
+ * @param errors the <code>ActionMessages</code> object to add errors to if any validation errors occur.
+ * @param request the current request object.
+ * @return <code>true</code> if the given expression evaluates to <code>true</code>
+ */
public static boolean validateValidWhen( Object bean, ValidatorAction va, Field field, ActionMessages errors,
HttpServletRequest request, ServletContext servletContext )
{
- String value = null;
+ String value;
if ( isString( bean ) )
{
@@ -49,10 +62,10 @@
if ( ! GenericValidator.isBlankOrNull( value ) )
{
+ String condition = field.getVarValue( "netui_validwhen" );
+
try
{
- String condition = field.getVarValue( "netui_validwhen" );
-
if ( ! InternalExpressionUtils.evaluateCondition( condition, bean, request, servletContext ) )
{
errors.add( field.getKey(), Resources.getActionError( request, va, field ) );
@@ -61,6 +74,10 @@
}
catch ( Exception e )
{
+ _log.error( "Error evaluating expression " + condition + " for ValidWhen rule on field "
+ + field.getProperty() + " on bean of type " +
+ ( bean != null ? bean.getClass().getName() : null ) );
+
errors.add( field.getKey(), Resources.getActionError( request, va, field ) );
return false;
}
@@ -70,25 +87,20 @@
}
/**
- * Checks if a fields value is within a range (min & max specified in the
- * vars attribute).
+ * Check if a field's value is within a range ("min" and "max" Long variables on the passed-in Field).
*
- * @param bean The bean validation is being performed on.
- * @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current
- * field being validated.
- * @param errors The <code>ActionMessages</code> object to add errors to if any
- * validation errors occur.
- * @param request Current request object.
- * @return True if in range, false otherwise.
+ * @param bean the bean that validation is being performed on.
+ * @param va the <code>ValidatorAction</code> that is currently being performed.
+ * @param field the <code>Field</code> object associated with the current field being validated.
+ * @param errors the <code>ActionMessages</code> object to add errors to if any validation errors occur.
+ * @param request the current request object.
+ * @return <code>true</code> if in range, false otherwise.
*/
- public static boolean validateLongRange( Object bean,
- ValidatorAction va, Field field,
- ActionMessages errors,
+ public static boolean validateLongRange( Object bean, ValidatorAction va, Field field, ActionMessages errors,
HttpServletRequest request )
{
- String value = null;
+ String value;
if ( isString( bean ) )
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/XmlHttpRequestServlet.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/XmlHttpRequestServlet.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/XmlHttpRequestServlet.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/XmlHttpRequestServlet.java Sat May 14 22:29:26 2005
@@ -34,6 +34,9 @@
import java.io.IOException;
import java.util.List;
+/**
+ * Servlet to handle XMLHttpRequests sent from pages.
+ */
public class XmlHttpRequestServlet extends HttpServlet
{
private static final Logger logger = Logger.getInstance(XmlHttpRequestServlet.class);
Modified: incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ParseUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ParseUtils.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ParseUtils.java (original)
+++ incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ParseUtils.java Sat May 14 22:29:26 2005
@@ -26,354 +26,196 @@
{
//-------------------------------------------------------------------------------------------------
// helpers to parse the query string.
- // Since we can't access weblogic libraries from the scoping jar, we'll rip off their utility classes and clone them here.
/**
- * ripped off from weblogic.utils.http.HttpParsing
* Parses an RFC1630 query string into an existing Map.
*
- * @param str Query string
- * @param res Map into which insert the values.
- * @param encoding Encoding to be used for stored Strings
+ * @param str Query string
+ * @param res Map into which insert the values.
+ * @param encoding Encoding to be used for stored Strings
*/
- public static void parseQueryString(String str, Map res, String encoding) {
-
+ public static void parseQueryString( String str, Map res, String encoding )
+ {
+
// "Within the query string, the plus sign is reserved as
// shorthand notation for a space. Therefore, real plus signs must
// be encoded. This method was used to make query URIs easier to
// pass in systems which did not allow spaces." -- RFC 1630
- //CR086518: IE doesn't trim off anchor in sendRedirected URL.
- int i = str.indexOf('#');
- if (i > 0) str = str.substring(0, i);
- StringTokenizer st = new StringTokenizer(str.replace('+', ' '), "&");
-
- while (st.hasMoreTokens()){
+ int i = str.indexOf( '#' );
+ if ( i > 0 )
+ {
+ str = str.substring( 0, i );
+ }
+ StringTokenizer st = new StringTokenizer( str.replace( '+', ' ' ), "&" );
+
+ while ( st.hasMoreTokens() )
+ {
String qp = st.nextToken();
- String[] pair = qp.split("="); // was String[] pair = StringUtils.split(qp, '=');
+ String[] pair = qp.split( "=" ); // was String[] pair = StringUtils.split(qp, '=');
//String s = unescape(pair[1], encoding);
- res.put(unescape(pair[0], encoding), unescape(pair[1], encoding));
+ res.put( unescape( pair[0], encoding ), unescape( pair[1], encoding ) );
}
}
-
+
/**
- * ripped off from weblogic.utils.http.HttpParsing
* URI-unescapes the specified string, except for +/<space>
* encoding.
*
- * @param str String to be unescaped
- * @param encoding The name of a character encoding
- * @return Unescaped string
+ * @param str String to be unescaped
+ * @param encoding The name of a character encoding
+ * @return Unescaped string
*/
- private static String unescape(String str, String encoding) {
- //CR073203: We cannot unescape '+' to space because '+' is allowed in the file name
+ private static String unescape( String str, String encoding )
+ {
+ //We cannot unescape '+' to space because '+' is allowed in the file name
//str = str.replace('+', ' ');
//if the str does not contain "%", we don't need to do anything
- if (str.indexOf('%') < 0) return str;
-
- if (encoding == null || encoding.length() == 0) encoding = WLS_DEFAULT_ENCODING;
+ if ( str.indexOf( '%' ) < 0 )
+ {
+ return str;
+ }
+
+ if ( encoding == null || encoding.length() == 0 )
+ {
+ encoding = WLS_DEFAULT_ENCODING;
+ }
- //CR075419, this is a public function. Do not assume String only contains ascii.
- // str.lenght() <= str.getBytes().length
+ // Do not assume String only contains ascii. str.length() <= str.getBytes().length
int out = 0;
-
+
byte[] strbytes = str.getBytes();
int len = strbytes.length;
-
+
boolean foundNonAscii = false;
- for (int in = 0; in < len; in++, out++) {
- if (strbytes[in] == '%' && (in + 2 < len)) {
- if (Hex.isHexChar(strbytes[in + 1]) &&
- Hex.isHexChar(strbytes[in + 2])) {
- strbytes[out] =
- (byte)((Hex.hexValueOf(strbytes[in + 1]) << 4) +
- (Hex.hexValueOf(strbytes[in + 2]) << 0));
- in += 2;
- continue;
- }
+ for ( int in = 0; in < len; in++, out++ )
+ {
+ if ( strbytes[in] == '%' && ( in + 2 < len ) )
+ {
+ if ( Hex.isHexChar( strbytes[in + 1] ) &&
+ Hex.isHexChar( strbytes[in + 2] ) )
+ {
+ strbytes[out] =
+ ( byte ) ( ( Hex.hexValueOf( strbytes[in + 1] ) << 4 ) +
+ ( Hex.hexValueOf( strbytes[in + 2] ) << 0 ) );
+ in += 2;
+ continue;
+ }
}
- // CR109216: IE takes non-ASCII URLs. We use the default encoding
+ // IE takes non-ASCII URLs. We use the default encoding
// if non-ASCII characters are contained in URLs.
- if (!foundNonAscii &&
- (strbytes[in] <= 0x1f || strbytes[in] == 0x7f)) {
- encoding = System.getProperty("file.encoding");
- foundNonAscii = true;
- }
+ if ( !foundNonAscii &&
+ ( strbytes[in] <= 0x1f || strbytes[in] == 0x7f ) )
+ {
+ encoding = System.getProperty( "file.encoding" );
+ foundNonAscii = true;
+ }
strbytes[out] = strbytes[in];
}
-
- return newString(strbytes, 0, out, encoding); // was: BytesToString.newString(...)
+
+ return newString( strbytes, 0, out, encoding ); // was: BytesToString.newString(...)
}
-
- // ripped off from weblogic.utils.http.BytesToString
- private static String newString(byte b[], int offset, int length, String enc) {
- if (is8BitUnicodeSubset(enc)) return getString(b, offset, length);
- try {
- return new String(b, offset, length, enc);
- } catch (UnsupportedEncodingException uee) {
- return getString(b, offset, length);
+
+ private static String newString( byte b[], int offset, int length, String enc )
+ {
+ if ( is8BitUnicodeSubset( enc ) )
+ {
+ return getString( b, offset, length );
+ }
+ try
+ {
+ return new String( b, offset, length, enc );
+ }
+ catch ( UnsupportedEncodingException uee )
+ {
+ return getString( b, offset, length );
}
}
-
- // ripped off from weblogic.utils.http.BytesToString
- private static boolean is8BitUnicodeSubset(String enc) {
- return enc == null || "ISO-8859-1".equalsIgnoreCase(enc) ||
- "ISO8859_1".equalsIgnoreCase(enc) || "ASCII".equalsIgnoreCase(enc);
+
+ private static boolean is8BitUnicodeSubset( String enc )
+ {
+ return enc == null || "ISO-8859-1".equalsIgnoreCase( enc ) ||
+ "ISO8859_1".equalsIgnoreCase( enc ) || "ASCII".equalsIgnoreCase( enc );
}
-
+
private static final String WLS_DEFAULT_ENCODING = "ISO-8859-1";
-
- // ripped off from weblogic.utils.StringUtils
- private static String getString(byte b[], int offset, int length) {
- try {
- return new String(b, offset, length, WLS_DEFAULT_ENCODING);
- } catch (UnsupportedEncodingException uee) {
+
+ private static String getString( byte b[], int offset, int length )
+ {
+ try
+ {
+ return new String( b, offset, length, WLS_DEFAULT_ENCODING );
+ }
+ catch ( UnsupportedEncodingException uee )
+ {
// every JVM is supposed to support ISO-8859-1
- throw new AssertionError(uee);
+ throw new AssertionError( uee );
}
}
-
- // ripped off from weblogic.utils.Hex. The class is provided in its entirety to make maintenance easier.
- static class Hex {
-
- private static final char[] HEX_CHARS =
- {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
-
+
+ static class Hex
+ {
+
// this class exists only for its static methods
- private Hex() {}
-
- /**
- * Turns array of bytes into string, representing each byte as
- * unsigned hex number.
- *
- * @param barray Array of bytes to convert to hex-string
- * @param len length to convert
- * @return Generated hex string
- */
- public static String asHex(byte barray[], int len) {
- return asHex(barray, len, true);
- }
-
- public static String asUnicode(String s) {
- String unicode = "";
- for (int i=0; i<s.length(); i++) {
- unicode += "\\u" + asHex(s.charAt(i)>>8) + asHex(s.charAt(i));
- }
- return unicode;
- }
-
- public static String asUnicode(char c) {
- StringBuffer sb = new StringBuffer();
- sb.append("\\u");
- sb.append(asHex(c>>8) + asHex(c));
- return sb.toString();
- }
-
- public static String asHex(String s, String encoding)
- throws UnsupportedEncodingException
+ private Hex()
{
- byte[] b = s.getBytes(encoding);
- return asHex(b);
- }
-
- /** Turns an array of arbitrary bytes into an array of bytes. */
- public static byte[] asHexBytes(byte[] barray, int len, boolean prefix) {
- int loopLen = Math.min(len,barray.length);
- byte[] buf;
- int j = 0;
-
- if (prefix) {
- buf = new byte[loopLen * 2 + 2];
- buf[0] = (byte)'0';
- buf[1] = (byte)'x';
- j += 2;
- } else {
- buf = new byte[loopLen * 2];
- }
-
- for (int i = 0; i < loopLen; i++) {
- buf[j++] = (byte) HEX_CHARS[(barray[i] & 0xf0) >> 4];
- buf[j++] = (byte) HEX_CHARS[(barray[i] & 0x0f) >> 0];
- }
- return buf;
}
-
- /**
- * Turns array of bytes into string, representing each byte as
- * unsigned hex number.
- *
- * @param barray Array of bytes to convert to hex-string
- * @param len length to convert
- * @param prefix whether to add '0x' prefix
- * @return Generated hex string
- */
- public static String asHex(byte barray[], int len, boolean prefix) {
- return new String(asHexBytes(barray, len, prefix), 0);
- }
-
- /**
- * Create array of bytes from ascii array of bytes, where each byte was an
- * unsigned hex number.
- *
- * @param barray Array of bytes to convert from hex-string
- * @param len length to convert
- * @return Generated ascii hex byte array
- */
- public static byte[] fromHexString(byte barray[], int len) {
-
- int i = 0;
- // skip "0x" or "0X" prefix, if any
- if (barray[0] == 0x30 && (barray[1] == 0x78 || barray[1] == 0x58)) {
- i += 2;
- len -= 2;
- }
-
- int outlen = len / 2;
- byte out[] = new byte[outlen];
-
- int j = 0;
- while (j < outlen) {
- out[j] = (byte) (((hexValueOf(barray[i]) << 4) | (hexValueOf(barray[i + 1])) ) & 0xff);
- j++;
- i += 2;
+
+ public static int hexValueOf( int c )
+ {
+ if ( c >= '0' && c <= '9' )
+ {
+ return c - '0';
+ }
+ if ( c >= 'a' && c <= 'f' )
+ {
+ return c - 'a' + 10;
+ }
+ if ( c >= 'A' && c <= 'F' )
+ {
+ return c - 'A' + 10;
}
- return out;
- }
-
- /**
- * Represents a single character (an int) as an unsigned hex number
- * in string format.
- *
- * @param b int to convert to a hex-string
- * @return Generated hex string
- */
- public static String asHex(int b) {
- char[] buf = new char[2];
- buf[0] = HEX_CHARS[(b & 0xf0) >> 4];
- buf[1] = HEX_CHARS[(b & 0x0f) >> 0];
- return new String(buf);
- }
-
- /**
- * Represents an array of bytes as an unsigned hex number
- * in string format.
- *
- * @param barray Byte array
- * @return String representation
- */
- public static String asHex(byte barray[]) {
- return asHex(barray, barray.length);
- }
-
- public static int hexValueOf( int c ) {
- if ( c >= '0' && c <= '9' ) return c - '0';
- if ( c >= 'a' && c <= 'f' ) return c - 'a' + 10;
- if ( c >= 'A' && c <= 'F' ) return c - 'A' + 10;
return 0;
}
-
-
- /**
- * Display an array of bytes in 'hex dump' format.
- *
- * @param bytes Byte array
- * @return String representation
- */
- public static String dump(byte bytes[]) {
- if (bytes == null) return "" + bytes;
- return dump(bytes, 0, bytes.length);
- }
-
- private static final int COLS_PER_ROW = 8;
- private static final int BYTES_PER_ROW = COLS_PER_ROW * 2;
-
- /**
- * Display an array of bytes in 'hex dump' format.
- *
- * @param bytes Byte array
- * @param offset offset into array to display
- * @param len length to display
- * @return String representation
- */
-
- public static String dump(byte bytes[], int offset, int len) {
- if (offset < 0) offset = 0;
-
- int end = Math.min(bytes.length, offset + len);
-
- // round starting point down to BYTES_PER_ROW boundary
- int displayStart = offset & ~(BYTES_PER_ROW - 1);
-
- // round ending point up to BYTES_PER_ROW boundary
- int displayEnd = (end + (BYTES_PER_ROW - 1)) & ~(BYTES_PER_ROW - 1);
-
- StringBuffer out = new StringBuffer();
- int count;
- int rowStart = displayStart;
- int i;
- for (i = displayStart; i < displayEnd; i++) {
- if ((i % BYTES_PER_ROW) == 0) {
- lineLabel(out, i);
- rowStart = i;
- }
- if (i < offset || i >= end) out.append(" ");
- else out.append(asHex(bytes[i]));
-
- if ((i % 2) == 1) out.append(' ');
-
- if ((i % BYTES_PER_ROW) == (BYTES_PER_ROW - 1)) {
- out.append(" ");
- for (int j = rowStart; j < rowStart + BYTES_PER_ROW; j++) {
- if (j < offset || j >= end) out.append(' ');
- else out.append(toPrint(bytes[j]));
- }
- out.append('\n');
- }
- }
- return out.toString();
- }
-
-
+
+
/**
* Test a character to see whether it is a possible hex char.
*
- * @param c char (int actually) to test. */
- public static final boolean isHexChar(int c) {
+ * @param c char (int actually) to test.
+ */
+ public static final boolean isHexChar( int c )
+ {
// trade space for speed !!!!
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'A': case 'B': case 'C': case 'D':
- case 'E': case 'F':
+ switch ( c )
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
return true;
default:
return false;
}
}
-
- private static char toPrint(byte b) {
- int i = (int) b;
- // nonprinting ASCII chars
- if (i < 32 || i > 126) return '.';
- else return (char) i;
- }
-
- private static void lineLabel(StringBuffer out, int i) {
- String istring = new Integer(i).toString();
-
- StringBuffer sb;
- if (istring.length() <= 5) {
- sb = new StringBuffer(" "); // 5 digits
- sb.insert(5 - istring.length(), istring);
- sb.setLength(5);
- } else {
- sb = new StringBuffer(istring);
- }
-
- out.append(sb);
- out.append(": ");
- }
-
+
}
}
Modified: incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java (original)
+++ incubator/beehive/trunk/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java Sat May 14 22:29:26 2005
@@ -374,7 +374,7 @@
setRequestURI( getOuterRequest().getContextPath(), forwardedURI );
}
- // CR174862 -- parse the query string and add parameters to the internal map
+ // Parse the query string and add parameters to the internal map
parseQueryParameters();
}
else
Modified: incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/pageinput/DeclarePageInput.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/pageinput/DeclarePageInput.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/pageinput/DeclarePageInput.java (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/pageinput/DeclarePageInput.java Sat May 14 22:29:26 2005
@@ -37,6 +37,8 @@
* the expected type of this variable.
* </p>
*
+ * <pre>
+ *
* @jsptagref.tagdescription <p>
* Declares variables that are passed from
* the Controller file to the JSP page.
@@ -85,10 +87,12 @@
* <netui-data:declarePageInput> tag.
* <h4>Code in the Controller file...</h4>
* <p/>
- * <pre> /**
- * * @jpf:action
- * * @jpf:forward name="simple" path="simple.jsp"
- * */
+ * <pre>
+ * @Jpf.Action(
+ * forwards={
+ * @Jpf.Forward(name="simple", path="simple.jsp")
+ * }
+ * )
* public Forward simple()
* {
* Forward f = new Forward("simple");
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java Sat May 14 22:29:26 2005
@@ -91,11 +91,12 @@
* <p>...and the <code>someAction</code> method takes a Form Bean parameter of
* type <code>SomeFormBean</code>...
*
- * <pre> /**
- * * @jpf:action
- * * @jpf:forward name="success" path="showData.jsp"
- * */
- * protected Forward someAction(<b>SomeFormBean form</b>)</pre>
+ * <pre> @Jpf.Action(
+ * forwards={
+ * @Jpf.Forward(name="success", path="showData.jsp")
+ * }
+ * )
+ * protected Forward someAction(<b>SomeFormBean form</b>)</pre>
*
* <p>...then an instance of <code>SomeFormBean</code> will carry the submitted data.
*
@@ -133,9 +134,9 @@
* <p><b>Note:</b> when the data is submitted, the data is passed as a Request-scoped Form
* Bean, *not* as the Session-scoped Form Bean used to pre-populate the fields. However, you
* may pass the data as a Page Flow-scoped Form Bean, if the annotation
- * <code>@jpf:action form="somePageFlowScopedBean"</code> is set on the receiving method.
- * For detailed information on Form Bean scopings see
- * <a href="{@docRoot}/../guide/netui/guide/conReqScopedVsPageScopedBean.html">Form Bean Scopings</a>
+ * <code>{@link org.apache.beehive.netui.pageflow.annotations.Jpf.Action @Jpf.Action}(
+ * {@link org.apache.beehive.netui.pageflow.annotations.Jpf.Action#useFormBean useFormBean}="someFormBeanMemberVariable"
+ * </code>...<code>)</code> is set on the receiving method.
*
* <p><b>Pre-populating Form Fields By Passing a Form Bean Instance to the JSP Page</b></p>
*
@@ -148,10 +149,11 @@
* Note that the Forward object returned by the method has two parameters, the String "success"
* and the pre-populated form.
*
- * <pre> /**
- * * @jpf:action
- * * @jpf:forward name="success" path="index.jsp"
- * */
+ * <pre> @Jpf.Action(
+ * forwards={
+ * @Jpf.Forward(name="success", path="index.jsp")
+ * }
+ * )
* protected Forward begin(ProcessDataForm form)
* {
* form.setAge(44);
@@ -171,10 +173,11 @@
*
* <p> Notice that the processData action method takes a parameter of
* type <code>ProcessDataForm</code>.</p>
- * <pre> /**
- * * @jpf:action
- * * @jpf:forward name="success" path="showData.jsp"
- * */
+ * <pre> @Jpf.Action(
+ * forwards={
+ * @Jpf.Forward(name="success", path="showData.jsp")
+ * }
+ * )
* protected Forward processData(ProcessDataForm form)
* {
* //
Modified: incubator/beehive/trunk/netui/src/tomcat-server/5x/org/apache/beehive/netui/tomcat/PageflowValve.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tomcat-server/5x/org/apache/beehive/netui/tomcat/PageflowValve.java?rev=170197&r1=170196&r2=170197&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/tomcat-server/5x/org/apache/beehive/netui/tomcat/PageflowValve.java (original)
+++ incubator/beehive/trunk/netui/src/tomcat-server/5x/org/apache/beehive/netui/tomcat/PageflowValve.java Sat May 14 22:29:26 2005
@@ -83,8 +83,7 @@
void login( String username, String password, HttpRequest request, HttpResponse response )
throws LoginException
{
- // note: if the login is not successful, we don't reset the current principal (if there is one),
- // this is to match the behavior of the internal weblogic classes used in the default pageflow runtime.
+ // Note: if the login is not successful, we don't reset the current principal (if there is one).
Principal principal = context.getRealm().authenticate(username, password);
if (principal != null)
{