How can we create a dynamic Base URL.

How can we create a dynamic Base URL. Sometimes we need to access the plugins/resources from different context path. So we want to make the base url dynamic from General Configuration under Administration.

Actually, we are not looking for two Base URL. But we have NCR Portal to access any NCR website (i.e.

http://jira.ncr.com

) from out side the NCR LAN. NCR Portal authenticates the user and provides session to enter the NCR website. NCR portal redirects the request with encripted URL to that website. Website understand that URL and land the user. But baseurl (which is configured in JIRA) is executed without encripted or without the session. So baseurl is not understand in out side the NCR LAN.

Due to above reason we want to setup the Base URL as request.getContextPath(). Please let me know any JSP, Java, properties file, where we can configure or set the baseurl variable to Context Path.

1 answer

The base url is stored in the application property http://docs.atlassian.com/jira/latest/com/atlassian/jira/config/properties/APKeys.html#JIRA_BASEURL So one approach might be to intercept the getter methods in ApplicationPropertiesImpl.java which request this key. It just would be necessary to add an if to the getter methods. another approach would be to let the base url fix and to let a servlet filter wrap the request into a HttpServletRequestWrapper which overwrites getXxxxx methods like getContextPath to return the values that make Jira's base url test succeed But i think this would also require a reverse proxy to translate between the encrypted URI and http://jira.ncr.com, something i don't know if a reverse proxy like Apache can do. The approach to fake the result when you get the base url property seems easier

As per my understanding, we need to modify the methods getText() or getString() in ApplicationPropertiesImpl.java file to feed to correct URL. To modify this file can you send me the .java file or can you tell me the process to modify this .class file to achieve the Base URL dynamic. Please consider this is a urgent request as our external user not able to access JIRA properly.

I suspect you need a commercial licence to see that file, as it's part of the core code (you're entitled to download the source if you have one). I suspect you'll need to amend more than that one file too - the base url is used throughout Confluence and I don't think it's changeable in just one place

Yes we have commercial licence. Please let me know the download links.

Go to your account and look for the download section.

I have downloaded the java file. Can you tell me, how can I handle request object in this java file? I want to retrieve the reference URL by request.getHeader("referer") in this java file.

Please reply on this.

Check ActionContext. I guess this has a method to get the current request

I have tried to get the request object in file ApplicationPropertiesImpl.java as below. But both the cases I got null value. Please let me know any alternative.

HttpServletRequest servletRequest = ServletActionContext.getRequest();
HttpServletRequest servletRequest2 = ActionContext.getRequest();

Can anybody tell where the baseurl is stored for display the plugins in dashboard. For example, if I see the property of plugin displayed in dashboard as below.

http://star-test.ncr.com/plugins/servlet/gadgets/ifr?container=atlassian&mid=10202&country=US&lang=en&view.........

Can you tell me where this code is written to create this URL in application.

Please reply.....

Please reply on this.

You do understand that this is community support right? If you're not getting answers it's because you're not doing enough research yourself.

Hi,

I come to know that the gadgets (Two Dimensional Filter Statistics: Current Assignee Filter, Activity Stream etc.) displayed in the dashboard is not dependent on the Base URL which is provided by configuration (General Configuration under Administration). I have modified the Base URL to some unknown URL and restart the JIRA server. Observed that gadgets are displayed properly in dashboard still. I think these gadgets are collecting the URL from somewhere else. I was not able to find. Do you have any idea that I can proceeds or modify the URL as appropriate.

Please reply on this.............

Can you tel me the location where gadgets are populated?

mmm, actually, those gadgets do depend on the base url, but they also know that they're running in Jira and therefore don't have to have it explicitly given to them. If you use them on other pages, then they need a pointer to Jira, which includes the base url...

Nic, I have modified the Base URL to some other unknown URL (....restart the server) and seen that gadgets are still populating with out any issue with previous URL. But i am not able to find the page where this gadgets are populated.

Hi,

Guys i am waiting for your reply. But still no body reply on my question. I am asking you, because I stack some where and I did not get any way to resolve the issue. My question is, please let me know the place (.jsp, .java etc)where dashboard gadgets are populated?

The gadgets are storing their configuration. When you create them, they remember where they came from (i.e. the context in which they were created). I don't know how that's done explicitly, but I think it's in the OSGI framework stuff.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 5 hours ago in Off-topic

Get to know our Atlassian User Group Leaders from Bengaluru, India

Meet @Dinesh Dhinakaran, @Vishnu Vasudeva, @Rajeev Verma, and Jamshid Nalakath: Our extraordinary AUG leaders from Bengaluru, India. These four work together to strengthen the bonds of their local co...

54 views 0 2
Read article

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