Couldn't you easily acheive the same end result (ie. surfers not hitting
certain pages) by simply checking the session for some attirbute to see that
they are logged in, and, if they are not logged in, redirect them to the
login page?

While the end-result would (I believe) be the same, I'm simply not
comfortable with putting pages under WEB-INF.  I don't think they 'belong'
there.  Maybe I'm just being entirely too anal.  Of course I can't claim to
know why you have the pages restricted, but checking for a login is
certainly one way (I would think) to acheive your goal and maintain your
pages under the document base.

Of course, they could still guess at the names and hit the page, but if the
pages check for a login and redirect the user, what does it really matter?

Eddie

----- Original Message -----
From: "Rob Breeds" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 27, 2002 1:53 PM
Subject: Re: changing from *.do to /do/* screws up everything? -> Jerry
Springer sums up...


> OK, thanks Matt and Bryan for your help.
>
> It seems that migrating from a *.do to /do/* is not as straightforward as
> I'd hoped. Especially if putting JSPs under WEB-INF (which is better than
> leaving them exposed).
>
> While changing the servlet mapping is easy, it introduces an additional
> artificial 'do' directory in the path which means that relative links are
> relative to the base path/do/ rather than just the base path.
>
> For JSPs that use JavaScript libraries (mine are in <war
> directory>/scripts) and/or stylesheets (<war directory/theme), this means
> either use a relative URL like '../scripts/thescript.js' or use
> <html:rewrite > like so:
>
> <script language="JavaScript" src="<html:rewrite page='/
> scripts/'/>menu_functions.js"></script>
>
> Likewise for images, I can either get to the images directory with
> '../images/painting.gif' or use the Struts img tag, using page attribute
> rather than src.
>
> Using html:base seems a nice idea but if JSPs are under WEB-INF, any
> reference will include WEB-INF and getting to JSPs like this is not
allowed
> by the spec.
>
> Thank you and good night :)
>
> Rob
>
>
>
>
> |--------+------------------------>
> |        |          Matt Raible   |
> |        |          <matt_raible@y|
> |        |          ahoo.com>     |
> |        |                        |
> |        |          27/02/2002    |
> |        |          19:25         |
> |        |          Please respond|
> |        |          to "Struts    |
> |        |          Users Mailing |
> |        |          List"         |
> |        |                        |
> |--------+------------------------>
>
>---------------------------------------------------------------------------
--------------------------------------------|
>   |
|
>   |      To:     Struts Users Mailing List
<[EMAIL PROTECTED]>
|
>   |      cc:
|
>   |      Subject:     Re: changing from *.do to /do/* screws up
everything?                                               |
>   |
|
>   |
|
>
>---------------------------------------------------------------------------
--------------------------------------------|
>
>
>
>
> I expected that you would be trying to include the header in a JSP, rather
> than
> trying to access it directly.
>
> All the html:rewrite does is render the path prefixed with the context.
>
> Yep - img tag is what you need.
>
> Matt
>
> --- Rob Breeds <[EMAIL PROTECTED]> wrote:
> >
> > Matt
> >
> > I changed '/header' to 'header', but now if I enter /do/header in the
> > browser address field it is now not found. Changed it back so it works
> >
> > For this example, I have one mapping and one JSP file (under WEB-INF)
> which
> > has several references to CSS, JS and images each in their respective
> > directories under the war directory.
> >
> > Using html:rewrite sorts out JS and CSS OK but to do this for every
image
> > is going to be painful for my 'big app'. Is this where someone tells me
I
> > should use the Struts image tag? :)
> >
> > btw, I'm not trying to access the JSP directly - this IS going via a
> > mapping from do/header to the jsp!
> >
> > Thanks
> >
> > Rob
> >
> >
> >
> >
> > |--------+------------------------>
> > |        |          Matt Raible   |
> > |        |          <matt_raible@y|
> > |        |          ahoo.com>     |
> > |        |                        |
> > |        |          27/02/2002    |
> > |        |          18:03         |
> > |        |          Please respond|
> > |        |          to "Struts    |
> > |        |          Users Mailing |
> > |        |          List"         |
> > |        |                        |
> > |--------+------------------------>
> >
> >
> >
> --------------------------------------------------------------------------
---------------------------------------------|
>
> >   |
> >                                             |
> >   |      To:     Struts Users Mailing List
> <[EMAIL PROTECTED]>
> >                                             |
> >   |      cc:
> >                                             |
> >   |      Subject:     Re: changing from *.do to /do/* screws up
> everything?
> >                                             |
> >   |
> >                                             |
> >   |
> >                                             |
> >
> >
> >
> --------------------------------------------------------------------------
---------------------------------------------|
>
> >
> >
> >
> >
> > Change this line:
> >
> > <action path="/header" forward="/WEB-INF/pages/header.jsp"/>
> >
> > TO
> >
> > <forward name="header" path="/WEB-INF/pages/header.jsp"/>
> >
> > and then use <html:rewrite> to render this in your JSP.
> >
> > HTH,
> >
> > Matt
> >
> > --- Rob Breeds <[EMAIL PROTECTED]> wrote:
> > > Hi
> > >
> > > I hope this is me being dumb but I have a working Struts application
> that
> > > uses a *.do servlet mapping for ActionServlet
> > >
> > > Because I found that the servlet spec doesn't allow partial URL
> mappings
> > > for security (eg. I can't specify a url-mapping of '/pub*'), I must
now
> > > change my app to use /do/*
> > >
> > > Seems like a fine idea, and Ted says its cool :)
> > >
> > > So, I changed the servlet mapping to '/do/*' and references to '*.do'
> in
> > my
> > > JSPs.
> > >
> > > Now my app sort of works but all relative links are now broken - CSS,
> > > images, JavaScript files
> > >
> > > e.g. I have a URL of '<rest of path>/do/header' and this is specified
> in
> > > the config  file as:
> > >
> > >           <action path="/header" forward="/WEB-INF/pages/header.jsp"/>
> > >
> > > The page loads OK but the JSP references images like this:
> > >
> > > <img src="images/find_obj.gif">
> > >
> > > This used to work because images was a directory directly under the
war
> > > directory, but now, the image has a path of <img src
> > > ="/do/images/find_obj.gif"> which isn't found. Simarly for references
> to
> > > CSS files and JS files.
> > >
> > > why is the /do/ prefix being added?
> > >
> > >
> > > Please could anyone tell me what I have to do to get my JS, CSS and
> > images
> > > to load without changing every reference  to them in every JSP to
> include
> > a
> > > /do/?
> > >
> > > Thanks
> > >
> > > Rob
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:   <
> > mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <
> > mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Greetings - Send FREE e-cards for every occasion!
> > http://greetings.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:   <
> > mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <
> > mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <
> mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <
> mailto:[EMAIL PROTECTED]>
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Greetings - Send FREE e-cards for every occasion!
> http://greetings.yahoo.com
>
> --
> To unsubscribe, e-mail:   <
> mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <
> mailto:[EMAIL PROTECTED]>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to