@Test(groups = "fast") public void testGetFindViewAttempts() { String urlBinding = "/account/ViewAccount.action"; List<String> viewAttempts = this.resolver.getFindViewAttempts(urlBinding); Assert.assertEquals(viewAttempts.size(), 3); Assert.assertEquals(viewAttempts.get(0), "/account/ViewAccount.jsp"); Assert.assertEquals(viewAttempts.get(1), "/account/viewAccount.jsp"); Assert.assertEquals(viewAttempts.get(2), "/account/view_account.jsp"); }
protected List<String> getFindViewAttempts(String urlBinding) { List<String> attempts = new ArrayList<String>(3); int lastPeriod = urlBinding.lastIndexOf('.'); String path = urlBinding.substring(0, urlBinding.lastIndexOf("/") + 1); String name = (lastPeriod >= path.length()) ? urlBinding.substring(path.length(), lastPeriod) : urlBinding.substring(path.length()); if (name.length() > 0) { attempts.add(path + name + ".jsp"); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); attempts.add(path + name + ".jsp"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < name.length(); ++i) { char ch = name.charAt(i); if (Character.isUpperCase(ch)) { builder.append("_"); builder.append(Character.toLowerCase(ch)); } else { builder.append(ch); } } attempts.add(path + builder.toString() + ".jsp"); } return attempts; }
NameBasedActionResolver extends AnnotatedClassActionResolver { protected List<String> getFindViewAttempts(String urlBinding) { List<String> attempts = new ArrayList<String>(3); int lastPeriod = urlBinding.lastIndexOf('.'); String path = urlBinding.substring(0, urlBinding.lastIndexOf("/") + 1); String name = (lastPeriod >= path.length()) ? urlBinding.substring(path.length(), lastPeriod) : urlBinding.substring(path.length()); if (name.length() > 0) { attempts.add(path + name + ".jsp"); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); attempts.add(path + name + ".jsp"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < name.length(); ++i) { char ch = name.charAt(i); if (Character.isUpperCase(ch)) { builder.append("_"); builder.append(Character.toLowerCase(ch)); } else { builder.append(ch); } } attempts.add(path + builder.toString() + ".jsp"); } return attempts; } }
NameBasedActionResolver extends AnnotatedClassActionResolver { protected List<String> getFindViewAttempts(String urlBinding) { List<String> attempts = new ArrayList<String>(3); int lastPeriod = urlBinding.lastIndexOf('.'); String path = urlBinding.substring(0, urlBinding.lastIndexOf("/") + 1); String name = (lastPeriod >= path.length()) ? urlBinding.substring(path.length(), lastPeriod) : urlBinding.substring(path.length()); if (name.length() > 0) { attempts.add(path + name + ".jsp"); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); attempts.add(path + name + ".jsp"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < name.length(); ++i) { char ch = name.charAt(i); if (Character.isUpperCase(ch)) { builder.append("_"); builder.append(Character.toLowerCase(ch)); } else { builder.append(ch); } } attempts.add(path + builder.toString() + ".jsp"); } return attempts; }  }
NameBasedActionResolver extends AnnotatedClassActionResolver { protected List<String> getFindViewAttempts(String urlBinding) { List<String> attempts = new ArrayList<String>(3); int lastPeriod = urlBinding.lastIndexOf('.'); String path = urlBinding.substring(0, urlBinding.lastIndexOf("/") + 1); String name = (lastPeriod >= path.length()) ? urlBinding.substring(path.length(), lastPeriod) : urlBinding.substring(path.length()); if (name.length() > 0) { attempts.add(path + name + ".jsp"); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); attempts.add(path + name + ".jsp"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < name.length(); ++i) { char ch = name.charAt(i); if (Character.isUpperCase(ch)) { builder.append("_"); builder.append(Character.toLowerCase(ch)); } else { builder.append(ch); } } attempts.add(path + builder.toString() + ".jsp"); } return attempts; }  @Override void init(Configuration configuration); @Override String getUrlBinding(Class<? extends ActionBean> clazz); @Override String getHandledEvent(Method handler); static boolean isAsyncEventHandler(Method handler); @Override ActionBean getActionBean(ActionBeanContext context,
            String urlBinding); }
NameBasedActionResolver extends AnnotatedClassActionResolver { protected List<String> getFindViewAttempts(String urlBinding) { List<String> attempts = new ArrayList<String>(3); int lastPeriod = urlBinding.lastIndexOf('.'); String path = urlBinding.substring(0, urlBinding.lastIndexOf("/") + 1); String name = (lastPeriod >= path.length()) ? urlBinding.substring(path.length(), lastPeriod) : urlBinding.substring(path.length()); if (name.length() > 0) { attempts.add(path + name + ".jsp"); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); attempts.add(path + name + ".jsp"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < name.length(); ++i) { char ch = name.charAt(i); if (Character.isUpperCase(ch)) { builder.append("_"); builder.append(Character.toLowerCase(ch)); } else { builder.append(ch); } } attempts.add(path + builder.toString() + ".jsp"); } return attempts; }  @Override void init(Configuration configuration); @Override String getUrlBinding(Class<? extends ActionBean> clazz); @Override String getHandledEvent(Method handler); static boolean isAsyncEventHandler(Method handler); @Override ActionBean getActionBean(ActionBeanContext context,
            String urlBinding); static final Set<String> BASE_PACKAGES; static final String DEFAULT_BINDING_SUFFIX; static final List<String> DEFAULT_ACTION_BEAN_SUFFIXES; }