JIRA - Adding Servlet Filter to web.xml

Hi, we are using JIRA 5.1 and trying to add new java servlet filter into web.xml, once i restart my JIRA service, server does not start, any suggestions to fix it? Thanks

2 answers

0 votes
Timothy Chin Community Champion Jun 26, 2013

any suggestions to fix it?

Remove the changes that you made?

Jira has a plugin module for Servlet Filters (https://developer.atlassian.com/display/JIRADEV/Servlet+Filter+Plugin+Module). Use this instead.

I see above URL and found example referring "atlassian-plugin.xml" and "com.example.myplugins.helloworld.HelloWorldFilter", I want to understand its development and deployment.

Can I see full working example or related documentation?

Thanks

Timothy Chin Community Champion Jun 26, 2013
<servlet-filter name="Hello World Servlet" key="helloWorld" class="com.example.myplugins.helloworld.HelloWorldFilter" location="before-dispatch" weight="200">
        <description>Says Hello World, Australia or your name.</description>
        <url-pattern>/helloworld</url-pattern>
        <init-param>
            <param-name>defaultName</param-name>
            <param-value>Australia</param-value>
        </init-param>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </servlet-filter>

You then hit this URL (http://yourserver/jira/helloworld). The class is a normal servlet.

Where i need to copy this "atlassian-plugin.xml" into JIRA code?

I have installed a JAR file as plugin and getting below error, but on administration site, I still see this as installed and active:

846x1407x1 1qb3y6x 127.0.0.1 /rest/plugins/1.0/com.atlassian.customjirablockfilter-key [atlassian.plugin.manager.DefaultPluginManager] Found dependent enabled plugins for uninstalled plugin 'com.atlassian.customjirablockfilter': []. Disabling...

846x1407x1 1qb3y6x 127.0.0.1 /rest/plugins/1.0/com.atlassian.customjirablockfilter-key [atlassian.plugin.manager.DefaultPluginManager] Disabling com.atlassian.customjirablockfilter

846x1407x1 1qb3y6x 127.0.0.1 /rest/plugins/1.0/com.atlassian.customjirablockfilter-key [atlassian.plugin.loaders.ScanningPluginLoader] Removed plugin com.atlassian.customjirablockfilter

Please see atlassian-plugin.xmlas below:
<atlassian-plugin name="Block REST API Filter" key="com.atlassian.customjirablockfilter" plugins-version="2">
<plugin-info>
<description>A Servlet filter to block REST API!</description>
<vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<version>1.0</version>
</plugin-info>
<servlet-filter name="ServiceBlockServlet" key="jiraBlockServlet" class="com.atlassian.JiraBlockFilter" location="after-encoding" weight="200">
<description>Block JIRA REST Services</description>
<url-pattern>/*/rest/api/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</servlet-filter>
</atlassian-plugin>

I have installed a JAR file as plugin and getting below error in logs:

2013-07-01 14:06:49,180 http-80-4 INFO kashif.inam@thomsonreuters.com 846x1407x1 1qb3y6x 127.0.0.1 /rest/plugins/1.0/com.atlassian.customjirablockfilter-key [atlassian.plugin.manager.DefaultPluginManager] Found dependent enabled plugins for uninstalled plugin 'com.atlassian.customjirablockfilter': []. Disabling...

Please see attached atlassian-plugin.xml

Please advise

&lt;atlassian-plugin name="Block REST API Filter" key="com.atlassian.customjirablockfilter" plugins-version="2"&gt;
    &lt;plugin-info&gt;
        &lt;description&gt;A Servlet filter to block REST API!&lt;/description&gt;
        &lt;vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/&gt;
        &lt;version&gt;1.0&lt;/version&gt;
    &lt;/plugin-info&gt;
 
    &lt;servlet-filter name="ServiceBlockServlet" key="jiraBlockServlet" class="com.atlassian.JiraBlockFilter" location="after-encoding" weight="200"&gt;
        &lt;description&gt;Block JIRA REST Services&lt;/description&gt;
        &lt;url-pattern&gt;/*/rest/api/*&lt;/url-pattern&gt;
        
        &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
        
    &lt;/servlet-filter&gt;
&lt;/atlassian-plugin&gt;

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

442 views 7 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you