Difference between revisions of "Custom handlers"

From EPrints Documentation
Jump to: navigation, search
m
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
It has been more common to integrate EPrints with third-party applications such as [https://www.elsevier.com/en-gb/solutions/pure Pure].  In the past there has been two ways to incorporate custom handlers for such integration.   
 
It has been more common to integrate EPrints with third-party applications such as [https://www.elsevier.com/en-gb/solutions/pure 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 [https://www.mail-archive.com/modperl@apache.org/msg32317.html race condition with mod_perl], in particular when intergating Pure's PDA handler.   
+
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 [https://www.mail-archive.com/modperl@apache.org/msg32317.html 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 PDS handler:
+
The other option has been to hack <code>perl_lib/EPrints/Apache/Rewrite.pm</code> to include a block of code for your custom handler.  Since [[EPrints_3.4.2 | 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}->{regex} = '^URLPATH/pda';
Line 15: Line 17:
 
  };
 
  };
  
''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'''.
+
<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.