mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-1353 First pass on wildcard refactoring.
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@428424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package mailreader2;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* When implemented, allow guest to change password,
|
||||
* given correct credentials.
|
||||
* </p>
|
||||
*/
|
||||
public class ChangePassword extends MailreaderSupport {
|
||||
}
|
||||
@@ -130,6 +130,14 @@ public final class Constants {
|
||||
*/
|
||||
public static final String PASSWORD_MISMATCH_FIELD = "password";
|
||||
|
||||
/**
|
||||
* <p/>
|
||||
* A static message in case message resource is not loaded.
|
||||
* </p>
|
||||
*/
|
||||
public static final String ERROR_INVALID_WORKFLOW =
|
||||
"ERROR: Action is being executed out of sequence!";
|
||||
|
||||
// ---- Log Messages ----
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package mailreader2;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Provide access to MailreaderSupport properties.
|
||||
* </p>
|
||||
*/
|
||||
public class MainMenu extends MailreaderSupport {
|
||||
}
|
||||
@@ -16,7 +16,11 @@ public final class Create extends Update {
|
||||
// trust but verify
|
||||
boolean creating = Constants.CREATE.equals(getTask());
|
||||
creating = creating && isCreating();
|
||||
if (!creating) return ERROR;
|
||||
if (!creating) {
|
||||
addActionError("registration/Create: ");
|
||||
addActionError(Constants.ERROR_INVALID_WORKFLOW);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
User user = findUser(getUsername(), getPassword());
|
||||
boolean haveUser = (user != null);
|
||||
|
||||
@@ -19,7 +19,11 @@ public class Update extends Support {
|
||||
|
||||
boolean creating = Constants.CREATE.equals(getTask());
|
||||
creating = creating && isCreating(); // trust but verify
|
||||
if (creating) return ERROR;
|
||||
if (creating) {
|
||||
addActionError("registration/Update: ");
|
||||
addActionError(Constants.ERROR_INVALID_WORKFLOW);
|
||||
return ERROR;
|
||||
}
|
||||
// FIXME: Any way to call the RegisrationSave validators from here?
|
||||
String newPassword = fixNull(getPassword());
|
||||
String confirmPassword = fixNull(getPassword2());
|
||||
|
||||
@@ -2,6 +2,7 @@ package mailreader2.subscription;
|
||||
|
||||
import com.opensymphony.xwork2.Preparable;
|
||||
import mailreader2.MailreaderSupport;
|
||||
import mailreader2.Constants;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -56,6 +57,8 @@ public class Support extends MailreaderSupport
|
||||
sub = findSubscription();
|
||||
|
||||
if (sub == null) {
|
||||
addActionError("find (Subscription): ");
|
||||
addActionError(Constants.ERROR_INVALID_WORKFLOW);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,66 +56,32 @@
|
||||
result="expired"/>
|
||||
</global-exception-mappings>
|
||||
|
||||
<!--
|
||||
<action name="*" class="mailreader2.{1}">
|
||||
<result name="input">/pages/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="*/*" class="mailreader2.{1}.{2}">
|
||||
<result name="input">/pages/{1}.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
</action>
|
||||
|
||||
<action name="*/Create" class="mailreader2.{1}.Create">
|
||||
<result name="input">/pages/{1}.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="user-submit" />
|
||||
</action>
|
||||
|
||||
<action name="*/Update" class="mailreader2.{1}.Update">
|
||||
<result name="input">/pages/{1}.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="user-submit" />
|
||||
</action>
|
||||
|
||||
<action name="*/Save" class="mailreader2.{1}.Save">
|
||||
<result name="input">/pages/{1}.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="user-submit" />
|
||||
</action>
|
||||
|
||||
-->
|
||||
|
||||
<action name="ChangePassword">
|
||||
<result name="input">/pages/ChangePassword.jsp</result>
|
||||
</action>
|
||||
<!-- different result -->
|
||||
|
||||
<action name="Logoff" class="mailreader2.Logoff">
|
||||
<result type="redirect-action">Welcome</result>
|
||||
</action>
|
||||
|
||||
<action name="Logon">
|
||||
<result>/pages/Logon.jsp</result>
|
||||
<result>/pages/registration/Retrieve.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="MainMenu" class="mailreader2.MailreaderSupport">
|
||||
<result>/pages/MainMenu.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="Tour">
|
||||
<result>/pages/Tour.html</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Welcome" class="mailreader2.Welcome">
|
||||
<result>/pages/Welcome.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
<action name="subscription/Save" class="mailreader2.subscription.Save">
|
||||
<result name="input">/pages/subscription.jsp</result>
|
||||
<result type="redirect-action">registration/Input</result>
|
||||
<interceptor-ref name="user-submit"/>
|
||||
</action>
|
||||
|
||||
<action name="registration/Update" class="mailreader2.registration.Update">
|
||||
<result name="input">/pages/registration.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<!-- different security -->
|
||||
|
||||
<action name="MainMenu" class="mailreader2.MainMenu">
|
||||
<result>/pages/MainMenu.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="registration/Create" class="mailreader2.registration.Create">
|
||||
@@ -124,17 +90,62 @@
|
||||
<interceptor-ref name="guest-submit"/>
|
||||
</action>
|
||||
|
||||
<!-- different result and different security -->
|
||||
|
||||
<action name="registration/Input" class="mailreader2.registration.Input">
|
||||
<result>/pages/registration.jsp</result>
|
||||
<interceptor-ref name="guest" />
|
||||
</action>
|
||||
|
||||
<!-- different input, result, and security -->
|
||||
|
||||
<action name="registration/Retrieve" class="mailreader2.registration.Retrieve">
|
||||
<result name="input">/pages/registration/Retrieve.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="registration/Retrieve" class="mailreader2.registration.Retrieve">
|
||||
<result name="input">/pages/Logon.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<!-- different result (wild) -->
|
||||
|
||||
<action name="*/Delete" class="mailreader2.{1}.Delete">
|
||||
<result>/pages/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="*/Edit" class="mailreader2.{1}.Edit">
|
||||
<result>/pages/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="*/Input" class="mailreader2.{1}.Input">
|
||||
<result>/pages/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Why doesn't this match * -->
|
||||
<!-- Unable to instantiate Action, mailreader2.Welcome., defined for 'Welcome' in namespace '/'mailreader2.Welcome. -->
|
||||
<action name="Welcome" class="mailreader2.Welcome">
|
||||
<result>/pages/Welcome.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<!-- default wildcards -->
|
||||
|
||||
<action name="*/*" class="mailreader2.{1}.{2}">
|
||||
<result name="input">/pages/{1}.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="user-submit" />
|
||||
</action>
|
||||
|
||||
<action name="*" class="mailreader2.{1}">
|
||||
<result>/pages/{1}.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<!-- matched by wildcards
|
||||
|
||||
<action name="registration/Update" class="mailreader2.registration.Update">
|
||||
<result name="input">/pages/registration.jsp</result>
|
||||
<result type="redirect-action">mailreader2.MainMenu</result>
|
||||
</action>
|
||||
|
||||
<action name="subscription/Delete" class="mailreader2.subscription.Delete">
|
||||
<result>/pages/subscription.jsp</result>
|
||||
</action>
|
||||
@@ -155,6 +166,18 @@
|
||||
<interceptor-ref name="user-submit"/>
|
||||
</action>
|
||||
|
||||
<action name="ChangePassword" class="mailreader2.ChangePassword">
|
||||
<result>/pages/ChangePassword.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Welcome" class="mailreader2.Welcome">
|
||||
<result>/pages/Welcome.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
-->
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body onLoad="self.focus();document.registration/Update.username.focus()">
|
||||
<body onLoad="self.focus();document.form1.username.focus()">
|
||||
|
||||
<s:actionerror/>
|
||||
<s:form action="registration/Update" validate="true">
|
||||
<s:form id="form1" action="registration/Update" validate="true">
|
||||
<s:token/>
|
||||
<s:hidden name="task"/>
|
||||
<s:if test="task == 'Create'">
|
||||
|
||||
+3
-2
@@ -9,9 +9,10 @@
|
||||
type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body onLoad="self.focus();document.Retrieve.username.focus()">
|
||||
<body onLoad="self.focus();document.registration/Retrieve.username.focus()">
|
||||
|
||||
<s:actionerror/>
|
||||
<s:url id="Retrieve" action="registration/Retrieve" />
|
||||
<s:form action="registration/Retrieve" validate="true">
|
||||
<s:textfield label="%{getText('username')}" name="username"/>
|
||||
|
||||
@@ -25,6 +26,6 @@
|
||||
onclick="form.onsubmit=null"/>
|
||||
</s:form>
|
||||
|
||||
<jsp:include page="Footer.jsp"/>
|
||||
<jsp:include page="../Footer.jsp"/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,10 +17,10 @@
|
||||
type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body onLoad="self.focus();document.subscription/Save.username.focus()">
|
||||
<body onLoad="self.focus();document.form1.username.focus()">
|
||||
|
||||
<s:actionerror/>
|
||||
<s:form action="subscription/Save" validate="true">
|
||||
<s:form id="form1" action="subscription/Save" validate="true">
|
||||
<s:token/>
|
||||
<s:hidden name="task"/>
|
||||
<s:label label="%{getText('username')}" name="user.username"/>
|
||||
|
||||
Reference in New Issue
Block a user