From matthias-kpax at mteege.de Tue May 8 13:07:16 2007 From: matthias-kpax at mteege.de (Matthias Teege) Date: Tue, 8 May 2007 13:07:16 +0000 Subject: [kpax-devel] static-root problem Message-ID: <82d31a0a205277d71a7807eb796c2687@mteege.de> Moin, I try to define a webapp with a static-route like this: (defwebapp :blub (:index 'blub-home) (:static-root "static/") (:unsecure t)) If I try to compile this part on SBCL I've got The value NIL is not of type (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING PATHNAME FILE-STREAM). [Condition of type TYPE-ERROR] I'snt "static/" a string? Many thanks Matthias From scaekenberghe at common-lisp.net Tue May 8 14:02:59 2007 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Tue, 8 May 2007 16:02:59 +0200 Subject: [kpax-devel] static-root problem In-Reply-To: <82d31a0a205277d71a7807eb796c2687@mteege.de> References: <82d31a0a205277d71a7807eb796c2687@mteege.de> Message-ID: <68928226-E1F3-4BDC-B02A-933F1C7BA0AB@common-lisp.net> Matthias, On 08 May 2007, at 15:07, Matthias Teege wrote: > Moin, > > I try to define a webapp with a static-route like this: > > (defwebapp :blub > (:index 'blub-home) > (:static-root "static/") > (:unsecure t)) > > If I try to compile this part on SBCL I've got > > The value NIL > is not of type > (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING PATHNAME FILE- > STREAM). > [Condition of type TYPE-ERROR] > > I'snt "static/" a string? > > Many thanks > Matthias > > _______________________________________________ > KPAX-devel mailing list > KPAX-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/kpax-devel Did you by any chance evaluate the defwebapp form from within an editor to a listener or directly into a listener ? This does not work and might give you an error like the one above. You have to write defwebapp forms in a file and compile or load them as a whole. The reason is that the defwebapp macro uses (or *load-truename* *compile-file-truename*) to resolve the static root relative against the location of the source file. HTH, Sven From matthias-kpax at mteege.de Wed May 9 07:13:28 2007 From: matthias-kpax at mteege.de (Matthias Teege) Date: Wed, 9 May 2007 07:13:28 +0000 Subject: [kpax-devel] static-root problem In-Reply-To: <68928226-E1F3-4BDC-B02A-933F1C7BA0AB@common-lisp.net> Message-ID: > and might give you an error like the one above. You have to write > defwebapp forms in a file and compile or load them as a whole. Many thanks. That solves the problem. Matthias From matthias-kpax at mteege.de Sun May 20 07:47:57 2007 From: matthias-kpax at mteege.de (Matthias Teege) Date: Sun, 20 May 2007 07:47:57 +0000 Subject: [kpax-devel] static path Message-ID: Moin, I'm not sure where to put static pages in a kpax app. If I write data from my app they are relative to the home of the application but if I set '(:static-root "static/")' and put files in apphome/static I've got S-HTTP-SERVER: [4] No handler found for # How do I access the static files? Many thanks Matthias From scaekenberghe at common-lisp.net Thu May 24 11:46:39 2007 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Thu, 24 May 2007 13:46:39 +0200 Subject: [kpax-devel] static path In-Reply-To: References: Message-ID: <5EF2BC2F-C9FA-4336-8F0D-4CD5F936A65E@common-lisp.net> Matthias, On 20 May 2007, at 09:47, Matthias Teege wrote: > I'm not sure where to put static pages in a kpax app. If I write data > from my app they are relative to the home of the application but if I > set '(:static-root "static/")' and put files in apphome/static I've > got > S-HTTP-SERVER: [4] No handler found for # REQUEST GET "/kpax/static/wapp/wapp.css" {A93DB89}> > > How do I access the static files? Let's recap a little bit. KPAX webapps work with 2 kinds of computed URL's: dynamic URLs and static URLs. Apart from those, you can of course insert any URL in your HTML. The reason to separate the static ones from the dynamic ones is to have a later option to optimize: in a very heavy loaded production web app, Lisp should only serve the dynamic content, while apache or a content delivery network should serve all the static content. The function DYNAMIC-URL generates a new URL in the context of the current webapp, given a number of parameter, typically a handler- function name and a couple of variables name-and-value pairs. The function STATIC-URL generates a new URL in the context or scope of the current webapp or the current web app server, most often with a static resource name, but format-based substitution is also possible. If the scope is :SERVER, the static path of the server is used as prefix. KPAX-USER 5 > (get-static-prefix *web-app-server*) "/kpax/static/" If the scope is :WEBAPP, the static path of the server is combined (concatenated) with that of the web app itself (normally its name) and used as a prefix. KPAX-USER 11 > (kpax::get-complete-static-prefix :webapp (get-web- app :helloworld1) *web-app-server*) "/kpax/static/helloworld1/" So, using this in a webapp's handler we get: KPAX-USER 13 > (static-url *last-request-response* :server "nx.css") "/kpax/static/nx.css" KPAX-USER 14 > (static-url *last-request-response* :webapp "kpax- movie-poster.jpg") "/kpax/static/helloworld1/kpax-movie-poster.jpg" KPAX-USER 15 > (dynamic-url *last-request-response* 'helloworld1-start) "/kpax/dynamic/helloworld1/helloworld1-start" Now, the URL is only one part: the resource in specified the URL has yet to be served by some code. In the case of dynamic-url's this is of course always Lisp. In the case of static-url's there are some options (which also depend on how KPAX is used, s-http-server, mod- lisp or portable allegro serve). In the mod-lisp case, everything must always be done explicitely by hand. To make development easy, there is an option called :static-root for web-apps. If that option is specified, KPAX will try to serve static files from a directory named in the option, relative to the location of the webapp's source file. For the HELLOWORLD1 example, the definition is: (defwebapp :helloworld1 (:index 'helloworld1-start) (:static-root "static/") (:unsecure t)) Using the S-HTTP-SERVER option, a static resource server routing will be set up that translates the prefix "/kpax/static" to (in my case, helloworld1.lisp is located in "/Users/sven/darcs/kpax/example/") the actual directory "/Users/sven/darcs/kpax/example/static". The 2 static examples above then become: "/kpax/static/nx.css" -> /Users/sven/darcs/kpax/example/static/nx.css" "/kpax/static/helloworld1/kpax-movie-poster.jpg" -> /Users/sven/darcs/ kpax/example/static/helloworld1/kpax-movie-poster.jpg" You can inspect some of the internals of S-HTTP-SERVER at the URL /s- http-server where you can see the actual routing info. As I said before, in a production case, you wouldn't use or at least override this automatic mechanism and manually configure the serving of static resources. In your example, the actual file path should be /static/wapp/ wapp.css Regards, Sven From scaekenberghe at common-lisp.net Thu May 24 13:10:47 2007 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Thu, 24 May 2007 15:10:47 +0200 Subject: [kpax-devel] KPAX to use Ironclad Message-ID: <9D83601E-F919-48FC-8375-A575EB989028@common-lisp.net> Hi All, From now on, KPAX will be using Ironclad, a high-quality crypto library for Common Lisp, written by Nathan Froyd. The following files have been removed from the KPAX distribution: md5.lisp, sha1.lisp and hmac.lisp The total source code line count decreased from 6236 to 4897. The darcs repository has been updated, the released tarball will follow after some more testing. Thanks, Nathan! Regards, Sven From scaekenberghe at common-lisp.net Thu May 24 12:13:55 2007 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Thu, 24 May 2007 14:13:55 +0200 Subject: Fwd: [kpax-devel] Are sessions serializable? References: <5CB186E5-1245-4A81-B2C7-57E630FBA468@common-lisp.net> Message-ID: <6F30CDC0-85BA-43F4-B3E8-412303E2C359@common-lisp.net> For the record ;-) Begin forwarded message: > From: Sven Van Caekenberghe > Date: Mon 7 May 2007 11:00:05 GMT+02:00 > To: B W > Subject: Re: [kpax-devel] Are sessions serializable? > > Hi Bob, > > On 29 Apr 2007, at 09:08, B W wrote: > >> Hi, >> >> I am a newbie. I was wondering if the session objects are >> serializable to disk or database, so that they can be shared among >> multiple images. >> >> Thanks! >> >> Bob > > At the moment, there is no explicit support for this in KPAX, nor > have I experimented with this, although I would want to do this, > given enough incentive (scaling problems) and time. > > On the other hand, it would not have to be very hard. There are > explicit classes for SESSION and SESSION-MANAGER, with consistently > used protocols to keep the dependencies under control. But in order > to do this, you need a sharing technology: I find Ruby on Rails' > default way of storing all session in an RDBMS or file all the time > quite stupid since you'll hit the DB or filesystem much too often. > There are better ways, but they get more complicated quite quickly > (especially if you want to make them failsafe). > > HTH, > > Regards, > > Sven > > PS: You have to subscribe to this mailinglist in order to post; I > have allowed this posting manually but can't keep doing this. > From matthias-kpax at mteege.de Sun May 27 16:37:42 2007 From: matthias-kpax at mteege.de (Matthias Teege) Date: Sun, 27 May 2007 16:37:42 +0000 Subject: [kpax-devel] static-path Message-ID: <0d85b59564b4831cb8c9a0082271017a@mteege.de> Moin, some days ago I ask about static-path and I've got a detailed answer from Sven. Many thanks for that. I've killed the Email to early so I have to open a new thread. I don't get static paths to work. I checked /s-http-server and there ist no static-handler registered. On http://kpax.wolf359.be/s-http-server it looks like: S-HTTP-SERVER:STATIC-RESOURCE-HANDLER /kpax/static/ (#P"/home/sven/darcs/kpax/example/static/") ... but on my server: # /kpax/dynamic/ NIL S-HTTP-SERVER:S-HTTP-SERVER-HANDLER /s-http-server (:BUILTIN) S-HTTP-SERVER:FAVICON-HANDLER /favicon.ico (:BUILTIN) Thats all. Do I need to register a static-handler? How do I register the static-handler? Many thanks again Matthias From scaekenberghe at common-lisp.net Mon May 28 07:55:08 2007 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Mon, 28 May 2007 09:55:08 +0200 Subject: [kpax-devel] static-path In-Reply-To: <0d85b59564b4831cb8c9a0082271017a@mteege.de> References: <0d85b59564b4831cb8c9a0082271017a@mteege.de> Message-ID: On 27 May 2007, at 18:37, Matthias Teege wrote: > Moin, > > some days ago I ask about static-path and I've got a detailed answer > from Sven. Many thanks for that. I've killed the Email to early so I > have to open a new thread. > > I don't get static paths to work. I checked /s-http-server and there > ist no static-handler registered. > > On http://kpax.wolf359.be/s-http-server it looks like: > > S-HTTP-SERVER:STATIC-RESOURCE-HANDLER /kpax/static/ (#P"/home/sven/ > darcs/kpax/example/static/") > ... > > but on my server: > > # /kpax/ > dynamic/ NIL > S-HTTP-SERVER:S-HTTP-SERVER-HANDLER /s-http-server (:BUILTIN) > S-HTTP-SERVER:FAVICON-HANDLER /favicon.ico (:BUILTIN) > > Thats all. Do I need to register a static-handler? How do I register > the static-handler? > > Many thanks again > Matthias In the KPAX + S-HTTP-SERVER case, the static paths should be added automatically when you start KPAX. More specifically, every web-app registered is started when KPAX starts, when KPAX stops the are all stopped. Part of starting a web-app is ensuring the static serving part works. KPAX 22 > (start-kpax) ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Started # ;; KPAX 20070528T074956 INFO Server running # KPAX 23 > (pprint (s-http-server:get-contexts (get-s-http-server *web- app-server*))) ((S-HTTP-SERVER:STATIC-RESOURCE-HANDLER "/kpax/static/" #P"/Users/ sven/darcs/kpax/example/static/") (# "/kpax/dynamic/") (S-HTTP-SERVER:S-HTTP-SERVER-HANDLER "/s-http-server" :BUILTIN) (S-HTTP-SERVER:FAVICON-HANDLER "/favicon.ico" :BUILTIN)) KPAX 24 > (stop-kpax) ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Stopped # ;; KPAX 20070528T075114 INFO Server stopped and ready # You can manually do start-web-app or stop-web-app. The auto-start/ stop trick is relatively recent. Are you sure you have your web-app(s) defined/loaded ? HTH, Sven From matthias-kpax at mteege.de Mon May 28 10:01:56 2007 From: matthias-kpax at mteege.de (Matthias Teege) Date: Mon, 28 May 2007 10:01:56 +0000 Subject: [kpax-devel] static-path In-Reply-To: Message-ID: <0fa8b353e8bf35d53e55f8f302b777b6@mteege.de> > Are you sure you have your web-app(s) defined/loaded ? Yes, bit I never run (start-web-app :wapp). After running that I see the static handler. Hmm, its a little confusing because I run the app all the time without (start-web-app). I simple open the file with slime and compile it. It works now. Many thanks again. Matthias