How to add custom servlet filter, via overlay DSpace 6.3 xmlui Mirage 2?

25 views
Skip to first unread message

Rodrigo Chávez

unread,
Jun 18, 2019, 4:59:19 PM6/18/19
to DSpace Community
Hi,

I want to add a header to the request, specifically X-Robots-Tag "noindex" when open the url of an item's file e.g. http://localhost:8080/xmlui/bitstream/handle/123456789/9876/name-of-file.pdf?sequence=2&isAllowed=y

I'm aware that custom changes to java classes must be placed in [dspace-source]/dspace/modules/* and changes of dspace-api must be placed in [dspace-source]/dspace/modules/additions.

In my case i want to add a new class no modify a existing one to dspace-xmlui that's why i placed new .java file in  [dspace-source]/dspace/modules/xmlui/src/main/java/org/dspace/app/xmlui/cocoon/servlet/multipart and
the configuration of my filter (web.xml file) is in [dspace-source]/dspace/modules/xmlui/src/main/webapp/WEB-INF. The web.xml file is a copy of the file placed in [dspace-source]/dspace-xmlui/src/main/webapp only with the addition of my servlet configuration.

I'm having doubts like:

The way i´m adding a new java class for a servlet is enterely correct?

Do i need to extend a DSpace servlet class, if i want to use servlet filters for a custom class?

Is there a specific folder to place a .java class for servlets ?

Greetings. Rodrigo.

PD. This servlet filter is for avoiding Google Analytics indexation for url's of files (i already add the rel="nofollow" but google analytics still indexing the .pdf url's, and I have also already configured my robots file) 





Reply all
Reply to author
Forward
0 new messages