Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Is it safe to point to Internet for locating struts DTD files in struts TLDs and XML files?

Reply
Thread Tools

Is it safe to point to Internet for locating struts DTD files in struts TLDs and XML files?

 
 
Katie Wright
Guest
Posts: n/a
 
      07-17-2003
Hello,

I hope that this will be an easy question. I apologize if this is not
the right forum for this question. I could not find a more
appropriate newsgroup. Maybe someone can direct me to one?

In the TLD and XML files used to configure and setup the struts
framework, at the header is this:

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd" [

Which essentially means for this file to go out into the Internet,
locate and use the DTD file. Most people have this reference and do
this. Is this safe?
Will Jakarta ever remove or move this file?

I realize that you could copy the file locally on your system and then
change your references to point to this file but I don't want to do
this because then my understanding is that I would have to put
absolute file pathing information to locate the file and this is
undesired for my application.

Is there a way in which struts XML and TLD files can see DTD files
that exist in a WAR?

Thanks for reading,

Katie Wright
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Mike Schilling
Guest
Posts: n/a
 
      07-17-2003

"Katie Wright" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> Hello,
>
> I hope that this will be an easy question. I apologize if this is not
> the right forum for this question. I could not find a more
> appropriate newsgroup. Maybe someone can direct me to one?
>
> In the TLD and XML files used to configure and setup the struts
> framework, at the header is this:
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd" [
>
> Which essentially means for this file to go out into the Internet,
> locate and use the DTD file. Most people have this reference and do
> this. Is this safe?
> Will Jakarta ever remove or move this file?


That's unlikely; too many people depend upon it. Of course there's no
guarantee that their web site will be up 24/7.

On the other hand, validation is expensive. I would guess that at run-time
a non-validating parser is used to parse these files. If so, the DOCTYPE
declaration is ignored.


 
Reply With Quote
 
 
 
 
Adam Maass
Guest
Posts: n/a
 
      07-17-2003

"Katie Wright" <(E-Mail Removed)> wrote:
> Hello,
>
> I hope that this will be an easy question. I apologize if this is not
> the right forum for this question. I could not find a more
> appropriate newsgroup. Maybe someone can direct me to one?
>
> In the TLD and XML files used to configure and setup the struts
> framework, at the header is this:
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd" [
>
> Which essentially means for this file to go out into the Internet,
> locate and use the DTD file. Most people have this reference and do
> this. Is this safe?
> Will Jakarta ever remove or move this file?
>
> I realize that you could copy the file locally on your system and then
> change your references to point to this file but I don't want to do
> this because then my understanding is that I would have to put
> absolute file pathing information to locate the file and this is
> undesired for my application.
>
> Is there a way in which struts XML and TLD files can see DTD files
> that exist in a WAR?
>
> Thanks for reading,
>


My solution has been to grab the DTD and then set an EntityResolver on the
parser to give the local copy when this request is encountered. That way,
you don't have to modify your XML files, but you remove the uncertainty
involved in retrieving a DTD from over the Internet. It's relatively
straightforward to do once you figure out that that's what needs to be done.

It is unlikely that Apache will move the DTD, but the site may not be up (or
accessible) at all times when you need it. Additionally, there is no
guarantee that Apache won't change the DTD on you. Better to have something
under configuration control so you know exactly what's going on.

My 2 cents. YMMV.

-- Adam Maass


 
Reply With Quote
 
Wendy S
Guest
Posts: n/a
 
      07-17-2003
> "Katie Wright" <(E-Mail Removed)> wrote:
> > In the TLD and XML files used to configure and setup the struts
> > framework, at the header is this:
> > <!DOCTYPE struts-config PUBLIC
> > "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> > "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd" [
> > Which essentially means for this file to go out into the Internet,
> > locate and use the DTD file.
> > Is there a way in which struts XML and TLD files can see DTD files
> > that exist in a WAR?


Craig McClanahan has posted on this topic, it's a common misconception that
the public identifier is really a URL.
The DTD's are included in struts.jar and will be found there.

http://www.mail-archive.com/struts-u.../msg65929.html

--
Wendy in Chandler, AZ


 
Reply With Quote
 
Katie Wright
Guest
Posts: n/a
 
      07-22-2003
Interesting ...

I do agree that it is better to have something under my control. I
did make copies of the DLD file but hesistate to make my application
read my copies if I have to put absolute pathing (choosing the lesser
of two evils) and cannot read the dld from either a jar or war.

I visited the website referenced here and it said this "(Struts uses
these internal copies when parsing, so that it works when you're
disconnected from the Internet)."

Do I have to do something in order to make it see the internal copy if
disconnected from the Internet? This is similar to what I would like
to do.

I do think that the URL is an external URL and know for a fact that it
will not work on my application when disconnected from the Internet
because our network router went down one day and this the application
would not deploy the ear which is what brought about me investigating
this problem in the first place.

Thank you for all your help,

Katie Wright

"Wendy S" <(E-Mail Removed)> wrote in message news:<bf6r06$bgs$(E-Mail Removed)>...
> > "Katie Wright" <(E-Mail Removed)> wrote:
> > > In the TLD and XML files used to configure and setup the struts
> > > framework, at the header is this:
> > > <!DOCTYPE struts-config PUBLIC
> > > "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> > > "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd" [
> > > Which essentially means for this file to go out into the Internet,
> > > locate and use the DTD file.
> > > Is there a way in which struts XML and TLD files can see DTD files
> > > that exist in a WAR?

>
> Craig McClanahan has posted on this topic, it's a common misconception that
> the public identifier is really a URL.
> The DTD's are included in struts.jar and will be found there.
>
> http://www.mail-archive.com/struts-u.../msg65929.html

 
Reply With Quote
 
derrick
Guest
Posts: n/a
 
      01-06-2005
Wendy and/or Craig, if the public identifier is not a url and the dtd's
in struts.jar are used then how come if one changes the http url to
something that does not exist (to simulate no connection) then the
struts-config.xml file can not be found and the app fails? Thank you in
advance!


Wendy S wrote:
> > "Katie Wright" <(E-Mail Removed)> wrote:
> > > In the TLD and XML files used to configure and setup the struts
> > > framework, at the header is this:
> > > <!DOCTYPE struts-config PUBLIC
> > > "-//Apache Software Foundation//DTD Struts Configuration

1.1//EN"
> > > "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"

[
> > > Which essentially means for this file to go out into the

Internet,
> > > locate and use the DTD file.
> > > Is there a way in which struts XML and TLD files can see DTD

files
> > > that exist in a WAR?

>
> Craig McClanahan has posted on this topic, it's a common

misconception that
> the public identifier is really a URL.
> The DTD's are included in struts.jar and will be found there.
>
>

http://www.mail-archive.com/struts-u.../msg65929.html
>
> --
> Wendy in Chandler, AZ


 
Reply With Quote
 
Wendy S
Guest
Posts: n/a
 
      01-07-2005
"derrick" <(E-Mail Removed)> wrote:
> if the public identifier is not a url and the dtd's
> in struts.jar are used then how come if one changes the http url to
> something that does not exist (to simulate no connection) then the
> struts-config.xml file can not be found and the app fails?


First, I don't believe that changing the text is a correct way to simulate
working offline.

What is the exact error message you're getting?

I think that url you changed is part of what the system uses to locate the
dtd (which exists inside struts.jar). You told it to validate
struts-config.xml, it can't find the dtd (because you messed up the
identifier) and so it fails.

The struts-config dtd buried inside struts.jar says this:

<!--
DTD for the Struts Application Configuration File, Version 1.1

To support validation of your configuration file, include the following
DOCTYPE element at the beginning (after the "xml" declaration):

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

$Id: struts-config_1_1.dtd 51429 2004-02-17 05:51:48Z martinc $
-->

So, unless you put *exactly* that <!DOCTYPE...> block in your
struts-config.xml file, I'd expect exactly the result you got.

--
Wendy S


 
Reply With Quote
 
derrick
Guest
Posts: n/a
 
      01-07-2005
Thanks for you time Wendy for making this so clear to me. You make
perfect sense. I agree my test was flimsy, but I couldn't easily
reproduce the connection/site/page being unvailable.

Wendy S wrote:
> "derrick" <(E-Mail Removed)> wrote:
> > if the public identifier is not a url and the dtd's
> > in struts.jar are used then how come if one changes the http url to
> > something that does not exist (to simulate no connection) then the
> > struts-config.xml file can not be found and the app fails?

>
> First, I don't believe that changing the text is a correct way to

simulate
> working offline.
>
> What is the exact error message you're getting?
>
> I think that url you changed is part of what the system uses to

locate the
> dtd (which exists inside struts.jar). You told it to validate
> struts-config.xml, it can't find the dtd (because you messed up the
> identifier) and so it fails.
>
> The struts-config dtd buried inside struts.jar says this:
>
> <!--
> DTD for the Struts Application Configuration File, Version 1.1
>
> To support validation of your configuration file, include the

following
> DOCTYPE element at the beginning (after the "xml" declaration):
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration

1.1//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>
> $Id: struts-config_1_1.dtd 51429 2004-02-17 05:51:48Z martinc $
> -->
>
> So, unless you put *exactly* that <!DOCTYPE...> block in your
> struts-config.xml file, I'd expect exactly the result you got.
>
> --
> Wendy S


 
Reply With Quote
 
Andrea Desole
Guest
Posts: n/a
 
      01-07-2005
This is interesting. Is there a standard way to look for a DTD in a jar
file, or is it just struts?
Most of the times using a regular URL works, but the best solution for
me is to copy the DTDs locally.


Wendy S wrote:
> "derrick" <(E-Mail Removed)> wrote:
>
>>if the public identifier is not a url and the dtd's
>>in struts.jar are used then how come if one changes the http url to
>>something that does not exist (to simulate no connection) then the
>>struts-config.xml file can not be found and the app fails?

>
>
> First, I don't believe that changing the text is a correct way to simulate
> working offline.
>
> What is the exact error message you're getting?
>
> I think that url you changed is part of what the system uses to locate the
> dtd (which exists inside struts.jar). You told it to validate
> struts-config.xml, it can't find the dtd (because you messed up the
> identifier) and so it fails.
>
> The struts-config dtd buried inside struts.jar says this:
>
> <!--
> DTD for the Struts Application Configuration File, Version 1.1
>
> To support validation of your configuration file, include the following
> DOCTYPE element at the beginning (after the "xml" declaration):
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>
> $Id: struts-config_1_1.dtd 51429 2004-02-17 05:51:48Z martinc $
> -->
>
> So, unless you put *exactly* that <!DOCTYPE...> block in your
> struts-config.xml file, I'd expect exactly the result you got.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
new TLDs and extended domain names. Roedy Green Java 26 07-21-2008 03:13 AM
Tomcat (jasper2) JspC precompile not catching Struts TLDs javaguy@sbcglobal.net Java 0 01-24-2007 04:13 PM
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
Scenario 5: IS-IS routing on Frame Relay Multi-point and Point-to-Point David Sudjiman Cisco 0 06-08-2006 09:11 AM



Advertisments