Re: AxAddProcessor vs. StylePI
Nathan Schroeder wrote: Am I right in thinking there's no way to mix and match ? xml-stylesheet ? tags in an .xml file and AxAddProcessor directives in httpd.conf? My specific question is this: are all AxAddProcessor (and AxAddStyle) directives ignored once a file is determined to have its own stylesheet tags? I'm trying to put in a global (site-wide) named style for print formatting, and it's getting ignored since all of our pages have a specific tag, usually custom (generally the name of the page). Hopefully that makes sense. The documentation makes it sound like the stylesheet chaining carries into the httpd.conf file if no suitable style is found, but it doesn't seem to for me. AxKit does fall back to styles defined via httpd.conf (or .htaccess) but only if *no* stylesheet PIs in the document match. Since you have both a persistent style (one that is always applied) and a preferred style (one that has a title, but is not alternate and is hence used as the default) defined, AxKit doesn't examine the styles that may be set in the configuration file. So, the short answer is, yeah, styles defined via stylesheet PIs and configuration-based styles are a bit of an either-or-proposition at this point. As a side note, if you switch to an all configuration-based setup, remember that styles are combined from the bottom up through the path hierarchy. That is, given the following: Directory /site/root AxAddProcessor text/xsl /styles/root.xsl /Directory Location /dir1 AxAddProcessor text/xsl /styles/dir1.xsl /Location Location /dir1/mypage.xsp AxAddProcessor application/x-xsp NULL AxAddProcessor text/xsl /styles/mypage.xsl /Location For a request to /dir1/mypage.xsp these styles would be applied in the following order: XSP - mypage.xsl - dir1.xsl - global.xsl IOW, styles defined deeper in the tree are *prepended* to the list of processors (with the idea being that more generic styles are usually defined at higher levels). Maybe Steve Willer (who has built large-scale sites/apps with many per-resource transformations) and others might share some ideas here for another approach. -kip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
BasicSession question
I'm having a bit of trouble setting up AxKit::XSP::BasicSession -- sessions don't seem to be maintained from one page load to the next. my httpd.conf includes AxAddPlugin Apache::AxKit::Plugin::BasicSession AxAddXSPTaglib AxKit::XSP::BasicSession PerlSetVar BasicSessionDataStore DB_File PerlSetVar BasicSessionArgs FileName = /tmp/session my sample xsp page looks soemthing like this: xsp:page xmlns:xsp=http://www.apache.org/1999/XSP/Core; xmlns:session=http://www.apache.org/1999/XSP/Session; language=Perl page xsp:expr ${session:get-id/} /xsp:expr /page This prints a session id; however, reloading the page prints another session id, when I would expect to get the same one again. I'm accepting the cookie from the server. I've checked the file /tmp/session and it does get written to every time I access the page. This behavior is happening with Mozilla, IE, and lynx, so I don't think it's browser-related. Any ideas? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Provider problems
It seems this mail hasn't made it to the list. Cheers Christian. Date: Tue, 7 Oct 2003 14:45:09 +0200 To: [EMAIL PROTECTED] From: Christian Jaeger [EMAIL PROTECTED] Subject: Provider problems Hello I'm having many troubles and unclarities about providers. The attached provider solves this problem: - url's should be mapped to source files with a fallback strategy: if file.html is not found, look for file.xml, if not found, look for .xsp - translations depend on both url suffix and source suffix: .xsp files should always be executed as xsp, .xsp and .xml files should be translated with xsl if requested as .html, and so on. Now there is one problem and one question. - Problem: somehow new requests depend on previous requests. Some state information is preserved between requests. When I request an .xml file as .html, then even subsequent .xml requests yield the .html. In spite of AxNocache On in the apache condig, so it doesn't seem like a cache problem (though that's prolly an unsolved problem still). - Question: I'm coding my own typemap in this code. That's since I didn't know how the whole typemap stuff works. Suggestions for a clean mechanims welcome. Thanks, Christian. package Thea::Provider; use strict; use base 'Apache::AxKit::Provider::File'; sub init { my $self=shift; warn CJ init; my $rv=$self-SUPER::init(@_); delete $$self{file_exists}; ### gg return $rv; } sub process { my $self = shift; my $xmlfile = $self-{file}; unless ($self-exists()) { AxKit::Debug(5, file '$xmlfile' does not exist or is not readable); return 0; } if ($$self{cjfile_sourcetype} eq 'html') { return; # geht!!! } if (!$AxKit::FastHandler) { local $^W; if (($xmlfile =~ /\.xml$/i) || ($xmlfile =~ /\.html$/i)|| ##-- cj; nötig? ($self-{apache}-content_type() =~ /^(text|application)\/xml/) || $self-{apache}-pnotes('xml_string') ) { return 1; } } else { return 1; } AxKit::Debug(5, '$xmlfile' not recognised as XML); return 0; } sub exists { my $self = shift; my $file= $self-{file}; my $uri= $ENV{REQUEST_URI}; $uri=~ s/\?.*//s; my $is_dirindex= substr($uri,-1) eq '/'; if (!$is_dirindex and exists $$self{file_exists}){ return $self-{file_exists} } warn CJ determine media for '$file'..; if ($is_dirindex) { $$self{cjfile_media}='html'; warn CJ: es ist dirindex; } else { if ( $file=~ /\.html$/) { $$self{cjfile_media}='html'; } else { $$self{cjfile_media}= 'xml'; } } warn CJ determined media '$$self{cjfile_media}'; warn CJ: determine source for '$file'..; if ($file=~ /\.html$/) { if (-e AxKit::FromUTF8($file)) { $$self{cjfile_sourcetype}='html'; } else { $file=~ s/\.html$/.xml/; goto checkxml; } } elsif ($file=~ /\.xml$/) { checkxml: if (-e AxKit::FromUTF8($file)) { $$self{cjfile_sourcetype}='xml'; } else { $file=~ s/\.xml$/.xsp/; goto checkxsp; } } elsif ($file=~ /\.xsp$/) { checkxsp: if (-e AxKit::FromUTF8($file)) { $$self{cjfile_sourcetype}='xsp'; } else { warn CJ determine: nothing found; return; } } else { warn CJ determine: unknown extension; return; } warn CJ: determined source '$$self{cjfile_sourcetype}'; if (-r _ ) { $self-{file_exists} = 1; $$self{file}=$file; return 1; } else { AxKit::Debug(2, '$file' not readable); return; } } my %myowntypemap; $myowntypemap{xsp}{xml}= [{type= application/x-xsp, href=.}, {type= application/x-addparams, href=NULL}, ]; $myowntypemap{xsp}{html}= [{type= application/x-xsp, href=.}, {type= application/x-addparams, href=NULL}, {type= text/xsl, href= /xsl/htmlview.xsl}]; $myowntypemap{xml}{xml}= [{type= application/x-addparams, href=NULL}, {type= text/xsl, href= /xsl/flashview.xsl}, {type= application/x-stripwhitespace, href=NULL}, ]; $myowntypemap{xml}{html}= [{type= application/x-addparams, href=NULL}, {type= text/xsl, href= /xsl/htmlview.xsl}]; sub get_styles { my $self=shift; if ($$self{cjfile_media} eq 'html') { $$self{apache}-content_type(text/html); } my $res= $myowntypemap{ $$self{cjfile_sourcetype} }{$$self{cjfile_media}}; if (!$res) { warn CJ get_styles: fallback to super, since type/media $$self{cjfile_sourcetype}/$$self{cjfile_media} not found; $res= $self-SUPER::get_styles; } $res; } 1;
Never mind my earlier BasicSession question
Shortly after I sent the previous note, I read the README file for BasicSession, which I'd never run into before since I'd installed via CPAN and had been going by the perldoc, which seems to be out of date. I'm now following the readme directions and getting expected behavior. On Thu, 09 Oct 2003 14:54:38 -0500, [EMAIL PROTECTED] said: I'm having a bit of trouble setting up AxKit::XSP::BasicSession -- sessions don't seem to be maintained from one page load to the next. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Provider problems
At 21:38 Uhr +0200 09.10.2003, Christian Jaeger wrote: sub get_styles { my $self=shift; if ($$self{cjfile_media} eq 'html') { $$self{apache}-content_type(text/html); } my $res= $myowntypemap{ $$self{cjfile_sourcetype} }{$$self{cjfile_media}}; if (!$res) { warn CJ get_styles: fallback to super, since type/media $$self{cjfile_sourcetype}/$$self{cjfile_media} not found; $res= $self-SUPER::get_styles; } BTW: I *have* to call $self-SUPER::get_styles for not providing any style at all. Returning [] or undef does not work, throwing an exception neither, the only thing is SUPER::get_styles since that one calls into an XS getstyle function witch seems to work. This looks very strange to me and definitely looks like an unnecessary restriction (bug?). (Using AxKit CVS from a few weeks ago.) Christian. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]