Strip <?xml ?> header from a subset of pages

14 views
Skip to first unread message

harryh

unread,
Nov 23, 2009, 2:49:39 PM11/23/09
to Lift
I want to send a subset (based on the path) of my pages without an <?
xml? header. Is there an easy way to do this?

I want to do this for pages meant for consumption by mobile devices
(many of which, it seems, have crappy web browsers that are getting
confused by this header).

-harryh

David Pollak

unread,
Nov 23, 2009, 3:03:33 PM11/23/09
to lif...@googlegroups.com
If you set S.skipDocType = false during the processing of the request for these devices, the <? ... ?> stuff will be omitted.


--

You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=.





--
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

harryh

unread,
Nov 23, 2009, 3:22:24 PM11/23/09
to Lift
That will skip the DOCTYPE though right?
I'm looking to avoid sending the XML header (<?xml version="1.0"
encoding="UTF-8"?>)

-harryh

On Nov 23, 3:03 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> If you set S.skipDocType = false during the processing of the request for
> these devices, the <? ... ?> stuff will be omitted.
>
>
>
> On Mon, Nov 23, 2009 at 11:49 AM, harryh <har...@gmail.com> wrote:
> > I want to send a subset (based on the path) of my pages without an <?
> > xml? header.  Is there an easy way to do this?
>
> > I want to do this for pages meant for consumption by mobile devices
> > (many of which, it seems, have crappy web browsers that are getting
> > confused by this header).
>
> > -harryh
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

David Pollak

unread,
Nov 23, 2009, 3:25:33 PM11/23/09
to lif...@googlegroups.com
On Mon, Nov 23, 2009 at 12:22 PM, harryh <har...@gmail.com> wrote:
That will skip the DOCTYPE though right?
I'm looking to avoid sending the XML header (<?xml version="1.0"
encoding="UTF-8"?>)

It will eliminate both the doctype and the <?xml ... ?> thing.

If you just need to the XML header removed, please open a ticket and we'll add a LiftRule for it.
 
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=.





--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890

harryh

unread,
Nov 23, 2009, 3:34:00 PM11/23/09
to Lift
> It will eliminate both the doctype and the <?xml ... ?> thing.

This does not appear to be the case. I just tried it (on M7). Also
looking at the code for NodeResponse this does not appear to be what
the code is doing.

-harryh

David Pollak

unread,
Nov 24, 2009, 6:40:10 PM11/24/09
to lif...@googlegroups.com
I've created issue 207: http://github.com/dpp/liftweb/issues/#issue/207


-harryh

--

You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=.


David Pollak

unread,
Nov 24, 2009, 7:19:42 PM11/24/09
to Lift
http://reviewboard.liftweb.net/r/124/

On Nov 24, 3:40 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> I've created issue 207:http://github.com/dpp/liftweb/issues/#issue/207
>
>
>
> On Mon, Nov 23, 2009 at 12:34 PM, harryh <har...@gmail.com> wrote:
> > > It will eliminate both the doctype and the <?xml ... ?> thing.
>
> > This does not appear to be the case. I just tried it (on M7).  Also
> > looking at the code for NodeResponse this does not appear to be what
> > the code is doing.
>
> > -harryh
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

harryh

unread,
Nov 25, 2009, 5:09:24 PM11/25/09
to Lift
It is not 100% obvious to me how I would, after this change is
submitted, avoid sending an <?xml?> header when serving pages under a
certain path.

Should we be adding something similar to S.skipDocType
(S.skipXmlHeader)?

-harryh

David Pollak

unread,
Nov 25, 2009, 6:18:24 PM11/25/09
to lif...@googlegroups.com
object excludeXmlHeaderStuff extends RequestVar(false)

in boot:

val current = LiftRules.calculateXmlHeader
LiftRules.calculateXmlHeader = (resp, node, contentType) => if (excludeXmlHeaderStuff) "" else current(resp, node, contentType)




-harryh

--

You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
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

Timothy Perrett

unread,
Nov 25, 2009, 6:24:15 PM11/25/09
to lif...@googlegroups.com
David,

I read harry's other email with interest - and thinking about it, it seems this style of implementation differs quite significantly from S.skipDocType. It strikes me that a LiftRules configuration is our usual idiom; is there a reason that S.skipDocType falls out of this?

One way or another I think we ought to make these API's similar as they are fairly close in terms of likely use cases.

Cheers, Tim

David Pollak

unread,
Nov 25, 2009, 6:26:56 PM11/25/09
to lif...@googlegroups.com
I'm not opposed to adding a skipXmlThingy style as well, but giving the developer a generic function for inserting this XML top-matter is the higher priority.

Timothy Perrett

unread,
Nov 25, 2009, 7:48:11 PM11/25/09
to lif...@googlegroups.com
I dont disagree - I was just wanting to comment on the consistency of the API :-)

Cheers, Tim
Reply all
Reply to author
Forward
0 new messages