Difference between revisions of "Custom handlers"
m (typos&formatting corrected) |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 19: | Line 19: | ||
<code>URLPATH</code> is used as a macro for the path that the EPrints repository is hosted on. Typically this will be empty unless EPrints is run under some ''sub'' path (e.g. <nowiki>http://eprints.example.org/</nowiki>''some_sub_path''/). If you add custom handler configuration like this to your archive's <code>cfg/cfg.d/</code> directory, there is no need to edit your webserver configuration, add a rewrite_exception to your configuration or hack <code>perl_lib/EPrints/Apache/Rewrite.pm</code>. | <code>URLPATH</code> is used as a macro for the path that the EPrints repository is hosted on. Typically this will be empty unless EPrints is run under some ''sub'' path (e.g. <nowiki>http://eprints.example.org/</nowiki>''some_sub_path''/). If you add custom handler configuration like this to your archive's <code>cfg/cfg.d/</code> directory, there is no need to edit your webserver configuration, add a rewrite_exception to your configuration or hack <code>perl_lib/EPrints/Apache/Rewrite.pm</code>. | ||
− | [[Category:Manual]] | + | [[Category:Manual]] [[Category:Howto]] |
Latest revision as of 18:02, 22 January 2022
It has been more common to integrate EPrints with third-party applications such as Pure. In the past there has been two ways to incorporate custom handlers for such integration.
One method requires adding a Location block to the webserver configuration and a rewrite exception to the rewrite_exceptions configuration array. This has been seen to cause a race condition with mod_perl, in particular when integrating Pure's PDA handler.
The other option has been to hack perl_lib/EPrints/Apache/Rewrite.pm
to include a block of code for your custom handler. Since EPrints 3.4.2 specifying custom handlers is now possible as part of the EPrints configuration.
Below is the configuration you should use if you want to integrate Pure's PDA handler:
$c->{custom_handlers}->{pda}->{regex} = '^URLPATH/pda'; $c->{custom_handlers}->{pda}->{function} = sub { my ( $r ) = @_; $r->handler( 'perl-script' ); $r->set_handlers( PerlResponseHandler => [ 'PDA::PDAHandler' ] ); return EPrints::Const::OK; };
URLPATH
is used as a macro for the path that the EPrints repository is hosted on. Typically this will be empty unless EPrints is run under some sub path (e.g. http://eprints.example.org/some_sub_path/). If you add custom handler configuration like this to your archive's cfg/cfg.d/
directory, there is no need to edit your webserver configuration, add a rewrite_exception to your configuration or hack perl_lib/EPrints/Apache/Rewrite.pm
.