As has been discussed, there are lots of ways to do a custom 404 in Lift or
in the container.  What other use cases are there for changing the response
code for an XHTML page?

On Tue, Dec 29, 2009 at 1:40 PM, Alex Black <[email protected]> wrote:

> Hi Marius, I was trying to find a way to give a custom 404 response
> without changing the url (e.g. using a redirect) and returning a 404
> status code.
>
> Before I found a solution, I found an almost solution which let me use
> a sitemap menu to display a page when no other page matched but the
> status code was still 200, so I posted this question to find out if I
> could change it to 404.
>
> I found another solution, here:
> http://groups.google.com/group/liftweb/browse_thread/thread/4a9806a63419644f
>
> On Dec 29, 4:34 pm, Marius <[email protected]> wrote:
> > This can be easily done with
> >
> > LiftRules.responseTransformers.append{
> >
> >   case liftResponse => ... do your thing and return a LiftResponse
> >
> > }
> >
> > May I ask what is the usecase of this need?
> >
> > Br's,
> > Marius
> >
> > On Dec 29, 8:01 pm, Ross Mellgren <[email protected]> wrote:
> >
> > > I don't think this addresses his question directly, which is how to
> > > change the response code while already yielding control of the
> > > generated LiftResponse to the template mechanism.
> >
> > > If that's what the question is, then the answer (without a change to
> > > lift) is probably to alter LiftRules.convertResponse, which is where
> > > the 200 response code looks to be generated from right now. It looks
> > > like it wouldn't be trivial, but it would be doable.
> >
> > > -Ross
> >
> > > On Dec 29, 2009, at 12:57 PM, Timothy Perrett wrote:
> >
> > > > I would certainly recommend you take a closer look at the
> > > > LiftResponse subclasses.... your other question in another thread
> > > > (that I already answered) is equally solved by looking at
> > > > LiftResponse.
> >
> > > > It depends what type of response you want, but at a base level,
> > > > InMemoryResponse will do what you want... as I said, you need to
> > > > look at LiftResponse subclasses and find the one that suits your
> > > > needs.
> >
> > > > Cheers, Tim
> >
> > > > On 29 Dec 2009, at 17:07, Alex Black wrote:
> >
> > > >> In my snippet I'd like to change the response status code from the
> > > >> default 200 to something else, say 201, or 404. (see
> > > >>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).
> >
> > > >> I see there is a method on S to change the doctype, but I don't see
> > > >> one to change the status code.
> >
> > > >> Thanks,
> >
> > > >> - Alex
> >
> > > >> --
> >
> > > >> 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]<liftweb%[email protected]>
> > > >> .
> > > >> For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en
> > > >> .
> >
> > > > --
> >
> > > > 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]<liftweb%[email protected]>
> > > > .
> > > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en
> > > > .
>
> --
>
> 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]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>


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

--

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