Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How Servlet Filter Plugin Module communicate with JIRA software(Not Cloud)


   I am confused about communcation mechanism between JIAR software(Not Cloud) and  Plugin Module.

 For example:

   I intend to utilize Servlet Filter Plugin to monitor user behaviors by checking some urls. During that process, I need to some information, such as projects, roles and so on. I  could achive that by calling rest api, but it means http been used  between Plugin and JIAR software, is it correct?

    Somebody could please give me more information?

 Thanks in advance.


1 answer


you can inject the dependencies or use static ComponentAccessor methods to get ProjectManager, UserManager and so on.

Could you please give me more info about  communcation mechanism between JIAR software(Not Cloud) and  Plugin Module?

You register your servlet-filter in atlassian-plugin.xml, then implements javax.servlet.Filter interface. So now you have access to servletRequest (HttpServletRequest), servletResponse and filterChain objects. E.g. you can also get current user by 

ApplicationUser loggedUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

It is very crucial clue, thank you very much.


Could you please give me more inforamtion, such as sample code?

thanks for your support.

Please take a look:

public class SprintServletFilter implements Filter {

public void init(FilterConfig filterConfig) throws ServletException {


public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
RequestWrapper requestWrapper = new RequestWrapper(httpServletRequest);
ApplicationUser loggedUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
filterChain.doFilter(requestWrapper, servletResponse);
String requestBody = new String(requestWrapper.getRawData());
JsonObject jsonObject = new JsonParser().parse(requestBody).getAsJsonObject();
JsonElement jsonElement = jsonObject.get("sprintId");
if (!jsonElement.isJsonNull()) {
Long sprintId = jsonElement.getAsLong();

public void destroy() {



 ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()  the result is null, and I tried isLoggedInUser() return false , getUser() return null

I don't know how to deal it, :(.

What do you have inside atlassian-plugin.xml?


<servlet-filter name="Sprint Servlet" key="sprintServlet"
location="before-decoration" weight="200">
<description>Tackle sprint events</description>

thanks , I have fixed this issue by changing  location="after-encoding" to  location="before-decoration" .

Maybe the user info not been injected on the top of chain, I guess

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

755 views 7 24
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you