You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2006/03/31 21:12:05 UTC
svn commit: r390477 - in /beehive/trunk/netui:
src/compiler-core/org/apache/beehive/netui/compiler/grammar/
test/src/compilerTests/testsuite/Jira1090/
test/src/compilerTests/testsuite/Jira1090/Jira1090/
test/src/compilerTests/testsuite/Jira1090/Jira109...
Author: crogers
Date: Fri Mar 31 11:12:02 2006
New Revision: 390477
URL: http://svn.apache.org/viewcvs?rev=390477&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-1090
NetUI page flow compiler's WebappPathType.checkRelativePath() now handles forward paths to a JPF that begin with "./". Also added a new compiler test. Without the fix, the compiler test would have warnings.
tests: bvt in netui (WinXP)
Added:
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/Controller.java (with props)
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/index.jsp (with props)
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/Controller.java (with props)
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/index.jsp (with props)
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090-subdir.expected
beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090.expected
Modified:
beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathType.java?rev=390477&r1=390476&r2=390477&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathType.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/WebappPathType.java Fri Mar 31 11:12:02 2006
@@ -196,11 +196,21 @@
{
String className = filePath.substring( 0, filePath.length() - JPF_FILE_EXTENSION_DOT.length() );
String pkg = outerClass.getPackage().getQualifiedName();
- while ( className.startsWith( "../" ) && className.length() > 3 )
- {
- className = className.substring( 3 );
- int lastDot = pkg.lastIndexOf( '.' );
- pkg = lastDot != -1 ? pkg.substring( 0, lastDot ) : "";
+
+ // try to normalize the path
+ boolean normalized = className.charAt(0) != '.';
+ while (!normalized) {
+ if (className.startsWith("../") && className.length() > 3) {
+ className = className.substring( 3 );
+ int lastDot = pkg.lastIndexOf( '.' );
+ pkg = lastDot != -1 ? pkg.substring( 0, lastDot ) : "";
+ }
+ else if (className.startsWith("./") && className.length() > 2) {
+ className = className.substring( 2 );
+ }
+ else {
+ normalized = true;
+ }
}
className = ( pkg.length() > 0 ? pkg + '.' : "" ) + className.replace( '/', '.' );
TypeDeclaration type = env.getTypeDeclaration( className );
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/Controller.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/Controller.java?rev=390477&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/Controller.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/Controller.java Fri Mar 31 11:12:02 2006
@@ -0,0 +1,63 @@
+package Jira1090;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import java.io.Serializable;
+
+@Jpf.Controller(
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class Controller extends PageFlowController
+{
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "aaa",
+ path = "./subdir/Controller.jpf")
+ })
+ public Forward aaa() {
+ Forward fwd = new Forward("aaa");
+ fwd.addActionOutput("name", "aaa");
+ return fwd;
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "bbb",
+ path = "../Jira1090/subdir/Controller.jpf")
+ })
+ public Forward bbb() {
+ Forward fwd = new Forward("bbb");
+ fwd.addActionOutput("name", "bbb");
+ return fwd;
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "ccc",
+ path = ".././Jira1090/subdir/Controller.jpf")
+ })
+ public Forward ccc() {
+ Forward fwd = new Forward("ccc");
+ fwd.addActionOutput("name", "ccc");
+ return fwd;
+ }
+
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "ddd",
+ path = "/Jira1090/subdir/Controller.jpf")
+ })
+ public Forward ddd() {
+ Forward fwd = new Forward("ddd");
+ fwd.addActionOutput("name", "ddd");
+ return fwd;
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/index.jsp?rev=390477&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/index.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/index.jsp Fri Mar 31 11:12:02 2006
@@ -0,0 +1,19 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<html>
+<head>
+ <title>path test</title>
+</head>
+<body>
+ <h1>path test</h1>
+ <br/>
+ <netui:anchor action="aaa">aaa</netui:anchor>
+ <br/>
+ <netui:anchor action="bbb">bbb</netui:anchor>
+ <br/>
+ <netui:anchor action="ccc">ccc</netui:anchor>
+ <br/>
+ <netui:anchor action="ddd">ddd</netui:anchor>
+</body>
+</html>
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/Controller.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/Controller.java?rev=390477&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/Controller.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/Controller.java Fri Mar 31 11:12:02 2006
@@ -0,0 +1,14 @@
+package Jira1090.subdir;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class Controller extends PageFlowController
+{
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/index.jsp?rev=390477&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/index.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/index.jsp Fri Mar 31 11:12:02 2006
@@ -0,0 +1,32 @@
+<%--
+ Copyright 2006 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.
+
+ $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<netui:html>
+ <head>
+ <title>Web Application Page</title>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <p>
+ J108x/subdir/index.jsp
+ </p>
+ <br/>
+ POSTed value: <netui:span value="${pageInput.name}"/>
+ </netui:body>
+</netui:html>
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/Jira1090/subdir/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090-subdir.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090-subdir.expected?rev=390477&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090-subdir.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090-subdir.expected Fri Mar 31 11:12:02 2006
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
+<struts-config>
+ <!-- Generated from /Jira1090/subdir/Controller.java on Fri Mar 31 11:18:04 MST 2006 -->
+ <form-beans/>
+ <global-exceptions/>
+ <global-forwards>
+ <forward name="_auto" path=""/>
+ </global-forwards>
+ <action-mappings>
+ <action className="org.apache.beehive.netui.pageflow.config.PageFlowActionMapping" parameter="Jira1090.subdir.Controller" path="/begin" scope="request" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" validate="false">
+ <set-property property="readonly" value="true"/>
+ <set-property property="simpleAction" value="true"/>
+ <set-property property="defaultForward" value="_defaultForward"/>
+ <forward name="_defaultForward" path="/index.jsp"/>
+ </action>
+ </action-mappings>
+ <controller className="org.apache.beehive.netui.pageflow.config.PageFlowControllerConfig" inputForward="true" processorClass="org.apache.beehive.netui.pageflow.PageFlowRequestProcessor">
+ <set-property property="isReturnToPageDisabled" value="true"/>
+ <set-property property="isReturnToActionDisabled" value="true"/>
+ <set-property property="sharedFlows" value=""/>
+ <set-property property="controllerClass" value="Jira1090.subdir.Controller"/>
+ <set-property property="isMissingDefaultMessages" value="true"/>
+ </controller>
+ <message-resources key="_defaultMsgs" null="true" parameter="org.apache.beehive.netui.pageflow.validation.defaultMessages"/>
+</struts-config>
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090.expected?rev=390477&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira1090/expectedOutput/struts-config-Jira1090.expected Fri Mar 31 11:12:02 2006
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
+<struts-config>
+ <!-- Generated from /Jira1090/Controller.java on Fri Mar 31 11:10:00 MST 2006 -->
+ <form-beans/>
+ <global-exceptions/>
+ <global-forwards>
+ <forward name="_auto" path=""/>
+ </global-forwards>
+ <action-mappings>
+ <action parameter="Jira1090.Controller" path="/aaa" scope="request" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" validate="false">
+ <forward name="aaa" path="/./subdir/Controller.jpf"/>
+ </action>
+ <action parameter="Jira1090.Controller" path="/bbb" scope="request" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" validate="false">
+ <forward name="bbb" path="/../Jira1090/subdir/Controller.jpf"/>
+ </action>
+ <action className="org.apache.beehive.netui.pageflow.config.PageFlowActionMapping" parameter="Jira1090.Controller" path="/begin" scope="request" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" validate="false">
+ <set-property property="readonly" value="true"/>
+ <set-property property="simpleAction" value="true"/>
+ <set-property property="defaultForward" value="_defaultForward"/>
+ <forward name="_defaultForward" path="/index.jsp"/>
+ </action>
+ <action parameter="Jira1090.Controller" path="/ccc" scope="request" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" validate="false">
+ <forward name="ccc" path="/.././Jira1090/subdir/Controller.jpf"/>
+ </action>
+ <action parameter="Jira1090.Controller" path="/ddd" scope="request" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" validate="false">
+ <forward contextRelative="true" name="ddd" path="/Jira1090/subdir/Controller.jpf"/>
+ </action>
+ </action-mappings>
+ <controller className="org.apache.beehive.netui.pageflow.config.PageFlowControllerConfig" inputForward="true" processorClass="org.apache.beehive.netui.pageflow.PageFlowRequestProcessor">
+ <set-property property="isReturnToPageDisabled" value="true"/>
+ <set-property property="isReturnToActionDisabled" value="true"/>
+ <set-property property="sharedFlows" value=""/>
+ <set-property property="controllerClass" value="Jira1090.Controller"/>
+ <set-property property="isMissingDefaultMessages" value="true"/>
+ </controller>
+ <message-resources key="_defaultMsgs" null="true" parameter="org.apache.beehive.netui.pageflow.validation.defaultMessages"/>
+</struts-config>