Hi all,
I'm having big trouble while trying to acces to the parameters values.
I'm simply trying to retrieve a parameter value from my interceptor class.
The Action class that is intercepted implements the ParameterAware
interface and has getter and setter method
related to parameters attribute which is a Map.
Here is the sample code.
public String intercept(ActionInvocation invocation) throws Exception
{
ActionSupport action = (ActionSupport)
invocation.getAction();
Map session =
invocation.getInvocationContext().getSession();
Map parameters =
invocation.getInvocationContext().getParameters();
String loginAttempt =
(String)parameters.get(Constants.LOGIN_ATTEMPT_KEY);
return invocation.invoke ();
}
When the line in bold is reached, I' getting a ClassCastException.
Here is an extract of the stacktrace
java.lang.ClassCastException: [Ljava.lang.String; at
com.natixis.media.interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:42)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling
Can someone tells me what I'm missing.
Thank in advance.
Meissa
L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut
etre tenu responsable de son contenu. Toute utilisation ou diffusion non
autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci
de le detruire et d'avertir l'expediteur.
Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si
necessaire
The integrity of this message cannot be guaranteed on the Internet. Natixis can
not therefore be considered responsible for the contents. Any unauthorized use
or dissemination is prohibited. If you are not the intended recipient of this
message, then please delete it and notify the sender.
Let us mind the environment : let's print our mails only when necessary.