Getting current server name for URL build XPages - xpages

I am trying to build a URL for my XPages application,but having problem geting the current server name, can anyone help me with these?
RT.appendText("http://localhost/" +dbname+"/store.xsp?documentId="+UNID+"&action=openDocument")

You may want to handle HTTPS too:
var url = context.getUrl();
url.getScheme() + "://" + url.getHost()

If you need to get the server part from the url
context.getUrl().toString().split(facesContext.getExternalContext().getRequest().getRequestURI())[0]
I got this string from
http://xpagescheatsheet.com/cheatsheet.nsf/url.xsp

In case you are actually looking for the server host name (which is part of the URL) and not the Domino server name, then you can do the following:
return context.getUrl().toString().split(facesContext.getExternalContext().getRequest().getRequestURI())[0]
David Leedy has created a XPages URL cheatsheet with more details on URL handling.

Related

500(Internal Server Error): Forge deployed on Azure

I am new to this topic. I have deployed my app to Azure (following the tutorial from Autodesk). When I try to press to the login to BIM360 is return an error 500 (internal Server Error). I have changed the FORGE_CALLBACK_URL = "htttp://forgeSample1234.azurewebsite.net/api/forge/callback/oauth"
The code has no problem when in localhost.
Does anyone has the same problem?
Please note that when updating the callback URL, you actually have to change it in two places:
in your code (that's typically the FORGE_CALLBACK_URL)
in your Forge app page in https://forge.autodesk.com/myapps
And of course, the URL has to match exactly in both places.
Also, it looks like there might be a typo in your URL: you say htttp instead of http, and I'm also wondering if you shouldn't be using https?

Get a weburl from Sharepoint Client Side Object Model

So let's say I have a full url into a sharepoint website.
In the past when I wanted to get the weburl and doc url, I used the "url to web url" method of the Front Page Server Extensions. (http://msdn.microsoft.com/en-us/library/ms460544.aspx).
So for example if you had a site at
http://webapp/site1/chidsite/a.doc
I want a method in CSOM that will return /site1/childsite as the weburl.
I see the Web.WebUrlFromPageUrlDirect() method in CSOM but I'm not sure I'm getting what I need back from it. In the Uri class I get back, would I use teh "AbsolutePath" property for the weburl?
What is the correct way to do this?
I also would like to get the docURL that is usually retrieved by a call to url to web url via frontpage extensions.
The fileurl will be the file location relative to the web site. So if the document is stored in the document library called "Documents", you will get a value of /Documents/file.ext.
Well, I've reverted to using the FrontPage extensions when doing URLToWebURL since I just wasn't sure what I was getting using CSOM methods. Though check the link below for answers I received elsewhere.
Information Pertaining to this issue

Routes in Codeigniter

I want to have a clean URL in CodeIgniter based application for User's Profile Information.
Please Take a look at URL formats below.
Actual URL : http://www.mydomain.com/index.php/users/profile/user1
I'm expecting users to have Personal URL's like
http://www.mydomain.com/user1
http://www.mydomain.com/user2
http://www.mydomain.com/user3
URL http://www.mydomain.com/user1 should process http://www.mydomain.com/index.php/users/profile/user1 in background execution.
I will be removing index.php from URL using Route library.
Thanks in advance for any sort of help.
Have a look at https://www.codeigniter.com/user_guide/general/routing.html.
$route['user(:num)'] = "users/profile/user/$1";
If you mean you want /anyusername to route to the users controller, you would have to put:
$route['(:any)'] = "users/profile/$1";
At the bottom of routes.php and every non user-URL above it. Otherwise every URL would be routed there, obviously. You will need to implement some mechanism in the users-controller to throw 404-errors, since you are routing all requests not catched in the routing rules above.
IN config/routes.php
add this line
$route['user(:num)'] = "users/profile/$1";

Spotify app broken after update?

In regards to the following post
https://stackoverflow.com/a/10421944/1373154
will this be required with every application call? for example:
old script:
window.location = 'spotify:app:application:navTop';
new script:
window.location = 'spotify:app:application:bundleversion:navTop';
Curious if anyone knows how the change will effect scripting such as the example above
You misread the post — you only need to replace the folder name with the Bundle Identifier in the URL:
window.location = 'spotify:app:application-identifier:navTop';
However, a version needs to be present in the manifest file for the application to be loaded. It doesn't need to be specified in the URL.

How to get sharepoint site collection url using javascript?

I need to get the the site colllection url using the javascript.
I have written one simple function as below
function getSiteCollectionUrl()
{
var pageUrl= window.location.href;
var protocol = pageUrl.split(":")[0];
var addr=pageUrl.split("//")[1];
var webUrl = addr.split("/")[0];
var siteColleUrl = protocol + "://" + webUrl
}
let say the site address is "http://mysite/trialsite/default.aspx",
then it will return: "http://mysite"
But I think this isn't proper way to get the site collection url.
PLease suggest if you have any other idea.
Just by looking at SharePoint tag, right below this question, there is exactly the same question: How to get site collection url using javascript?
And the answers are there. And luckily you can get SharePoint site collection URL without invoking SharePoint API, because there is a L_Menu_BaseUrl variable available that contains it.
At http://server/documents it returns:
console.log(L_Menu_BaseUrl)
/documents
You cannot obtain the Site collection Url from just pure javascript without invoking SharePoint API.
If you need to do it in Javascript, you can invoke SharePoint API through web services and get the Site collection Url.
There is already Javascript API available called SPServices. You can use the following function:
SPGetCurrentSite

Resources