You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@sergeant.org on 2006/08/02 21:02:47 UTC

[SVN] [27] XSP demo

Revision: 27
Author:   matt
Date:     2006-08-02 19:02:27 +0000 (Wed, 02 Aug 2006)

Log Message:
-----------
XSP demo

Added Paths:
-----------
    trunk/plugins/demo/serve_xsp

Added: trunk/plugins/demo/serve_xsp
===================================================================
--- trunk/plugins/demo/serve_xsp	2006-08-01 20:52:12 UTC (rev 26)
+++ trunk/plugins/demo/serve_xsp	2006-08-02 19:02:27 UTC (rev 27)
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+
+sub init {
+    my $self = shift;
+    
+    $self->register_config('XSP_Match', sub { $self->matchfiles(@_) });
+}
+
+sub matchfiles {
+    my ($self, $conf) = (shift, shift);
+    
+    my $key = $self->plugin_name . '::matchfiles';
+    @_ and $conf->notes($key, shift);
+    $conf->notes($key);
+}
+
+sub hook_xmlresponse {
+    my ($self, $input) = @_;
+    
+    $self->log(LOGDEBUG, "XSP Transform");
+    
+    my $match = $self->matchfiles($self->config);
+    
+    $self->log(LOGDEBUG, "Does ", $self->client->headers_in->filename, " match $match?");
+    return DECLINED unless $self->client->headers_in->filename =~ /$match/;
+    
+    my $out = $input->transform(XSP());
+    
+    return OK, $out;
+}
\ No newline at end of file