Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

modify extension .do to .web

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to specify the extension of a struts action?

Example:
http://127.0.0.1:8080/Card/Provisioning/Create.do

I'd like to change it to

http://127.0.0.1:8080/Card/Provisioning/Create.web


I want to do this because I need to get rid of the security constraint for this action (only this one). This action must be accessible for everyone without going trough the login page (the user should not get the login page if he clicks on this link)

So, I was thinking to solve my problem by adding another security-constraint section into web.xml.

I'm not sure if this could work. Is there a way to tell struts that the action /Card/Provisioning/Create should be /Card/Provisioning/Create.web instead of Create.do ?

Thanks


struts-config.xml:

<action input="/Card/Provisioning/CreationInput.jsp" name="cardForm" path="/Card/Provisioning/Create" scope="request" type="com.gemplus.preview.gui.card.ProvisioningCreateAction" validate="true">
<forward name="forward" path="/Card/Provisioning/CreationResponse.jsp"/>
</action>


web.xml:

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


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


<security-constraint>
<web-resource-collection>
<web-resource-name>With auth-constraint</web-resource-name>
<url-pattern>*.do</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>serviceManager</role-name>
<role-name>csr</role-name>
</auth-constraint>
</security-constraint>


<security-constraint>
<web-resource-collection>
<web-resource-name>Without auth-constraint</web-resource-name>
<url-pattern>*.web</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
</security-constraint>
 
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your deployment descriptor (i.e. your web.xml) you set the desired url-pattern in the servlet-mapping for the ActionServlet:

 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just noticed in the web.xml you posted, you have two <servlet-mapping>'s for the "action" Servlet, each defining different <url-patterns> - *.do and *.page. I suspect that is your issue (having multiple servlet-mappings for the same servlet).

Also, I do not see a <servlet> declaration for the "action" servlet; I'm not sure if you simply didn't post that, or if it is missing. One is needed. It's name (i.e. <servlet-name>) must match the value of the <servlet-mapping>.
[ January 20, 2005: Message edited by: Mark Vedder ]
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my mistake... it did a bad copy-paste
everything is perfect now

thanks for your help
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic