You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Franck Lefebure <fl...@orange.gp> on 2003/05/28 23:09:44 UTC
RequestProcessor in Struts1.1RC1
Hi,
I've written this Requestprocessor subclass :
-----------------------------------
public class LogRequestProcessor extends RequestProcessor{
/** Creates a new instance of LogRequestProcessor */
public LogRequestProcessor() {
System.out.println("Instantiation du processor");
}
public boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response) {
System.out.println("Dans processPreprocess");
try {
Session sqlSession = SqlSession.connect();
WapLog wapLog = new WapLog();
wapLog.setRemoteAddr(request.getRemoteAddr());
wapLog.setRemoteHost(request.getRemoteHost());
wapLog.setQueryString(request.getQueryString());
wapLog.setRequestUrl(request.getRequestURI());
wapLog.setUserName(request.getHeader("X-Nokia-MSISDN"));
wapLog.setSessionId(request.getSession().getId());
sqlSession.save(wapLog);
sqlSession.flush();
sqlSession.close();
} catch (Exception e)
{
e.printStackTrace(System.out);
}
return true;
}
}
---------------------
Seems ok ?
In struts-config.xml I've put after </action-mappings> :
<controller
processorClass='com.orange.struts.processors.LogRequestProcessor'/>
Always ok ?
But nothing happens ?
Where am'I wrong ?
Thanks a lot
--
Franck Lefebure
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: RequestProcessor in Struts1.1RC1
Posted by Tin Pham <tt...@learn.senecac.on.ca>.
Hi,
1. Did you change your deployment descriptor, web.xml to register the
Servlet?
2.
<controller
processorClass='com.orange.struts.processors.LogRequestProcessor'/>
I don't think it make a difference, but I think you should be using double
quotes.
Everything else looks fine to me.
3.
Are you using Tiles? If so you have to extend the tiles requestProcessor.
"Franck Lefebure" <fl...@orange.gp> wrote in message
news:00e701c3255d$7664a740$d40b10ac@MSINFO76...
> Hi,
> I've written this Requestprocessor subclass :
>
> -----------------------------------
>
> public class LogRequestProcessor extends RequestProcessor{
>
> /** Creates a new instance of LogRequestProcessor */
> public LogRequestProcessor() {
> System.out.println("Instantiation du processor");
> }
>
> public boolean processPreprocess(HttpServletRequest request,
> HttpServletResponse response) {
> System.out.println("Dans processPreprocess");
> try {
> Session sqlSession = SqlSession.connect();
> WapLog wapLog = new WapLog();
> wapLog.setRemoteAddr(request.getRemoteAddr());
> wapLog.setRemoteHost(request.getRemoteHost());
> wapLog.setQueryString(request.getQueryString());
> wapLog.setRequestUrl(request.getRequestURI());
> wapLog.setUserName(request.getHeader("X-Nokia-MSISDN"));
> wapLog.setSessionId(request.getSession().getId());
> sqlSession.save(wapLog);
> sqlSession.flush();
> sqlSession.close();
> } catch (Exception e)
> {
> e.printStackTrace(System.out);
> }
> return true;
> }
> }
>
> ---------------------
> Seems ok ?
> In struts-config.xml I've put after </action-mappings> :
> <controller
> processorClass='com.orange.struts.processors.LogRequestProcessor'/>
>
> Always ok ?
>
> But nothing happens ?
> Where am'I wrong ?
>
> Thanks a lot
>
>
>
>
> --
> Franck Lefebure
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: RequestProcessor in Struts1.1RC1
Posted by Tin Pham <tt...@learn.senecac.on.ca>.
Oops, you don't need to be modifying the web.xml.. For some reason I thought
you were extending the ActionServlet.
Sorry about that.
"Franck Lefebure" <fl...@orange.gp> wrote in message
news:00e701c3255d$7664a740$d40b10ac@MSINFO76...
> Hi,
> I've written this Requestprocessor subclass :
>
> -----------------------------------
>
> public class LogRequestProcessor extends RequestProcessor{
>
> /** Creates a new instance of LogRequestProcessor */
> public LogRequestProcessor() {
> System.out.println("Instantiation du processor");
> }
>
> public boolean processPreprocess(HttpServletRequest request,
> HttpServletResponse response) {
> System.out.println("Dans processPreprocess");
> try {
> Session sqlSession = SqlSession.connect();
> WapLog wapLog = new WapLog();
> wapLog.setRemoteAddr(request.getRemoteAddr());
> wapLog.setRemoteHost(request.getRemoteHost());
> wapLog.setQueryString(request.getQueryString());
> wapLog.setRequestUrl(request.getRequestURI());
> wapLog.setUserName(request.getHeader("X-Nokia-MSISDN"));
> wapLog.setSessionId(request.getSession().getId());
> sqlSession.save(wapLog);
> sqlSession.flush();
> sqlSession.close();
> } catch (Exception e)
> {
> e.printStackTrace(System.out);
> }
> return true;
> }
> }
>
> ---------------------
> Seems ok ?
> In struts-config.xml I've put after </action-mappings> :
> <controller
> processorClass='com.orange.struts.processors.LogRequestProcessor'/>
>
> Always ok ?
>
> But nothing happens ?
> Where am'I wrong ?
>
> Thanks a lot
>
>
>
>
> --
> Franck Lefebure
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org