I am working on one application where I want to create dynamic URL appending my domain and the dynamic URL created can be shared with other users.
Like Example:
I have created one random string 'abcdef' and I want to create a dynamic url with this like 'http://domain.ext/abcdef/'. This URL now can be shared with other specific users, so those users can hit the same url to join on same page.
I want to create 'http://domain.ext/abcdef/' with 'abcdef' like dynamic string.
Please suggest, how I can do this with GWT ?
You can use: GWT.getHostPageBaseURL() to the the base of your URL, then append what you need to that string.
Take a look at the javadoc in: http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/GWT.html
Related
In our platform, we use a certain format from paths. In the Android App, it receives those paths to load some data or do something.
I want to do all the data handling using content provider, I want to give the path and get data. A simple transaction.
When I read into content providers, the documentation and all the tutorials out there always use "content://" at the beginning. However, I want to use our own start of the path which is usually "is-://". Can something like this work?
no, this is how the system categorize the uri as content provider.
its like relacing file:// with something else.
After referring to Developer.google site
A content URI is a URI that identifies data in a provider. Content URIs include the symbolic name of the entire provider (its authority) and a name that points to a table (a path). When you call a client method to access a table in a provider, the content URI for the table is one of the arguments.
From this I believe you can't set it on your own as it includes the symbol name.
Also why do you want to change it?
I need to construct a relative path from incoming query string parameters from the front-end.
Then I need to append it to the service URL like this:
Front end executes:
Http://backendhost.com?param_one=abd¶m_two=cba
The back-end gets both parameters and needs to execute
https://secure.remote.service/abd/cba
What I have right now on the back-end is this:
https://secure.remote.service
abd
cba
I would like to use a some native library to do this without hacking away using the form
"/" + param1 + "/" param2
This needs to be created and passed to a function that later will extract the back-end secure URL. So not this:
new URL(url, relativePath);
Why not to use an UriBuilder? it was already discussed here:
What is the idiomatic way to compose a URL or URI in Java?
and here:
Is there a right way to build a URL?
I am a beginner in Struts 2 and I am stuck in an issue, I would like to access an .xml file in the project doc, when the user goes to the link www.sitename.com/sitemap.xml. But right now I can only access it by going to the URL www.sitename.com/sitemap, i.e. without the extension. When I specify the action name as sitemap.xml it does not work. How could I make the user access the URL www.sitename.com/sitemap.xml. Sorry If the question does not make any sense.
The standard extension in Struts 2 for action name is .action. But it's configurable via using a setting struts.action.extension. It's available in the default.properties, which is used by the default action mapper.
You might use a comma separated list, e.g. struts.action.extension=action,xml,whatsoever
The blank extension used to map directories treated as action names. Static content is mapped via specifying a blank extension, e.g. struts.action.extension=, or struts.action.extension=a,b,c,,, or struts.action.extension=a,,b,c.
I have a code for sharing a content with twitter,but it contains some field like OAUTH_CALLBACK_URL,OAUTH_CALLBACK_SCHEME etc.How to use them and what URL should I put inside a CALLBACK_URL?
Link for my code...https://github.com/dhaval0122/Share_to_Facebook_twitter..
in this theirs a file called Constant.java,which has a variable named OAUTH_CALLBACK_URL,OAUTH_CALLBACK_SCHEME,OAUTH_CALLBACK_HOST.What Am I supposed to fill inside them?Plz reply..
Is there any way I can get url address of an application from java code, I mean complete address not only value from getContextPath(). Something like http://localhost:8080/etc
Try with getRequestUrl().
I hope it helps you
In a servlet or JSP, you can call javax.servlet.http.HttpUtils.getRequestURL(request)
It returns a StringBuffer containing the entire URL up to the servlet
From the javadoc
Reconstructs the URL the client used to make the request, using information in the HttpServletRequest object. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
If you only want up to the context path, you'll have to remove your servlet path
There is no method that returns the entire URL including the query parameters. You need to use something like:
req.getRequestURL()+"?"+req.getQueryString();
Or if you don't have query parameters you can use getRequestURL
It is pretty confusing, but here is a graphic that helps sort it out: