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

This widget could not be displayed.
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>

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

158 views 2 0
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