Debugging strange problems, unwanted persistance and similar (was: Re: Provider problems)

2003-10-13 Thread Jörg Walter
On Thursday, 09. October 2003 21:37, Christian Jaeger wrote:
> >- 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).

See http://www.axkit.org/wiki/view/AxKit/DebuggingStrangeProblems

-- 
CU
  Joerg

PGP Public Key at http://ich.bin.kein.hoschi.de/~trouble/public_key.asc
PGP Key fingerprint = D34F 57C4 99D8 8F16 E16E  7779 CDDC 41A4 4C48 6F94


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Provider problems

2003-10-09 Thread Christian Jaeger
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]


Provider problems

2003-10-09 Thread Christian Jaeger
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=&g

Re: Provider Problems

2003-06-26 Thread Kip Hampton
Robert Ferney wrote:
Sorry for the mail spam yall.
No problem-- sorry you had to resort to such a one-sided conversation 
:-) Just to follow up, though: you're right, you should be using 
AxContentProvider instead of AxProvider. I'll post the details (that a 
crappy SMTP host precluded me from sending yesterday) below:

Providers come in two flavors: Content Providers for fetching source of 
the XML content to be transformed/delivered, and Style Providers for 
fetching the source of the stylesheets that will be applied during the 
various transformation steps. By default, the Provider::File class (that 
 grabs data from files on disk) is used for both.

When overriding the default Provider you have a choice of three 
configuration directives to control behavior:

1) AxContentProvider  -- this sets the class that will be 
used to select the source XML (and dependencies) for the content 
associated w/ the current request.

2) AxStyleProvider  -- this sets the Provider class for the 
stylesheet documents (and dependencies) for the current set of 
transformations.

3) AxProvider  -- this sets *both* the Style Provider and 
Content Provider to the same class (meaning that the same class has to 
be prepared to return both the source content and the stylesheet content).

I suspect that your Edu::Provider::Student class is expecting to return 
only the content source (not the stylesheet source as well) so you 
should use the AxContentProvider directive instead of AxProvider.

Note that the reason you only see the error when an AxAddProcessor
directive is present is that, with that directive in place, plus the use
of AxProvider (rather than AxContentProvider) AxKit is trying to use
your Edu::Provider::Student to fetch the source for the given stylesheet
and by having a transforation defined you expose the fact that your
Provider was meant only to return the base content not the stylesheet data.
-kip

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Provider Problems

2003-06-25 Thread Robert Ferney
Sorry for the mail spam yall.

ended up digging through the source for 
package Apache::AxKit::Provider::File;
...
sub get_strref {
...
throw Apache::AxKit::Exception::IO(
  -text => "$self->{file} is a directory - please overload File
provider and use AxContentProvider option");
...
}

I think my problem was that my configuration was using 
AxProvider My::Provider
instead of 
AxContentProvider My::Provider

Changed that and now it works.

On Wed, 2003-06-25 at 18:48, Robert Ferney wrote:
> Ok, found the documentation for this..
> http://www.axkit.org/wiki/view/AxKit/Apache::AxKit::Provider#
> silly me.
> 
> On Wed, 2003-06-25 at 18:28, Robert Ferney wrote:
> > I took a closer look at the error log.
> > It appears that the Provider is trying to handle the request for the
> > stylesheet even though the request is outside of the location that it is
> > supposed be handling,
> > 
> > so, perhaps more relevant question.
> > How do you get your provider to ignore requests for stuff it shouldn't
> > be handling in the first place.
> > 
> > 
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Provider Problems

2003-06-25 Thread Robert Ferney
Ok, found the documentation for this..
http://www.axkit.org/wiki/view/AxKit/Apache::AxKit::Provider#
silly me.

On Wed, 2003-06-25 at 18:28, Robert Ferney wrote:
> I took a closer look at the error log.
> It appears that the Provider is trying to handle the request for the
> stylesheet even though the request is outside of the location that it is
> supposed be handling,
> 
> so, perhaps more relevant question.
> How do you get your provider to ignore requests for stuff it shouldn't
> be handling in the first place.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Provider Problems

2003-06-25 Thread Robert Ferney
I took a closer look at the error log.
It appears that the Provider is trying to handle the request for the
stylesheet even though the request is outside of the location that it is
supposed be handling,

so, perhaps more relevant question.
How do you get your provider to ignore requests for stuff it shouldn't
be handling in the first place.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Provider Problems

2003-06-25 Thread Robert Ferney
On Wed, 2003-06-25 at 17:24, Michael Chamberlain wrote:
> >> Any ideas as to what is going on?
> >>
> 
> I'd guess that your stylesheet isn't valid xml.
> 
> Mike.

I thought of that, but when I test the same stylesheet by using an
on-disk version of the xml file the provider is generating and specify
the stylesheet either with the 
  AxAddProcessor text/xsl /xslt/user.xsl
or by adding the specification in via the xml header stylesheet
directive it works, without errors.. 
the stylesheet isn't changing, just not using the provider, which also
works by itself.. ie: I can browse to the provided file, as long as I
don't try to apply a stylesheet.

Attaching the stylesheet ..


http://www.w3.org/1999/XSL/Transform";
version="1.0">

http://www.w3.org/TR/REC-html40/loose.dtd";
cdata-section-elements = ""
indent = "yes"
media-type = "text/html" /> 


  

  
  




  



  
  
  
  
  
  






  

  


  mailto:{.}";>

  





  

  


  





   
 
   




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Provider Problems

2003-06-25 Thread Robert Ferney
PS: I tried making a plain on disk xml file in another directory like
such..
---



  rob
  Robert
  Robert William Ferney
  Ferney
  [EMAIL PROTECTED]


and it works

On Wed, 2003-06-25 at 17:19, Robert Ferney wrote:
> I'm having trouble using a Provider, when I try to specify a Stylesheet.
> 
> my .htaccess file looks like this.
> -
> 
>   PerlHandler AxKit
>   AxProvider Edu::Provider::Student
> 
> #  AxAddProcessor text/xsl /xslt/user.xsl
> 
>   AddType text/xml .xml
>   AddHandler axkit .xml
> 
> -
> The Provider output looks like this.
> -
> 
> 
>   rob
>   Robert
>   Robert William Ferney
>   Ferney
>   [EMAIL PROTECTED]
> 
> -
> When I uncomment the AxAddProcessor I get the following error in my
> apache error log.
> --
> compilation error: file /user/rob.xml element users
> xsltParseStylesheetProcess : document is not a stylesheet
> [Wed Jun 25 17:00:01 2003] [error] [client 192.168.0.4] [AxKit] [Error]
> Can't call method "transform" on an undefined value at
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/AxKit/Language/LibXSLT.pm line 120.
> --
> Any ideas as to what is going on?
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Provider Problems

2003-06-25 Thread Robert Ferney
I'm having trouble using a Provider, when I try to specify a Stylesheet.

my .htaccess file looks like this.
-

  PerlHandler AxKit
  AxProvider Edu::Provider::Student

#  AxAddProcessor text/xsl /xslt/user.xsl

  AddType text/xml .xml
  AddHandler axkit .xml

-
The Provider output looks like this.
-


  rob
  Robert
  Robert William Ferney
  Ferney
  [EMAIL PROTECTED]

-
When I uncomment the AxAddProcessor I get the following error in my
apache error log.
--
compilation error: file /user/rob.xml element users
xsltParseStylesheetProcess : document is not a stylesheet
[Wed Jun 25 17:00:01 2003] [error] [client 192.168.0.4] [AxKit] [Error]
Can't call method "transform" on an undefined value at
/usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/AxKit/Language/LibXSLT.pm line 120.
--
Any ideas as to what is going on?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]