*/
public class ConnectionTestController extends ContextHandlerController {
protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception {
String resourceName = ServletRequestUtils.getStringParameter(request, "resource");
DataSource dataSource = null;
try {
dataSource = getContainerWrapper().getResourceResolver().lookupDataSource(context, resourceName);
} catch (NamingException e) {
request.setAttribute("errorMessage", getMessageSourceAccessor().getMessage("probe.src.dataSourceTest.resource.lookup.failure", new Object[]{resourceName}));
}
if (dataSource == null) {
request.setAttribute("errorMessage", getMessageSourceAccessor().getMessage("probe.src.dataSourceTest.resource.lookup.failure", new Object[]{resourceName}));
} else {
try {
// TODO: use Spring's jdbc template?
Connection conn = dataSource.getConnection();
try {
DatabaseMetaData md = conn.getMetaData();
List dbMetaData = new ArrayList();