How can we create a dynamic Base URL.

ab185178 March 5, 2012

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

0 votes
Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2012
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
ab185178 March 11, 2012

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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2012

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

ab185178 March 11, 2012

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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2012

Go to your account and look for the download section.

ab185178 March 11, 2012

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.

ab185178 March 12, 2012

Please reply on this.

Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2012
Check ActionContext. I guess this has a method to get the current request
Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2012
ab185178 March 13, 2012

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();

ab185178 March 14, 2012

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.

ab185178 March 14, 2012

Please reply.....

ab185178 March 15, 2012

Please reply on this.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2012

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.

ab185178 March 18, 2012

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.

ab185178 March 19, 2012

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

ab185178 March 19, 2012

Can you tel me the location where gadgets are populated?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 19, 2012

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...

ab185178 March 20, 2012

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.

ab185178 March 26, 2012

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?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 26, 2012

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