• 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

Deployment Descriptor Order

 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do we really have to follow this order in the deployment descriptor (web security)?
<security-constraint>
<login-config>
<security-role>
If yes, why?
 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Allan,
Here is the DTD for <web-app> element:
<!ELEMENT web-app (icon?, display-name?, description?, distribut-able?,
context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*,
session-config?, mime-mapping*, welcome-file-list?, error-page*,
taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?,
security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>
The order in which sub-elements are there in DTD should be followed while writing DD file.
Also note the meaning of following
* : 0 or more occurence
? : 0 or 1 occurence
+ : 1 or more occurence
| : means or
if no symbol than mandatory with exactly one occurence
I hope it helps.
Thanks and regards
Pradeep
Java Certification Test Simulators � J@Whiz, SCWCD@Whiz http://www.whizlabs.com/jwhiz
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The short answer is "yes", except that all three are optional :-)
Why? ... because that's the order that the DTD specifies.
Note that some app servers choose to be less strict about order, however Tomcat is not one of them.
 
Allan Moster
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Essentially, what you're saying is we cannot deviate from this format?
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Allan
The short answer to your first question is: yes.
The short answer to you second question is: because they said so.

On a more serious note:
I am by no means an XML guru, but my understanding is the whole point of it is to simplify and standardize a way to transmit information between two entities. The Deployment descriptor specifies the order in which the tags must come in order to simplify the communication. That way the a DTD I create will look the same and folow the same format as one that you create. It also allows the server to know exactly which tags are expected when and eases the parsing of the DTD by the server.
hope that helps a little bit, I'm sure someone else knows a bit more on it and will add to this for you....

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
Allan Moster
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,
I'm buying your answer that some app servers MAY not be strict on this order.
Thanks.
 
Tim Duncan
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Which is ok if you know where you're going to deploy, but bad practice if you want to remain portable.
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I work with WebLogic and it doesn�t complain about the order of the tags, at least some wich I�ve tryied, the most funny is that if you use the jsp compiler from WL it complains but you can run it and doesn�t have problems.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends mostly on the type of parser they are using for reading web.xml file. if you use validating parser then it definately complains about ur non-conformance. if you use non-validating (as the name suggests) it never cares about the ordering or cordinality/optionality of the attributes
Sridhar

Originally posted by Marcos Maia:
Yes, I work with WebLogic and it doesn�t complain about the order of the tags, at least some wich I�ve tryied, the most funny is that if you use the jsp compiler from WL it complains but you can run it and doesn�t have problems.


 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, SridharS I agree, this behavior I�ve said is with the defaul configuration for WL6.0 and 6.1.
regards.
PS - You should change your name to match JavaRanch rules(or a sheriff will tell you to do so), take a look at: http://www.javaranch.com/name.jsp
[This message has been edited by Marcos Maia (edited October 24, 2001).]
 
We're all out of roofs. But we still have tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic