Difference between revisions of "Custom handlers"

From EPrints Documentation
Jump to: navigation, search
(Add page about custom handlers)
 
(Added category)
Line 15: Line 15:
 
  };
 
  };
  
''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_path/).  If you custom handler configuration like this, there is no need to edit your webserver configuration, add a rewrite_exception to your configuration or hack ''perl_lib/EPrints/Apache/Rewrite.pm'''.
+
''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_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'''.
 +
 
 +
[[Category::Manual]]

Revision as of 19:21, 23 July 2020

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 addoing a Location block to the webserver configuration and a rewrite exception to the the rewrite_exceptions configuration array. This has been seen to cause a race condition with mod_perl, in particular when intergating 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 PDS 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_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'.

[[Category::Manual]]