Revision: 602
http://stripes.svn.sourceforge.net/stripes/?rev=602&view=rev
Author: bengunter
Date: 2007-08-23 16:59:50 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
Resolved STS-380: Better handling of unmapped URLs.
AnnotatedClassActionResolver throws ActionBeanNotFoundException if the
requested URL does not map to an ActionBean.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
===================================================================
---
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
2007-08-23 22:45:08 UTC (rev 601)
+++
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
2007-08-23 23:59:50 UTC (rev 602)
@@ -21,6 +21,7 @@
import net.sourceforge.stripes.action.SessionScope;
import net.sourceforge.stripes.config.BootstrapPropertyResolver;
import net.sourceforge.stripes.config.Configuration;
+import net.sourceforge.stripes.exception.ActionBeanNotFoundException;
import net.sourceforge.stripes.exception.StripesRuntimeException;
import net.sourceforge.stripes.exception.StripesServletException;
import net.sourceforge.stripes.util.Log;
@@ -291,11 +292,8 @@
ActionBean bean;
if (beanClass == null) {
- throw new StripesServletException(
- "Could not locate an ActionBean that is bound to the URL
[" + path +
- "]. Commons reasons for this include mis-matched
URLs and forgetting " +
- "to implement ActionBean in your class. Registered
ActionBeans are: " +
- UrlBindingFactory.getInstance());
+ throw new ActionBeanNotFoundException(
+ path, UrlBindingFactory.getInstance().getPathMap());
}
try {
Modified:
trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
2007-08-23 22:45:08 UTC (rev 601)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
2007-08-23 23:59:50 UTC (rev 602)
@@ -18,6 +18,7 @@
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
@@ -236,6 +237,19 @@
}
/**
+ * Get all the [EMAIL PROTECTED] ActionBean}s classes that have been found.
+ *
+ * @return an immutable collection of [EMAIL PROTECTED] ActionBean} classes
+ */
+ public HashMap<String, Class<? extends ActionBean>> getPathMap() {
+ HashMap<String, Class<? extends ActionBean>> map = new HashMap<String,
Class<? extends ActionBean>>();
+ for (Entry<String, UrlBinding> entry : pathCache.entrySet()) {
+ map.put(entry.getKey(), entry.getValue().getBeanType());
+ }
+ return map;
+ }
+
+ /**
* Map an [EMAIL PROTECTED] ActionBean} to a URL.
*
* @param beanType the [EMAIL PROTECTED] ActionBean} class
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development