[Lift] Re: dynamic javascript files

2009-09-10 Thread Naftoli Gugenheim

Don't you have to check the request headers if the client accepts gzipped?

-
David Pollak wrote:

On Thu, Sep 10, 2009 at 5:04 PM, Charles F. Munat  wrote:

>
> That works. Thanks!
>
> So if I wanted to build a large JavaScript script in pieces in different
> files, and then combine all those files together and add in some
> dynamically generated stuff, and finally gzip the whole thing and send
> it out using the trick below, how would one do that? I'm looking around
> and I don't see anything about gzip.
>
>
You would just gzip the Array[Byte] that you're sending back and include a
header item specifying that it was gziped


> And should JS go out as a JavaScriptResponse or is PlainText OK?
>

JavaScriptResponse sets the correct headers.


>
> Chas.
>
> David Pollak wrote:
> > LiftRules.dispatch.append {
> >   case Req("custom" :: "js_file", "js", GetRequest) => ... create a
> > LiftResponse that contains the file here
> > }
> >
> > On Thu, Sep 10, 2009 at 4:43 PM, Charles F. Munat  > > wrote:
> >
> >
> > Memory fails. How do I create a dynamic .js file with scala and then
> > serve it through lift? I did this before, but now my brain has gone
> > blank. I want to preload some JS variables for use in other scripts,
> > generating the variable content via scala. Entiende?
> >
> > Chas.
> >
> >
> >
> >
> >
> > --
> > 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
> >
> > >
>
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: dynamic javascript files

2009-09-10 Thread Charles F. Munat

Thanks. I'll play with that.

Chas.

David Pollak wrote:
> 
> 
> On Thu, Sep 10, 2009 at 5:04 PM, Charles F. Munat  > wrote:
> 
> 
> That works. Thanks!
> 
> So if I wanted to build a large JavaScript script in pieces in different
> files, and then combine all those files together and add in some
> dynamically generated stuff, and finally gzip the whole thing and send
> it out using the trick below, how would one do that? I'm looking around
> and I don't see anything about gzip.
> 
> 
> You would just gzip the Array[Byte] that you're sending back and include 
> a header item specifying that it was gziped
>  
> 
> And should JS go out as a JavaScriptResponse or is PlainText OK?
> 
> 
> JavaScriptResponse sets the correct headers.
>  
> 
> 
> Chas.
> 
> David Pollak wrote:
>  > LiftRules.dispatch.append {
>  >   case Req("custom" :: "js_file", "js", GetRequest) => ... create a
>  > LiftResponse that contains the file here
>  > }
>  >
>  > On Thu, Sep 10, 2009 at 4:43 PM, Charles F. Munat  
>  > >> wrote:
>  >
>  >
>  > Memory fails. How do I create a dynamic .js file with scala
> and then
>  > serve it through lift? I did this before, but now my brain
> has gone
>  > blank. I want to preload some JS variables for use in other
> scripts,
>  > generating the variable content via scala. Entiende?
>  >
>  > Chas.
>  >
>  >
>  >
>  >
>  >
>  > --
>  > 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
>  >
>  > >
> 
> 
> 
> 
> 
> -- 
> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: dynamic javascript files

2009-09-10 Thread David Pollak
On Thu, Sep 10, 2009 at 5:04 PM, Charles F. Munat  wrote:

>
> That works. Thanks!
>
> So if I wanted to build a large JavaScript script in pieces in different
> files, and then combine all those files together and add in some
> dynamically generated stuff, and finally gzip the whole thing and send
> it out using the trick below, how would one do that? I'm looking around
> and I don't see anything about gzip.
>
>
You would just gzip the Array[Byte] that you're sending back and include a
header item specifying that it was gziped


> And should JS go out as a JavaScriptResponse or is PlainText OK?
>

JavaScriptResponse sets the correct headers.


>
> Chas.
>
> David Pollak wrote:
> > LiftRules.dispatch.append {
> >   case Req("custom" :: "js_file", "js", GetRequest) => ... create a
> > LiftResponse that contains the file here
> > }
> >
> > On Thu, Sep 10, 2009 at 4:43 PM, Charles F. Munat  > > wrote:
> >
> >
> > Memory fails. How do I create a dynamic .js file with scala and then
> > serve it through lift? I did this before, but now my brain has gone
> > blank. I want to preload some JS variables for use in other scripts,
> > generating the variable content via scala. Entiende?
> >
> > Chas.
> >
> >
> >
> >
> >
> > --
> > 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
> >
> > >
>
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: dynamic javascript files

2009-09-10 Thread Charles F. Munat

That works. Thanks!

So if I wanted to build a large JavaScript script in pieces in different 
files, and then combine all those files together and add in some 
dynamically generated stuff, and finally gzip the whole thing and send 
it out using the trick below, how would one do that? I'm looking around 
and I don't see anything about gzip.

And should JS go out as a JavaScriptResponse or is PlainText OK?

Chas.

David Pollak wrote:
> LiftRules.dispatch.append {
>   case Req("custom" :: "js_file", "js", GetRequest) => ... create a 
> LiftResponse that contains the file here
> }
> 
> On Thu, Sep 10, 2009 at 4:43 PM, Charles F. Munat  > wrote:
> 
> 
> Memory fails. How do I create a dynamic .js file with scala and then
> serve it through lift? I did this before, but now my brain has gone
> blank. I want to preload some JS variables for use in other scripts,
> generating the variable content via scala. Entiende?
> 
> Chas.
> 
> 
> 
> 
> 
> -- 
> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: dynamic javascript files

2009-09-10 Thread David Pollak
LiftRules.dispatch.append {
  case Req("custom" :: "js_file", "js", GetRequest) => ... create a
LiftResponse that contains the file here
}

On Thu, Sep 10, 2009 at 4:43 PM, Charles F. Munat  wrote:

>
> Memory fails. How do I create a dynamic .js file with scala and then
> serve it through lift? I did this before, but now my brain has gone
> blank. I want to preload some JS variables for use in other scripts,
> generating the variable content via scala. Entiende?
>
> Chas.
>
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---