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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to use WebItemProvider since SimpleLinkFactory is deprecated?

I have a JIRA plugin with dynamic menu item using SimpleLinkFactory. This works excellent, but it seems that SimpleLinkFactory is deprecated since JIRA 6.3 (SimpleLinkFactory). They refer to com.atlassian.plugin.web.api.provider.WebItemProvider, a class I can't find in Java doc. 

Can anyone provide an example on how to use the WebItemProvider in both Java and the atlassian-plugin.xml? 

Thanks in advance!

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted

@Aleksandra Bruun

I did find what we were searching for in the JIRA source code. First you create the web-section entry in your atlassian-plugin.xml.

<web-section key="links_recentproject" name="Links Main Section" location="recentprojects" weight="11">
    <label key="menu.project.recent"/>
    <tooltip key="menu.project.recent.desc"/>

Now to make use of your WebItemProvider for that section you add it into the plugin.xml as well

<web-item-provider key="project_drop_history-factory" name="Project History Link Factory"

ProjectHistoryLinkFactory is your WebItemProvider and this class can be found in the JIRA Source Code for future reference.

public class ProjectHistoryLinkFactory implements WebItemProvider
    public static final int MAX_RECENT_PROJECTS_TO_SHOW = 5;

    private final UserProjectHistoryManager userHistoryManager;
    private final I18nBean.BeanFactory beanFactory;
    private final VelocityRequestContextFactory velocityRequestContextFactory;

    public ProjectHistoryLinkFactory(VelocityRequestContextFactory velocityRequestContextFactory, UserProjectHistoryManager userHistoryManager,
            I18nBean.BeanFactory beanFactory)
        this.velocityRequestContextFactory = velocityRequestContextFactory;
        this.userHistoryManager = userHistoryManager;

        this.beanFactory = beanFactory;

    public Iterable<WebItem> getItems(final Map<String, Object> context)
        final ProjectAction projectAction = ProjectAction.VIEW_ISSUES;
        final User user = (User) context.get("user");

        final List<Project> history = userHistoryManager.getProjectHistoryWithPermissionChecks(projectAction, user);
        final List<WebItem> links = new ArrayList<WebItem>();

        if (!history.isEmpty())
            final VelocityRequestContext requestContext = velocityRequestContextFactory.getJiraVelocityRequestContext();
            // Need ot ensure they contain the baseurl in case they are loaded via ajax/rest
            final String baseUrl = requestContext.getBaseUrl();

            final Project currentProject = userHistoryManager.getCurrentProject(Permissions.BROWSE, user);
            final I18nHelper i18n = beanFactory.getInstance(user);

            int weight = 10;
            for (Project project : history)
                if (!project.equals(currentProject))
                    final Long projectId = project.getId();
                    final String name = project.getName();
                    final String key = project.getKey();

                    String iconUrl = null;
                    if (project.getGenericValue().getLong("avatar") != null)
                        final Avatar avatar = project.getAvatar();
                        iconUrl = baseUrl + "/secure/projectavatar?pid=" + projectId + "&avatarId=" + avatar.getId() + "&size=small";
                    links.add(new WebFragmentBuilder(weight += 10).
                            id("proj_lnk_" + projectId).
                            label(name + " (" + key + ")").
                            title(i18n.getText("tooltip.browseproject.specified", name)).
                            addParam("iconUrl", iconUrl).
                            url(baseUrl + "/browse/" + key).

        return links.subList(0, Math.min(MAX_RECENT_PROJECTS_TO_SHOW, links.size()));


Hope that helps you. Let's hope there will be a decent documentation for JIRA one day so this stuff can actually be looked up smile

Thank you! I will try this :) Hope its works.

Thank you @Sascha Becker! It works and no need to add the dependency and component-import to pom.xml as in @Joe Clark [Atlassian] answer.

Hi, could you telme what are we doing in the ProjectHistoryLinkFactory class?
Do we have to change it, or override this class or something?
What's the reference here for ProjectHistoryLinkFactory? 

@Sascha Becker Hi, could you please tell me how to use the ProjectHistoryLinkFactory class in the plugin? 
Where do I use this in the plugin.
Many thanks in advance.


~ Tayyab 

1 vote
Joe Clark Atlassian Team Jan 06, 2015

I haven't tested this personally, but you should be able to access the WebItemProvider by adding the following declaration to your pom.xml:


And then a component-import to your atlassian-plugin.xml:

    name="Web Item Provider" 



Thanks! Do you know how to access the WebItemProvider java part in the atlassian-plugin? How to 'link' the dynamic java class to a web section/item? Similiar to this in simple-link-factory: <simple-link-factory key="links-factory" name="Link Factory" section="menu/section" weight="10" lazy="true" class="LinkFactory"> </simple-link-factory>

Joe Clark Atlassian Team Jan 19, 2015

Does the "Web Item" plugin module work for you? Or are you trying to do something different? see

This is not needed. WebItemProvider is part of jira-api.

Good question. Would be interested to hear the answer as well. Especially the part how to create new Webitems in the WebItemProvider since WebItemImpl is not public.

Really weird to mark something deprecated and then miss out on documenting the alternative.

For creating WebItems, you can use WebFragmentBuilder (from com.atlassian.plugin.web.api.model).


Atlassian Community Events