Author: rich
Date: Thu Oct 28 22:29:21 2004
New Revision: 55944
Added:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/WelcomeFileController.jpf
(contents, props changed)
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/index.jsp
(contents, props changed)
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/WelcomeFile.xml
(contents, props changed)
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/RequestValues.java
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/WEB-INF/web.xml
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/NonNormalizedPath.xml
Log:
Fix for http://nagoya.apache.org/jira/browse/BEEHIVE-34 : Cannot make a page
flow a welcome file
DRT: netui server (WinXP)
BB: self (linux)
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
Thu Oct 28 22:29:21 2004
@@ -534,7 +534,7 @@
ServletContext servletContext = getServletContext();
ContextCache.get( servletContext ).getReloadableClassHandler().reinit(
request );
- String modulePath = PageFlowUtils.getModulePath( request,
InternalUtils.decodeURI( request ) );
+ String modulePath = PageFlowUtils.getModulePathForRelativeURI(
InternalUtils.getDecodedServletPath( request ) );
ModuleConfig registeredApp;
//
@@ -586,14 +586,14 @@
//
SharedFlowController sf =
FlowControllerFactory.getSharedFlowForRequest(
request, response, servletContext );
- String uri = InternalUtils.decodeURI( request );
+ String relativeURI = InternalUtils.getDecodedServletPath(
request );
if ( sf != null )
{
StringBuilder sfActionURI = new StringBuilder(
sf.getModulePath() );
sfActionURI.append( '/' );
- sfActionURI.append( ServletUtils.getBaseName( uri ) );
- RequestValues.setOriginalRequestURI( request, uri );
+ sfActionURI.append( ServletUtils.getBaseName( relativeURI
) );
+ RequestValues.setOriginalServletPath( request, relativeURI
);
ForwardRedirectHandler frh = ContextCache.get(
servletContext ).getForwardRedirectHandler();
frh.forward( sfActionURI.toString(), request, response );
return;
@@ -603,7 +603,7 @@
if ( _log.isErrorEnabled() )
{
StringBuffer msg = new StringBuffer( "No module
configuration registered for " );
- msg.append( uri ).append( " (module path " ).append(
modulePath ).append( ")." );
+ msg.append( relativeURI ).append( " (module path "
).append( modulePath ).append( ")." );
_log.error( msg.toString() );
}
@@ -611,7 +611,7 @@
// If we're not in production mode, send a diagnostic on the
response; otherwise, simply send a 404.
//
InternalUtils.sendDevTimeError( "PageFlow_NoModuleConf", null,
HttpServletResponse.SC_NOT_FOUND,
- request, response,
servletContext, uri, modulePath );
+ request, response,
servletContext, relativeURI, modulePath );
}
}
}
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java
Thu Oct 28 22:29:21 2004
@@ -42,7 +42,7 @@
HttpServletResponse response,
ServletContext servletContext )
{
- String uri = PageFlowUtils.getRelativeURI( request,
InternalUtils.decodeURI( request ), null );
+ String uri = InternalUtils.getDecodedServletPath( request );
assert uri.startsWith( "/" ) : uri;
String backingClassName = FileUtils.stripFileExtension( uri.substring(
1 ).replace( '/', '.' ) );
FacesBackingBean currentBean = InternalUtils.getFacesBackingBean(
request );
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
Thu Oct 28 22:29:21 2004
@@ -56,9 +56,16 @@
public static PageFlowController getPageFlowForRequest( HttpServletRequest
request, HttpServletResponse response,
ServletContext
servletContext )
{
- return getPageFlowForURI( request, response, InternalUtils.decodeURI(
request ), servletContext );
+ return getPageFlowForRelativeURI( request, response,
InternalUtils.getDecodedServletPath( request ), servletContext );
}
+ public static PageFlowController getPageFlowForURI( HttpServletRequest
request, HttpServletResponse response,
+ String uri,
ServletContext servletContext )
+ {
+ return getPageFlowForRelativeURI( request, response,
PageFlowUtils.getRelativeURI( request, uri, null ),
+ servletContext );
+ }
+
/**
* Get the [EMAIL PROTECTED] PageFlowController} instance that should be
associated with the given URI.
* If it doesn't exist, create it. The PageFlowController stack (for
@@ -67,17 +74,17 @@
*
* @param request the current HttpServletRequest.
* @param response the current HttpServletResponse.
- * @param uri the webapp-relative URI for the page flow.
+ * @param relativeURI the webapp-relative URI for the page flow.
* @param servletContext the current ServletContext.
* @return the PageFlowController for the request, or <code>null</code> if
none was found
* and none could be created.
*/
- public static PageFlowController getPageFlowForURI( HttpServletRequest
request, HttpServletResponse response,
- String uri,
ServletContext servletContext )
+ public static PageFlowController getPageFlowForRelativeURI(
HttpServletRequest request,
+
HttpServletResponse response, String relativeURI,
+ ServletContext
servletContext )
{
PageFlowController cur = InternalUtils.getCurrentPageFlow( request,
false );
- String parentDir =
- PageFlowUtils.getModulePathForRelativeURI(
PageFlowUtils.getRelativeURI( request, uri, null ) );
+ String parentDir = PageFlowUtils.getModulePathForRelativeURI(
relativeURI );
//
// If there's no current PageFlow, or if the current
PageFlowController has a module path that
@@ -100,13 +107,13 @@
HttpServletResponse response,
ServletContext
servletContext )
{
- return getSharedFlowForURI( request, response,
InternalUtils.decodeURI( request ), servletContext );
+ return getSharedFlowForRelativeURI( request, response,
InternalUtils.getDecodedServletPath( request ), servletContext );
}
- public static SharedFlowController getSharedFlowForURI( HttpServletRequest
request, HttpServletResponse response,
- String uri,
ServletContext servletContext )
+ public static SharedFlowController getSharedFlowForRelativeURI(
HttpServletRequest request, HttpServletResponse response,
+ String
relativeURI, ServletContext servletContext )
{
- String className = InternalUtils.getSharedFlowClassNameForURI( uri,
request, servletContext );
+ String className = InternalUtils.getSharedFlowClassNameForRelativeURI(
relativeURI, request, servletContext );
if ( className == null ) return null;
SharedFlowController cur = PageFlowUtils.getSharedFlow( className,
request );
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
Thu Oct 28 22:29:21 2004
@@ -465,7 +465,7 @@
private void processInternal( HttpServletRequest request,
HttpServletResponse response )
throws IOException, ServletException
{
- String uri = PageFlowUtils.getRelativeURI( request,
InternalUtils.decodeURI( request ), null );
+ String uri = InternalUtils.getDecodedServletPath( request );
ServletContext servletContext = getServletContext();
ServerAdapter serverAdapter = ContextCache.get( servletContext
).getServerAdapter();
@@ -607,7 +607,7 @@
{
String desiredType = beginMapping.getParameter();
desiredType = desiredType.substring( desiredType.lastIndexOf(
'.' ) + 1 ) + JPF_EXTENSION;
- String requestedType = InternalUtils.decodeURI( request );
+ String requestedType = InternalUtils.getDecodedServletPath(
request );
requestedType = requestedType.substring(
requestedType.lastIndexOf( '/' ) + 1 );
if ( ! requestedType.equals( desiredType ) )
@@ -963,17 +963,17 @@
//
// originalRequestURI is the request URI we had before trying to
forward to an action in Global.app.
- String originalRequestURI = RequestValues.getOriginalRequestURI(
request );
+ String originalServletPath = RequestValues.getOriginalServletPath(
request );
- if ( originalRequestURI != null )
+ if ( originalServletPath != null )
{
- return processUnresolvedAction( path, originalRequestURI, request,
response, forwardedForm );
+ return processUnresolvedAction( path, originalServletPath,
request, response, forwardedForm );
}
else
{
if ( !trySharedFlowAction( path, request, response ) )
{
- return processUnresolvedAction( path, InternalUtils.decodeURI(
request ),
+ return processUnresolvedAction( path,
InternalUtils.getDecodedServletPath( request ),
request, response,
forwardedForm );
}
}
@@ -999,7 +999,7 @@
// Save the original request URI, so if the action fails on the
shared flow, too, then we can
// give an error message that includes *this* URI, not the shared
flow URI.
//
- RequestValues.setOriginalRequestURI( request,
InternalUtils.decodeURI( request ) );
+ RequestValues.setOriginalServletPath( request,
InternalUtils.getDecodedServletPath( request ) );
//
// Construct a URI that is [shared flow module path] + [base
action path] + [action-extension (.do)]
@@ -1025,7 +1025,7 @@
return false;
}
- protected ActionMapping processUnresolvedAction( String actionPath, String
originalRequestURI,
+ protected ActionMapping processUnresolvedAction( String actionPath, String
originalServletPath,
HttpServletRequest
request, HttpServletResponse response,
Object returningForm )
throws IOException
@@ -1046,7 +1046,7 @@
try
{
ServletContext servletContext = getServletContext();
- fc = FlowControllerFactory.getPageFlowForURI( request, response,
originalRequestURI, servletContext );
+ fc = FlowControllerFactory.getPageFlowForRelativeURI( request,
response, originalServletPath, servletContext );
if ( fc == null ) fc = PageFlowUtils.getSharedFlow( request,
servletContext );
if ( fc != null )
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
Thu Oct 28 22:29:21 2004
@@ -92,8 +92,7 @@
*/
public static String getModulePath( HttpServletRequest request )
{
- String requestURI = InternalUtils.decodeURI( request );
- return getModulePathForRelativeURI( getRelativeURI( request,
requestURI, null ) );
+ return getModulePathForRelativeURI(
InternalUtils.getDecodedServletPath( request ) );
}
/**
@@ -122,7 +121,7 @@
*/
public static final String getRelativeURI( HttpServletRequest request,
PageFlowController relativeTo )
{
- return getRelativeURI( request, InternalUtils.decodeURI( request ),
relativeTo );
+ return getRelativeURI( request, InternalUtils.getDecodedURI( request
), relativeTo );
}
/**
@@ -640,7 +639,7 @@
*/
static void setActionURI( HttpServletRequest request )
{
- request.setAttribute( ACTION_URI_ATTR, InternalUtils.decodeURI(
request ) );
+ request.setAttribute( ACTION_URI_ATTR, InternalUtils.getDecodedURI(
request ) );
}
/**
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Thu Oct 28 22:29:21 2004
@@ -414,9 +414,14 @@
ScopedServletUtils.removeScopedSessionAttr( CURRENT_SINGLETON_ATTR,
unwrappedRequest );
}
- public static String decodeURI( HttpServletRequest request )
+ public static String getDecodedURI( HttpServletRequest request )
{
- return ScopedServletUtils.decodeURI( request );
+ return request.getContextPath() + request.getServletPath(); //
TODO: is this always decoded?
+ }
+
+ public static String getDecodedServletPath( HttpServletRequest request )
+ {
+ return request.getServletPath(); // TODO: is this always decoded
under all containers?
}
public static void addActionOutputs( Map toAdd, ServletRequest request,
boolean overwrite )
@@ -814,18 +819,16 @@
public static String getSharedFlowClassName( HttpServletRequest request,
ServletContext servletContext )
{
- return getSharedFlowClassNameForURI( InternalUtils.decodeURI( request
), request, servletContext );
+ return getSharedFlowClassNameForRelativeURI( getDecodedServletPath(
request ), request, servletContext );
}
- public static String getSharedFlowClassNameForURI( String uri,
HttpServletRequest request,
- ServletContext
servletContext )
+ public static String getSharedFlowClassNameForRelativeURI( String
relativeURI, HttpServletRequest request,
+ ServletContext
servletContext )
{
String cachedInRequest = ( String ) request.getAttribute(
SHARED_FLOW_CLASSNAME_ATTR );
if ( cachedInRequest != null ) return cachedInRequest.length() > 0 ?
cachedInRequest : null;
- // TODO: must cache this
- String relativeUrl = PageFlowUtils.getRelativeURI( request, uri, null
);
- String parentDir = PageFlowUtils.getModulePathForRelativeURI(
relativeUrl );
+ String parentDir = PageFlowUtils.getModulePathForRelativeURI(
relativeURI );
String className = null;
if ( parentDir.length() > 0 )
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/RequestValues.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/RequestValues.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/RequestValues.java
Thu Oct 28 22:29:21 2004
@@ -31,7 +31,7 @@
{
private static final String FORWARDED_REQUEST_COUNT_ATTR = ATTR_PREFIX +
"forwardedRequestCount";
private static final String AVOID_DIRECT_RESPONSE_OUTPUT_ATTR =
ATTR_PREFIX + "_avoidDirectResponseOutput";
- private static final String ORIGINAL_REQUEST_URI_ATTR = ATTR_PREFIX +
"origRequestURI";
+ private static final String ORIGINAL_SERVLET_PATH_ATTR = ATTR_PREFIX +
"origServletPath";
private static final String FORWARDED_FORMBEAN_ATTR = ATTR_PREFIX +
"forwardedForm";
private static final String DEFERRED_EXCEPTION_ATTR = ATTR_PREFIX +
"deferredException";
@@ -71,14 +71,14 @@
request.setAttribute( AVOID_DIRECT_RESPONSE_OUTPUT_ATTR, Boolean.TRUE
);
}
- public static void setOriginalRequestURI( ServletRequest request, String
uri )
+ public static void setOriginalServletPath( ServletRequest request, String
servletPath )
{
- request.setAttribute( ORIGINAL_REQUEST_URI_ATTR, uri );
+ request.setAttribute( ORIGINAL_SERVLET_PATH_ATTR, servletPath );
}
- public static String getOriginalRequestURI( ServletRequest request )
+ public static String getOriginalServletPath( ServletRequest request )
{
- return ( String ) request.getAttribute( ORIGINAL_REQUEST_URI_ATTR );
+ return ( String ) request.getAttribute( ORIGINAL_SERVLET_PATH_ATTR );
}
/**
Modified:
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/PageflowTagUtils.java
Thu Oct 28 22:29:21 2004
@@ -124,7 +124,7 @@
StringBuffer value = new StringBuffer();
- String pageURI = InternalUtils.decodeURI( servletRequest );
+ String pageURI = InternalUtils.getDecodedURI( servletRequest );
int lastSlash = pageURI.lastIndexOf( '/' );
if ( lastSlash != -1 )
{
Modified:
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
Thu Oct 28 22:29:21 2004
@@ -31,10 +31,8 @@
import org.apache.log4j.Logger;
-import java.net.URLDecoder;
import java.net.URI;
import java.net.URISyntaxException;
-import java.io.UnsupportedEncodingException;
/**
@@ -49,8 +47,6 @@
static final String ATTR_PREFIX = "_netui:";
private static final String OVERRIDE_REQUEST_ATTR = ATTR_PREFIX +
"overrideRequest";
private static final String OVERRIDE_RESPONSE_ATTR = ATTR_PREFIX +
"overrideResponse";
- private static final String ORIGINAL_URI_ATTR = ATTR_PREFIX +
"originalURI";
- private static final String DECODED_URI_ATTR = ATTR_PREFIX + "decodedURI";
private static final Logger logger = Logger.getLogger(
ScopedServletUtils.class );
@@ -339,7 +335,7 @@
*/
public static final String getRelativeURI( HttpServletRequest request )
{
- return getRelativeURI( request, decodeURI( request ) );
+ return request.getServletPath(); // TODO: is this always decoded
under all containers?
}
/**
@@ -398,44 +394,6 @@
*/
public static String decodeURI( HttpServletRequest request )
{
- //
- // First see if we've cached it. But make sure it hasn't changed
(e.g. on a forwarded request).
- //
- String requestURI = request.getRequestURI();
- String originalURI = ( String ) request.getAttribute(
ORIGINAL_URI_ATTR );
- String decodedURI;
-
- if ( originalURI != null && originalURI.equals( requestURI ) )
- {
- decodedURI = ( String ) request.getAttribute( DECODED_URI_ATTR );
-
- if ( decodedURI != null )
- {
- return decodedURI;
- }
- }
-
-
- String encoding = request.getCharacterEncoding();
-
- try
- {
- if ( encoding == null )
- {
- encoding = "utf-8"; // @TODO is this a safe assumption?
- }
-
- decodedURI = URLDecoder.decode( requestURI, encoding );
- }
- catch ( UnsupportedEncodingException e )
- {
- logger.error( "unsupported encoding " + encoding + " in request "
+ requestURI, e );
- decodedURI = request.getRequestURI();
- }
-
- decodedURI = normalizeURI( decodedURI );
- request.setAttribute( ORIGINAL_URI_ATTR, requestURI );
- request.setAttribute( DECODED_URI_ATTR, decodedURI );
- return decodedURI;
+ return request.getContextPath() + request.getServletPath(); //
TODO: always decoded?
}
}
Modified:
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java
(original)
+++
incubator/beehive/branches/v1/alpha/netui/src/scoping/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java
Thu Oct 28 22:29:21 2004
@@ -35,6 +35,8 @@
import java.util.List;
import java.util.Set;
import java.util.HashSet;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import org.apache.log4j.Logger;
@@ -51,6 +53,7 @@
implements ScopedRequest
{
private String _requestURI;
+ private String _servletPath;
private String _forwardedURI;
private ScopedAttributeContainer _scopedContainer;
private List _listenScopes;
@@ -76,7 +79,7 @@
super( req );
_scopedContainer = new ScopedAttributeContainer( scopeKey );
- _requestURI = overrideRequestURI != null ? overrideRequestURI : "";
+ setRequestURI( overrideRequestURI );
_seeOuterRequestAttributes = seeOuterRequestAttributes;
if ( seeOuterRequestAttributes )
@@ -111,8 +114,43 @@
public void setRequestURI( String uri )
{
_requestURI = uri;
+
+ if ( uri == null )
+ {
+ _servletPath = null;
+ return;
+ }
+
+ //
+ // Set the servlet path (decoded)
+ //
+ assert uri.startsWith( getOuterRequest().getContextPath() ) : uri;
+ setServletPath( uri.substring(
getOuterRequest().getContextPath().length() ) );
}
-
+
+ public void setRequestURI( String contextPath, String servletPath )
+ {
+ _requestURI = contextPath + servletPath;
+ setServletPath( servletPath );
+ }
+
+ private void setServletPath( String servletPath )
+ {
+ String encoding = getCharacterEncoding();
+
+ try
+ {
+ if ( encoding == null ) encoding = "utf-8"; // TODO: is this a
safe assumption?
+ servletPath = URLDecoder.decode( servletPath, encoding );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ logger.error( "unsupported encoding " + encoding + " in request "
+ _requestURI, e );
+ }
+
+ _servletPath = ScopedServletUtils.normalizeURI( servletPath );
+ }
+
public StringBuffer getRequestURL()
{
HttpServletRequest outerRequest = getOuterRequest();
@@ -125,7 +163,7 @@
public String getServletPath()
{
- return ScopedServletUtils.getRelativeURI( this );
+ return _servletPath;
}
public String getParameter( String paramName )
@@ -325,23 +363,27 @@
public void doForward()
{
- String forwardURI = _forwardedURI;
-
- if ( forwardURI != null )
+ String forwardedURI = _forwardedURI;
+
+ if ( forwardedURI != null )
{
- if ( ! forwardURI.startsWith( "/" ) )
+ if ( ! forwardedURI.startsWith( "/" ) )
{
- logger.error( "Invalid forward URI " + forwardURI );
- _requestURI = forwardURI;
+ int lastSlash = _requestURI.lastIndexOf( '/' );
+ assert lastSlash != -1 : _requestURI;
+ setRequestURI( _requestURI.substring( 0, lastSlash + 1 ) +
forwardedURI );
}
-
- _requestURI = getOuterRequest().getContextPath() +
getForwardedURI();
+ else
+ {
+ setRequestURI( getOuterRequest().getContextPath(),
forwardedURI );
+ }
+
// CR174862 -- parse the query string and add parameters to the
internal map
parseQueryParameters();
}
else
{
- _requestURI = null;
+ setRequestURI( null );
}
}
Modified:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/WEB-INF/web.xml
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/WEB-INF/web.xml
(original)
+++
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/WEB-INF/web.xml
Thu Oct 28 22:29:21 2004
@@ -203,6 +203,7 @@
-->
<welcome-file-list>
+ <welcome-file>WelcomeFileController.jpf</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
Added:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/WelcomeFileController.jpf
==============================================================================
--- (empty file)
+++
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/WelcomeFileController.jpf
Thu Oct 28 22:29:21 2004
@@ -0,0 +1,13 @@
+package miniTests.welcomeFile;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class WelcomeFileController extends PageFlowController
+{
+}
Added:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/index.jsp
==============================================================================
--- (empty file)
+++
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/coreWeb/miniTests/welcomeFile/index.jsp
Thu Oct 28 22:29:21 2004
@@ -0,0 +1,14 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="beehive-netui-tags-html.tld" prefix="netui"%>
+
+<netui:html>
+ <body>
+
+ <h3>Welcome File</h3>
+
+ This page flow (WelcomeFileController.jpf) is registered in web.xml as a
welcome file.
+ Hitting this directory without specifying a specific file should take you
through the page flow to this page.
+ </body>
+</netui:html>
+
+
Modified:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
(original)
+++
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Thu Oct 28 22:29:21 2004
@@ -5268,6 +5268,18 @@
</features>
</test>
<test>
+ <name>WelcomeFile</name>
+ <description>Test of hitting a page flow directory, when the page
flow is registered in web.xml as a welcome-file.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>corePageFlow</category>
+ </categories>
+ <features>
+ <feature>PageFlow</feature>
+ </features>
+ </test>
+ <test>
<name>XhtmlAnchor</name>
<description>Validation of the XHTML for Anchors</description>
<webapp>coreWeb</webapp>
Modified:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/NonNormalizedPath.xml
==============================================================================
---
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/NonNormalizedPath.xml
(original)
+++
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/NonNormalizedPath.xml
Thu Oct 28 22:29:21 2004
@@ -327,13 +327,13 @@
</title>
</head>
<body>
- <a href="/coreWeb/miniTests/nonNormalizedPath/begin.do">index.jsp</a>
+ <a href="/coreWeb/miniTests/nonNormalizedPath/./begin.do">index.jsp</a>
<br>
- <a href="/coreWeb/miniTests/nonNormalizedPath/ok1.do">./index.jsp</a>
+ <a href="/coreWeb/miniTests/nonNormalizedPath/./ok1.do">./index.jsp</a>
<br>
- <a
href="/coreWeb/miniTests/nonNormalizedPath/ok2.do">../nonNormalizedPath/index.jsp</a>
+ <a
href="/coreWeb/miniTests/nonNormalizedPath/./ok2.do">../nonNormalizedPath/index.jsp</a>
<br>
- <a href="/coreWeb/miniTests/nonNormalizedPath/bad1.do">../../index.jsp
(bad)</a>
+ <a
href="/coreWeb/miniTests/nonNormalizedPath/./bad1.do">../../index.jsp (bad)</a>
</body>
</html>]]></responseBody>
@@ -559,4 +559,4 @@
<testCount>5</testCount>
<passedCount>1</passedCount>
<failedCount>4</failedCount>
-</recorderSession>
\ No newline at end of file
+</recorderSession>
Added:
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/WelcomeFile.xml
==============================================================================
--- (empty file)
+++
incubator/beehive/branches/v1/alpha/netui/test/webapps/drt/testRecorder/tests/WelcomeFile.xml
Thu Oct 28 22:29:21 2004
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+ <ses:sessionName>WelcomeFile</ses:sessionName>
+ <ses:tester>rich</ses:tester>
+ <ses:startDate>28 Oct 2004, 02:09:03.277 PM MDT</ses:startDate>
+ <ses:description>Tests hitting a page flow directory, when the page flow is
listed in web.xml as a welcome-file.</ses:description>
+ <ses:tests>
+ <ses:test>
+ <ses:testNumber>1</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/miniTests/welcomeFile/</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>3206411BE65074E30B4DE70A26BC9120</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+
<ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+
<ses:value>JSESSIONID=3206411BE65074E30B4DE70A26BC9120</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1;
rv:1.7.3) Gecko/20041001 Firefox/0.10.1</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01
Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<body>
+
+ <h3>Welcome File</h3>
+
+ This page flow (WelcomeFileController.jpf) is registered in web.xml as a
welcome file.
+ Hitting this directory without specifying a specific file should take you
through the page flow to this page.
+ </body>
+</html></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ </ses:tests>
+ <ses:endDate>28 Oct 2004, 02:09:16.265 PM MDT</ses:endDate>
+ <ses:testCount>1</ses:testCount>
+</ses:recorderSession>