On Wed, Sep 9, 2009 at 6:04 AM, StephenGregory <[email protected]>wrote:

>
> I am going through the tutorials and playing around with lift.  I'm
> running off of the 1.0 release since I had some issues with broken
> snapshots on 1.1.  I have a question about how the dispatch works.
>
> I have a view in my view package defined as such:
>
> class TopicView extends LiftView{
>
>    override def dispatch  = {
>        case "index"=> test _
>        case "list" => doList _
>        case "add" => doAdd _
>        case "test" => test _
>    }
> ...
>   def test = <b>the test worked</b>
> }
>
> First I try to hit http:/localhost/<contextpath>/TopicView/test  by
> typing int the url int he browser.  The server gives me back The
> Requested URL /<contextpath>/TopicView/test was not found on this
> server .
>
> If I add a menu that points to /TopicView/test , the server can now
> find the url.  If I take away the menu from the sitemap, I can no
> longer hit the view.  Same thing works for templates.  I had expected
> by creating a view or a template I should just be able to hit the
> appropriate URL and they would work.  What am I doing wrong?
>

SiteMap is optional.  If you remove the LiftRules.setSiteMap line from Boot,
you can add views to your app and they will appear.

If you put stuff in the /static directory (if you generated you app from a
recent archetype), it will be available without additional sitemap entries.

SiteMap is access control.  You must explicitly add things to SiteMap to
make them available.  SiteMap is not automatically generated.

Why?

First, there must be an explicit step (adding something to SiteMap) to make
it available to end users.  Every single project I've ever worked on has had
the "oh crud, someone checked an HTML file into the repository and someone
else pushed the code live and the HTML file was not ready and had (1)
database passwords or (2) some other sensitive information in it."  With
SiteMap, you need to say, "Yes, this page is available and approved for
use."

Second, SiteMap enforces access control rules.  You can add conditional
tests to every page and the page will not be served unless the rules all
pass.  This is a unified and declarative way to insure the access control
rules for your application are correct.


>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to