You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mleneveut <ML...@abusinessware.com> on 2007/08/10 14:39:47 UTC
[S2] ExecAndWait interceptor : request.getSession() null
Hi,
I try to add the execAndWait interceptor in my application. But now the
request.getSession() returns null so my app crash in the first Action.
What did I miss ?
<interceptor name="login"
class="org.myorg.coordination.interceptor.LoginInterceptor" />
<interceptor-stack name="crmStack">
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="login"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="params">
dojo\..*
</interceptor-ref>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation"/>
<interceptor-ref name="workflow"/>
<interceptor-ref name="execAndWait">
1000
100
</interceptor-ref>
</interceptor-stack>
<default-interceptor-ref name="crmStack"/>
<global-results>
<result name="notLogged">/jsp/login.jsp</result>
<result name="functionalError">/jsp/error.jsp</result>
<result name="technicalError">/jsp/error.jsp</result>
<result name="runtimeError">/jsp/error.jsp</result>
<result name="wait">/jsp/wait.jsp</result>
</global-results>
My wait.jsp :
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>
<s:text name="title.webapp.prefix"/>
<s:text name="title.wait"/>
</title>
<meta http-equiv="Cache-Control" content="no-store"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="refresh" content="50;url=<s:url includeParams="all"
/>"/>
<link href="css/crm.css" rel="stylesheet" type="text/css">
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="middle">
<td align="center">
Please wait while we process your request.
Click <s:url includeParams= ">here if this page does not reload
automatically.
</td>
</tr>
</table>
</body>
</html>
My Generic Action :
public class CRMAction extends ActionSupport implements ServletRequestAware,
ServletResponseAware {
private HttpServletRequest request;
...
protected final void setSessionAttribute(final String key, final Object o)
{
if (o != null) {
request.getSession().setAttribute(key, o);
}
}
...
}
My called Action :
public class LoginAction extends CRMAction {
private UserVO user;
private AuthentifyUserServiceInterface authentifyUserService;
/**
* Method called after the login form's submittion.
* Authentificates the user or send an error.
* @return String the forward
*/
public String login() {
try {
user = authentifyUserService.authentifyUser(user);
if (user != null) {
setSessionAttribute(Constants.USER, user);
...
}
My login JSP submit to login_login, so calls the login method of
LoginAction. The wait.jsp is displayed, but I have a NullPointerExceptoin
when setting the user in session.
--
View this message in context: http://www.nabble.com/-S2--ExecAndWait-interceptor-%3A-request.getSession%28%29-null-tf4248436.html#a12090487
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] ExecAndWait interceptor : request.getSession() null
Posted by Igor Vlasov <vi...@mail.ru>.
public class SearchAction extends ActionSupport implements
ServletRequestAware {
protected HttpServletRequest request;
private HttpSession sess;
public String execute() throws Exception{
/*I*/ sess = request.getSession();// not NULL !!!!!
try {
// выполняется поиск и опрос всех поставщиков в пультипотоковом режиме
Thread.currentThread().sleep(6*1000);
} catch (InterruptedException ex) {
_log.error("Long search action",ex);
}
/*II*/ sess = request.getSession(); // !!! is NULL !!!!!
storeSearchParameters();
return this.SUCCESS;
}
public void setServletRequest(HttpServletRequest httpServletRequest) {
request = httpServletRequest;
}
}
I spend 3 hours before guess to move from "II" to "I"
?????
--
View this message in context: http://www.nabble.com/-S2--ExecAndWait-interceptor-%3A-request.getSession%28%29-null-tf4248436.html#a13135653
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] ExecAndWait interceptor : request.getSession() null
Posted by "jignesh(india)" <ji...@aspl.in>.
Hi,
I have faced the same problem..
But i am successfully able to crop it just by adding "basicStack"
interceptors exact before "execAndWait".
E.g:-
<interceptor-ref name="basicStack"/>
<interceptor-ref name="execAndWait"/>
Best Regards,
Jignesh
mleneveut wrote:
>
> Hi,
>
> I try to add the execAndWait interceptor in my application. But now the
> request.getSession() returns null so my app crash in the first Action.
>
> What did I miss ?
>
> <interceptor name="login"
> class="org.myorg.coordination.interceptor.LoginInterceptor" />
> <interceptor-stack name="crmStack">
> <interceptor-ref name="servletConfig"/>
> <interceptor-ref name="i18n"/>
> <interceptor-ref name="login"/>
> <interceptor-ref name="fileUpload"/>
> <interceptor-ref name="checkbox"/>
> <interceptor-ref name="staticParams"/>
> <interceptor-ref name="params">
> dojo\..*
> </interceptor-ref>
> <interceptor-ref name="conversionError"/>
> <interceptor-ref name="validation"/>
> <interceptor-ref name="workflow"/>
> <interceptor-ref name="execAndWait">
> 1000
> 100
> </interceptor-ref>
> </interceptor-stack>
> <default-interceptor-ref name="crmStack"/>
>
> <global-results>
> <result name="notLogged">/jsp/login.jsp</result>
> <result name="functionalError">/jsp/error.jsp</result>
> <result name="technicalError">/jsp/error.jsp</result>
> <result name="runtimeError">/jsp/error.jsp</result>
> <result name="wait">/jsp/wait.jsp</result>
> </global-results>
>
> My wait.jsp :
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html>
> <head>
> <title>
> <s:text name="title.webapp.prefix"/>
> <s:text name="title.wait"/>
> </title>
> <meta http-equiv="Cache-Control" content="no-store"/>
> <meta http-equiv="Pragma" content="no-cache"/>
> <meta http-equiv="Expires" content="0"/>
> <meta http-equiv="refresh" content="50;url=<s:url includeParams="all"
> />"/>
> <link href="css/crm.css" rel="stylesheet" type="text/css">
> </head>
> <body>
> <table border="0" cellspacing="0" cellpadding="0" width="100%">
> <tr valign="middle">
> <td align="center">
> Please wait while we process your request.
> Click <s:url includeParams= ">here if this page does not reload
> automatically.
> </td>
> </tr>
> </table>
> </body>
> </html>
>
> My Generic Action :
> public class CRMAction extends ActionSupport implements
> ServletRequestAware,
> ServletResponseAware {
> private HttpServletRequest request;
> ...
> protected final void setSessionAttribute(final String key, final Object
> o) {
> if (o != null) {
> request.getSession().setAttribute(key, o);
> }
> }
> ...
> }
>
> My called Action :
> public class LoginAction extends CRMAction {
> private UserVO user;
> private AuthentifyUserServiceInterface authentifyUserService;
>
> /**
> * Method called after the login form's submittion.
> * Authentificates the user or send an error.
> * @return String the forward
> */
> public String login() {
> try {
> user = authentifyUserService.authentifyUser(user);
> if (user != null) {
> setSessionAttribute(Constants.USER, user);
> ...
> }
>
> My login JSP submit to login_login, so calls the login method of
> LoginAction. The wait.jsp is displayed, but I have a NullPointerExceptoin
> when setting the user in session.
>
--
View this message in context: http://www.nabble.com/-S2--ExecAndWait-interceptor-%3A-request.getSession%28%29-null-tf4248436.html#a13130631
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org