struts action url mapping that allows to split actions into restricted and unrestricted

Discussion in 'Java' started by Pavel, Nov 13, 2003.

  1. Pavel

    Pavel Guest

    Greetings to all -

    How could I have two groups of struts actions in the same application
    so the actions in the first group require the container based
    authorization and actions in the second group do not ?

    According to http://jakarta.apache.org/struts/userGuide/configuration.html
    I can use either prefix matching or extension matching:

    5.4.2 Configure the Action Servlet Mapping
    WARNING - Struts will not operate correctly if you define more than
    one <servlet-mapping> element for the controller servlet.

    In my web.xml I could not specify 'exception' url-pattern either:

    <security-constraint>
    <web-resource-collection>
    <url-pattern>*.do</url-pattern>
    <url-pattern>/jsp/*</url-pattern>
    </web-resource-collection>
    </security-constraint>

    If struts would support multiple servlet-mapping then I could use
    /do/* for my unrestricted actions. Can I have different url mapping
    for different struts modules ?

    The only work around that comes to mind so far is to create servlets
    outside of struts framework instead of actions in one of two groups.
    Any ideas are greatly appreciated.

    Thanks
    Pavel
     
    Pavel, Nov 13, 2003
    #1
    1. Advertisements

  2. Pavel

    Pavel Guest

    I could probably change my struts action servlet mapping from '*.do'to
    '/do/*' and then modify all of my secure actions mapping from '/dada'
    to '/do/secure/dada' in struts-config.xml. I could then add unsecure
    struts action '/do/public/dada'.

    In web.xml, I could then use '/do/secure/*' instead of '/do/*'. The
    downside of this is that I'd have to go though all of the JSPs and
    replace 'dada.do' with '/do/secure/dada' for all of the actions. Also,
    according to Struts docs 5.4.2 Configure the Action Servlet Mapping:
    WARNING - If you are using the new module support in Struts 1.1, you
    should be aware that only extension mapping is supported.

    If I could only specify the exceptions in the web.xml like
    <security-constraint>
    <web-resource-collection>

    <url-pattern-except>/public/*</url-pattern-except>

    <url-pattern>*.do</url-pattern>
    <url-pattern>/jsp/*</url-pattern>
    </web-resource-collection>
    </security-constraint>
    that would be all I'd need to do ... It would be too simple though.

    Pavel

    (Pavel) wrote in message news:<>...
    > Greetings to all -
    >
    > How could I have two groups of struts actions in the same application
    > so the actions in the first group require the container based
    > authorization and actions in the second group do not ?
    >
    > According to http://jakarta.apache.org/struts/userGuide/configuration.html
    > I can use either prefix matching or extension matching:
    >
    > 5.4.2 Configure the Action Servlet Mapping
    > WARNING - Struts will not operate correctly if you define more than
    > one <servlet-mapping> element for the controller servlet.
    >
    > In my web.xml I could not specify 'exception' url-pattern either:
    >
    > <security-constraint>
    > <web-resource-collection>
    > <url-pattern>*.do</url-pattern>
    > <url-pattern>/jsp/*</url-pattern>
    > </web-resource-collection>
    > </security-constraint>
    >
    > If struts would support multiple servlet-mapping then I could use
    > /do/* for my unrestricted actions. Can I have different url mapping
    > for different struts modules ?
    >
    > The only work around that comes to mind so far is to create servlets
    > outside of struts framework instead of actions in one of two groups.
    > Any ideas are greatly appreciated.
    >
    > Thanks
    > Pavel
     
    Pavel, Nov 14, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe Bloggs
    Replies:
    1
    Views:
    1,408
    Sudsy
    Aug 3, 2003
  2. Pavel
    Replies:
    2
    Views:
    14,549
    Pavel
    Oct 20, 2003
  3. rjweytens
    Replies:
    6
    Views:
    17,119
    rjweytens
    Jun 25, 2004
  4. Hgjhghjgjhg Hgjhghjg

    Struts - get action mapping name

    Hgjhghjgjhg Hgjhghjg, Jul 19, 2004, in forum: Java
    Replies:
    1
    Views:
    5,367
    Murray
    Jul 19, 2004
  5. runescience

    Struts mapping action to action???

    runescience, Feb 6, 2006, in forum: Java
    Replies:
    3
    Views:
    2,172
    runescience
    Feb 7, 2006
  6. Replies:
    1
    Views:
    930
  7. vyshu
    Replies:
    1
    Views:
    3,225
    Richard Senior
    Apr 27, 2007
  8. ros
    Replies:
    0
    Views:
    750
Loading...