You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chang Ming Chye <mc...@yahoo.com.sg> on 2004/04/07 03:20:56 UTC

RequestProcessor handling http requests

Hi,

How does struts handle incoming request and routes it
to the correct action?

For example, if I declare my web.xml as:

<servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>
    org.apache.struts.action.ActionServlet
  </servlet-class>
  <init-param>
    <param-name>config</param-name>
    <param-value>
      /WEB-INF/struts-config.xml
    </param-value>
  </init-param>
</servlet>

<servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
</servlet-mapping>

and in my struts-config.xml file I have the following
action declared:

<action path="/searchAction" ... >

When the http request "*/searcAction.do" is received
by the Action Servlet, how is the actual action
"/searchAction" as specified retrieved? Which method
of the RequestProcessor actually removed the extension
".do" from the request?

Furthermore, if the URL-pattern of my servlet-mapping
is specified as "/do/*" instead of "*.do" are the
request mapped again to the actions specified?

Thanks.

__________________________________________________
Do You Yahoo!?
Log on to Messenger with your mobile phone!
http://sg.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: RequestProcessor handling http requests

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Its all in the RequestProcessor

http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java


The main process(request, response) method in RequestProcessor calls
processMapping(request, response, path) which calls findActionConfig(path)
in  ModuleConfig to find the Action mapping that you configured in the
struts-config.xml.

Later on in the process() method it calls the processActionCreate() method
to get hold of the Action instance and then processActionPerform() actually
calls the action's execute() method.

Niall


----- Original Message ----- 
From: "Chang Ming Chye" <mc...@yahoo.com.sg>
To: <us...@struts.apache.org>
Cc: <mc...@yahoo.com.sg>
Sent: Wednesday, April 07, 2004 2:20 AM
Subject: RequestProcessor handling http requests


> Hi,
>
> How does struts handle incoming request and routes it
> to the correct action?
>
> For example, if I declare my web.xml as:
>
> <servlet>
>   <servlet-name>action</servlet-name>
>   <servlet-class>
>     org.apache.struts.action.ActionServlet
>   </servlet-class>
>   <init-param>
>     <param-name>config</param-name>
>     <param-value>
>       /WEB-INF/struts-config.xml
>     </param-value>
>   </init-param>
> </servlet>
>
> <servlet-mapping>
>   <servlet-name>action</servlet-name>
>   <url-pattern>*.do</url-pattern>
> </servlet-mapping>
>
> and in my struts-config.xml file I have the following
> action declared:
>
> <action path="/searchAction" ... >
>
> When the http request "*/searcAction.do" is received
> by the Action Servlet, how is the actual action
> "/searchAction" as specified retrieved? Which method
> of the RequestProcessor actually removed the extension
> ".do" from the request?
>
> Furthermore, if the URL-pattern of my servlet-mapping
> is specified as "/do/*" instead of "*.do" are the
> request mapped again to the actions specified?
>
> Thanks.
>
> __________________________________________________
> Do You Yahoo!?
> Log on to Messenger with your mobile phone!
> http://sg.messenger.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org