Announcement Announcement Module
Collapse
No announcement yet.
DispatcherServlet / tomcat welcome-file / index file issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DispatcherServlet / tomcat welcome-file / index file issue

    not really a direct question, but if you have an answer, please feel to respond
    I apologize if this has already been discussed

    I'm using tomcat 5.5 and have disabled directory listings
    I wish that when the user visits the site (no htm file specified, just the root URL) that a controller handles it via the DispatcherServlet
    I am also using acegi-security for authentication

    initially I had no files in the context dir of my webapp, aside from the login.jsp required by my acegi-security setup

    but in my MVC config, I did map the "index.htm" URL to a "home" controller

    I am relying on the default "welcome-file" list specified in the server-wide web.xml
    <welcome-file-list>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    when everything is up and running, and my brower hits the default URL (e.g. http://appadmin/), I am redirected through acegi-security for a login, and when I am logged in successfully I am sent back to the original URL and get a 404 page (I guess this is the result of the disabled directory listing)

    what I thought would happen was that the DispatcherServlet would have picked up the flow and sent the request to my "home" controller

    next what I did was actually stick an "index.htm" in the context root of my webapp, a simple file with just a static "hello" message, no dynamic stuff

    same series of events (after both a brower & tomcat restart); instead of the 404, and instead of the contents of the static file I just created, I get the result of my "home" controller

    I gutted the index.htm file (now it's completely empty), and the above scenario still works

    this is the effect I desire for my application, but my question is: is this the right way to go about achieving this functionality, or am I just abusing a loop hole?
    Last edited by shan; Nov 22nd, 2005, 04:32 PM.

  • #2
    Not sure if i got your question right..

    But to my knowlege u can't use welcome-file-list elements to map to a "virtual" address. (only in the directory not through a DispatcherServlet)

    U could however add a jsp that redirects it all..

    index.htm
    Code:
    <jsp:forward page="index.htm" />
    Not sure if i did answer anything... hope so.

    -Erik

    Comment

    Working...
    X