Re: Servlet File Structure

2007-12-18 Thread Hassan Schroeder
On Dec 18, 2007 9:56 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:

> I've set up a security servlet that will check permissions on various
> html, pdf, xml, etc, files.

> 1) I started with the content files out of the Web directory all
> together and kept the mapping in an xml file and then served them
> using FileInputStream and writing them to the ServletOutputStream.
> This doesn't work because any internal refrences (, 

Re: Servlet File Structure

2007-12-18 Thread Spencer Tickner
Hi Hassan,

Thanks for the response and sorry for the confusion.

The Web-directory was badly named,, but I was refering to the
{tomcat}\webapp\ directory. When I was refering to Servlet Folder it
would be {tomcat}\webapp\ServletDir\

Thanks,

Spencer


On Dec 18, 2007 10:42 AM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
> On Dec 18, 2007 9:56 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
>
> > I've set up a security servlet that will check permissions on various
> > html, pdf, xml, etc, files.
>
> > 1) I started with the content files out of the Web directory all
> > together and kept the mapping in an xml file and then served them
> > using FileInputStream and writing them to the ServletOutputStream.
> > This doesn't work because any internal refrences (, 

Re: Servlet File Structure

2007-12-18 Thread Hassan Schroeder
On Dec 18, 2007 10:50 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:

> The Web-directory was badly named,, but I was refering to the
> {tomcat}\webapp\ directory. When I was refering to Servlet Folder it
> would be {tomcat}\webapp\ServletDir\

Have you read the Servlet Spec? I think it would give you a better
idea about how webapps are typically deployed :-)

Pages/documents you want to shield from direct access usually
go in WEB-INF, which is implicitly protected by the container. So
you might have something like

  $CATALINA_HOME/webapps/{appname}/WEB-INF/jsp
  $CATALINA_HOME/webapps/{appname}/WEB-INF/pdf

and servlets go in, e.g.

  $CATALINA_HOME/webapps/{appname}/WEB-INF/classes/com/example/whatever

> > > together and kept the mapping in an xml file and then served them
> > > using FileInputStream and writing them to the ServletOutputStream.
> > > This doesn't work because any internal refrences (, 

Re: Servlet File Structure

2007-12-18 Thread Spencer Tickner
The files are "lost", as I'm firing the servlet in the
{tomcat}\webapp\ServletDir\, that then reads a file "C:\somefile.htm"
that in it has reference to  wrote:
> Hi Hassan,
>
> Thanks for the response and sorry for the confusion.
>
> The Web-directory was badly named,, but I was refering to the
> {tomcat}\webapp\ directory. When I was refering to Servlet Folder it
> would be {tomcat}\webapp\ServletDir\
>
> Thanks,
>
> Spencer
>
>
>
> On Dec 18, 2007 10:42 AM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
> > On Dec 18, 2007 9:56 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> >
> > > I've set up a security servlet that will check permissions on various
> > > html, pdf, xml, etc, files.
> >
> > > 1) I started with the content files out of the Web directory all
> > > together and kept the mapping in an xml file and then served them
> > > using FileInputStream and writing them to the ServletOutputStream.
> > > This doesn't work because any internal refrences (, 

Re: Servlet File Structure

2007-12-18 Thread Spencer Tickner
Thanks, Hassan,, that gives me a start.

On Dec 18, 2007 11:03 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> The files are "lost", as I'm firing the servlet in the
> {tomcat}\webapp\ServletDir\, that then reads a file "C:\somefile.htm"
> that in it has reference to  C:\. somefile.htm is read and returned to the browser fine,, but the
> browser can't find test.gif.  Hope this clears up the confusion.
>
> Thanks
>
> Spencer
>
>
> On Dec 18, 2007 10:50 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> > Hi Hassan,
> >
> > Thanks for the response and sorry for the confusion.
> >
> > The Web-directory was badly named,, but I was refering to the
> > {tomcat}\webapp\ directory. When I was refering to Servlet Folder it
> > would be {tomcat}\webapp\ServletDir\
> >
> > Thanks,
> >
> > Spencer
> >
> >
> >
> > On Dec 18, 2007 10:42 AM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
> > > On Dec 18, 2007 9:56 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> > >
> > > > I've set up a security servlet that will check permissions on various
> > > > html, pdf, xml, etc, files.
> > >
> > > > 1) I started with the content files out of the Web directory all
> > > > together and kept the mapping in an xml file and then served them
> > > > using FileInputStream and writing them to the ServletOutputStream.
> > > > This doesn't work because any internal refrences (, 

Re: Servlet File Structure

2007-12-18 Thread Hassan Schroeder
On Dec 18, 2007 11:03 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> The files are "lost", as I'm firing the servlet in the
> {tomcat}\webapp\ServletDir\, that then reads a file "C:\somefile.htm"
> that in it has reference to  C:\. somefile.htm is read and returned to the browser fine,, but the
> browser can't find test.gif.  Hope this clears up the confusion.

Then you need to use an absolute but context-relative path, e.g.

   src="${pageContext.request.contextPath}/images/test.gif"

(JSTL example) and put that image in

$CATALINA_HOME/webapps/{appname}/images/

HTH!
-- 
Hassan Schroeder  [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet File Structure

2007-12-18 Thread Spencer Tickner
Hi Hassan,

Once again thanks for the feedback,, the issue I would have with the
solution above is that content (html, pdf, xml) is maintained by
editors that I have no control over. They simply make their content
look the way the want and then upload it to my application. I could
feasibly search out all paths with html documents and do a little
replace magic on upload,, however this gets complicated to the point
of impossible when dealing with documents such as XML, XSLT where
internal references can be made with virtually unlimited semantics. So
keeping the directory structure the same from the "root down" is
important (Keeps a documents "form" in the responsibility sphere of
the editor).

My app is responsible for controlling logging and accessing to these
documents (Administrators have an interface for granting access to
users on documents uploaded by the editor). I just can't seem to serve
these documents up.

Thanks,

Spencer

On Dec 18, 2007 11:20 AM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
> On Dec 18, 2007 11:03 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> > The files are "lost", as I'm firing the servlet in the
> > {tomcat}\webapp\ServletDir\, that then reads a file "C:\somefile.htm"
> > that in it has reference to  > C:\. somefile.htm is read and returned to the browser fine,, but the
> > browser can't find test.gif.  Hope this clears up the confusion.
>
> Then you need to use an absolute but context-relative path, e.g.
>
>src="${pageContext.request.contextPath}/images/test.gif"
>
> (JSTL example) and put that image in
>
> $CATALINA_HOME/webapps/{appname}/images/
>
> HTH!
> --
>
> Hassan Schroeder  [EMAIL PROTECTED]
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet File Structure

2007-12-18 Thread Hassan Schroeder
On Dec 18, 2007 11:41 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:

> Once again thanks for the feedback,, the issue I would have with the
> solution above is that content (html, pdf, xml) is maintained by
> editors that I have no control over. They simply make their content
> look the way the want and then upload it to my application.

So you establish a convention for internal links; if they don't follow
it, their stuff is broken. Not your problem then, eh? :-)

> My app is responsible for controlling logging and accessing to these
> documents (Administrators have an interface for granting access to
> users on documents uploaded by the editor). I just can't seem to serve
> these documents up.

Is the issue broken internal links, or what? I do this kind of thing on
pretty much every site, so  I'm afraid I'm not understanding where the
disconnect lies.

-- 
Hassan Schroeder  [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet File Structure

2007-12-18 Thread Spencer Tickner
Hi Hassan,

I wish I could establish a convention for internal links..
Unfortunately it's not possible as we get content from a diverse
editor base where our system may not be the primary delivery method.
Looking through our correspondence it would seem that I am trying to
address the problem when I should just be stating it.. My problem is
internal links are breaking in content served through my security
servlet. Thanks so much for the time and patience.. I do really
appreciate it.

Spencer

On Dec 18, 2007 3:33 PM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
> On Dec 18, 2007 11:41 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
>
> > Once again thanks for the feedback,, the issue I would have with the
> > solution above is that content (html, pdf, xml) is maintained by
> > editors that I have no control over. They simply make their content
> > look the way the want and then upload it to my application.
>
> So you establish a convention for internal links; if they don't follow
> it, their stuff is broken. Not your problem then, eh? :-)
>
> > My app is responsible for controlling logging and accessing to these
> > documents (Administrators have an interface for granting access to
> > users on documents uploaded by the editor). I just can't seem to serve
> > these documents up.
>
> Is the issue broken internal links, or what? I do this kind of thing on
> pretty much every site, so  I'm afraid I'm not understanding where the
> disconnect lies.
>
> --
>
> Hassan Schroeder  [EMAIL PROTECTED]
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet File Structure

2007-12-18 Thread Hassan Schroeder
On Dec 18, 2007 4:45 PM, Spencer Tickner <[EMAIL PROTECTED]> wrote:

> I wish I could establish a convention for internal links..
> Unfortunately it's not possible as we get content from a diverse
> editor base where our system may not be the primary delivery method.

Then you're hosed, I think :-)

Seriously, if you can't define and enforce a standard for style, img
or whatever links, you'd have problems with static pages served up
straight from the file system.

Your content creators have to be aware of how the system is set up
and build valid documents for the deployment environment.

Or you have to post-process them. Or use a Filter to rewrite the bad
links on the fly, but as you point out those are both iffy :-)

I don't see where your security servlet even comes in to the picture.

-- 
Hassan Schroeder  [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet File Structure

2007-12-18 Thread David Smith
Just by chance, could we see a sample url to one of your pages and a 
sample internal link?  It doesn't seem like this should be a big deal.


--David

Spencer Tickner wrote:
Hi Hassan,  




I wish I could establish a convention for internal links..
Unfortunately it's not possible as we get content from a diverse
editor base where our system may not be the primary delivery method.
Looking through our correspondence it would seem that I am trying to
address the problem when I should just be stating it.. My problem is
internal links are breaking in content served through my security
servlet. Thanks so much for the time and patience.. I do really
appreciate it.

Spencer

On Dec 18, 2007 3:33 PM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
  

On Dec 18, 2007 11:41 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:



Once again thanks for the feedback,, the issue I would have with the
solution above is that content (html, pdf, xml) is maintained by
editors that I have no control over. They simply make their content
look the way the want and then upload it to my application.
  

So you establish a convention for internal links; if they don't follow
it, their stuff is broken. Not your problem then, eh? :-)



My app is responsible for controlling logging and accessing to these
documents (Administrators have an interface for granting access to
users on documents uploaded by the editor). I just can't seem to serve
these documents up.
  

Is the issue broken internal links, or what? I do this kind of thing on
pretty much every site, so  I'm afraid I'm not understanding where the
disconnect lies.

--

Hassan Schroeder  [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet File Structure

2007-12-19 Thread Spencer Tickner
Hi Hassan and David,

Thanks, for the response. Hassan of course you're right, there are
always some standard for internal paths that have to be adhered to.
However with relative paths coming from editors that edit html their
documents can be seen exactly on the file system as they can be seen
on a web server such as apache or IIS. For other editors that just use
word documents the "Save As" HTML function packages all internal links
relatively so once again the internal links just work when deploying
on standard web-servers. They upload, no work from me ;).. Same goes
with a number of other technologies (InDesign, Framemaker). I think I
have come up with a solution though,, Redeploying my .war file was
overwriting all the files I had under it's webapps/servletname
directory. Seems to me if every time I re-deploy the war and copy the
WEB-INF folder into another folder webapps/mysites all files in
mysites remain intact and the servlet fires when accessing them (using
/*). I haven't tested it thoroughly but it
does seem to be working.

Thanks,

Spencer

On Dec 18, 2007 5:14 PM, David Smith <[EMAIL PROTECTED]> wrote:
> Just by chance, could we see a sample url to one of your pages and a
> sample internal link?  It doesn't seem like this should be a big deal.
>
> --David
>
>
> Spencer Tickner wrote:
> > Hi Hassan,
> >
> >
> >
> > I wish I could establish a convention for internal links..
> > Unfortunately it's not possible as we get content from a diverse
> > editor base where our system may not be the primary delivery method.
> > Looking through our correspondence it would seem that I am trying to
> > address the problem when I should just be stating it.. My problem is
> > internal links are breaking in content served through my security
> > servlet. Thanks so much for the time and patience.. I do really
> > appreciate it.
> >
> > Spencer
> >
> > On Dec 18, 2007 3:33 PM, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
> >
> >> On Dec 18, 2007 11:41 AM, Spencer Tickner <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>> Once again thanks for the feedback,, the issue I would have with the
> >>> solution above is that content (html, pdf, xml) is maintained by
> >>> editors that I have no control over. They simply make their content
> >>> look the way the want and then upload it to my application.
> >>>
> >> So you establish a convention for internal links; if they don't follow
> >> it, their stuff is broken. Not your problem then, eh? :-)
> >>
> >>
> >>> My app is responsible for controlling logging and accessing to these
> >>> documents (Administrators have an interface for granting access to
> >>> users on documents uploaded by the editor). I just can't seem to serve
> >>> these documents up.
> >>>
> >> Is the issue broken internal links, or what? I do this kind of thing on
> >> pretty much every site, so  I'm afraid I'm not understanding where the
> >> disconnect lies.
> >>
> >> --
> >>
> >> Hassan Schroeder  [EMAIL PROTECTED]
> >>
> >> -
> >> To start a new topic, e-mail: users@tomcat.apache.org
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> > -
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]