You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren Hall <dh...@utrs.com> on 2006/10/17 21:42:12 UTC

Path based action mapping

I'm using struts 1.2.9 with Apache 2.2 and Tomcat 5.5.

I have configured struts to use tiles and my web application appears to be
working flawlessly up until now.

I've been told that I need to display pdf files in a new browser window when
someone clicks on a pdf link on the website. This seems a simple task,
except I must have configured something improperly. I added the following
mapping to my struts-config file:

 

<action  path="/home/pdf/FLC_Bylaws/"

         type="org.apache.struts.actions.ForwardAction"

         parameter="/home/pdf/FLC_Bylaws.pdf"/>

 

and pointed my browser at http://my-domain.com/home/pdf/FLC_Bylaws/ .

When I did so, I got a 404 error. Here is the output from my log files:

 

2006-10-17 15:29:05,170 DEBUG org.apache.struts.util.ModuleUtils - Get
module name for path /home/pdf/FLC_Bylaws/

2006-10-17 15:29:05,170 DEBUG org.apache.struts.util.ModuleUtils - Module
name found: default

2006-10-17 15:29:05,170 DEBUG org.apache.struts.action.RequestProcessor -
Processing a 'GET' for path '/home/pdf/FLC_Bylaws/'

2006-10-17 15:29:05,170 DEBUG org.apache.struts.action.RequestProcessor -
Looking for Action instance for class
org.apache.struts.actions.ForwardAction

2006-10-17 15:29:05,171 DEBUG org.apache.struts.tiles.TilesRequestProcessor
- processForwardConfig(/home/pdf/FLC_Bylaws.pdf, true)

2006-10-17 15:29:05,171 DEBUG org.apache.struts.tiles.TilesRequestProcessor
-   '/home/pdf/FLC_Bylaws.pdf' - processed as uri

2006-10-17 15:29:05,171 DEBUG org.apache.struts.action.RequestProcessor -
processForwardConfig(ForwardConfig[name=null,path=/home/pdf/FLC_Bylaws.pdf,r
edirect=false,contextRelative=true,module=null])

 DEBUG org.apache.catalina.core.ApplicationDispatcher -
servletPath=/home/pdf/FLC_Bylaws.pdf, pathInfo=null, queryString=null,
name=null

 DEBUG org.apache.catalina.core.ApplicationDispatcher -  Path Based Forward

2006-10-17 15:29:05,175 DEBUG org.apache.struts.util.ModuleUtils - Get
module name for path /home/pdf/FLC_Bylaws.pdf

2006-10-17 15:29:05,175 DEBUG org.apache.struts.util.ModuleUtils - Module
name found: default

2006-10-17 15:29:05,176 DEBUG org.apache.struts.action.RequestProcessor -
Processing a 'GET' for path '/home/pdf/FLC_Bylaws'

2006-10-17 15:29:05,176 DEBUG
org.apache.struts.util.PropertyMessageResources -
getMessage(en,processInvalid)

2006-10-17 15:29:05,177 ERROR org.apache.struts.action.RequestProcessor -
Invalid path was requested /home/pdf/FLC_Bylaws

 DEBUG org.apache.catalina.core.ApplicationDispatcher -  Disabling the
response for futher output

 

It seems as if when I do my forward, struts re-evaluates the request using
path based mapping, and ultimately cannot figure out how to map the request.

The same thing happens if I remove the mapping from struts-config and try to
map to the pdf directly. Struts will remove the name of the pdf file from
the end of the request and look for an appropriate path mapping in
struts-config. In other words, I can't link to the pdf directly.

Does this make any sense? Can someone please tell me why I'm unable to
simply display my pdf file, or what configuration changes I need to make to
struts so that I can link to (or map to) my pdf?

 

Thanks,

Darren