what is the use of creating ResourceURL in Portlet class? - liferay-6

I am using Liferay 6.1 CE for Portal Application development .
I am new to Liferay , so please excuse if my question is wrong .
I see that for using AJAX Requests in Liferay , we need to use ResourceURL .
Now my question is , I see a lot of examples in internet , where they are creating ResourceURL in Java Class using .
ResourceURL chartUrl = renderResponse.createResourceURL();
So please tell me what is the use of creating ResourceURL in Portlet class ??

ResourceURL has been introduced in JSR-286 standards to make an ajax call.
In liferay if you say on click of any link if you want to perform any action and page should not get refresh.
Define a link and and provide resource url to it. In your class file implement logic by mapping resource action and your data will get rendered to portlet without page refresh.

Related

How to hit a servlet using selector when resourceType is a component I created which is not page

I'm using AEM 6.3
My servlet config is
#Component(service= Servlet.class,
property={
Constants.SERVICE_DESCRIPTION + "=Example Servlet",
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.resourceTypes="+ "my-project/components/general/my-component",
"sling.servlet.extensions=" + "extension",
"sling.servlet.selectors=" + "selector"
})
As you can see I'm not using a page as a resourceType so I'm a little confused. Can anyone tell me what wil be the url to hit on browser so it runs my doGet Method.
And yes My servlet works as I have tested it by giving path.
After a long search and asking help in the AEM community I finally figured it out.
My url will be: http://localhost:4502/content/my-project/homepage/profile-page/test/en/jcr:content/par/my-component.selector.extension
Steps to get your url:
1: Add your component to a parsys in a page.
2: Find your component inside the page in crx/de and copy the url from there which will be like this-> /content/my-project/your-page/jcr:content/(name of your parsys)/your-component
3: now paste this with localhost:4502 in front and add your selector and extension which you have configured. for reference look at my url above.

Load select options dynamically from external service in Touch UI dialog in AEM?

My problem is to load a select field in touch UI dialog with dynamic options. These options are coming from a external URL via webservices, I am consuming this RESTful services using url defined in one of our global javascript objects like
$.get(mec.serviceConfig.baseUrl + '/movies';
Please understand that the options are coming from third party webservice please do not mention datasource. Whenever I search for loading select options dynamically I get this tutorial
Link to Tutorial
This is is not what I want.
In classic UI it is easy with optionsProvider.
In touch UI I am trying to write a script that fetches the data from the external webservice via AJAX ON DIALOG load and set these options in the select field.
Is there any better easier approach ? Can someone please share code snippets?
you should create JS listener for your component.
$document.on("dialog-ready", function() {
// there you should find your select field
//for example
var language = $("[name='./language']").closest(".coral-Select");
//then append to your select field new options from your datasource
});
please see doc: Dynamically updating AEM TouchUI Dialog Select Fields

How to call SOAP service from Phonegap (iPhone app)

I am trying to call a SOAP service using this SOAP client but it is not working for me. Please help me. How can I send and receive XML SOAP with Phonegap?
Phonegap is HTML/JS/CSS commonly communicating via XHR/Ajax. It's better to use jQuery Ajax functions. You can get the details here.
Eg:
Posting-XML-SOAP-Requests
AJAX-Requests-Between-jQuery
Simple jQuery client to call a SOAP web service
If you find any cross-domain issues (or working in a browser and not working with simulator/device), please refer to the below steps.
Go to the Resources folder, you can see a file named Cordova.plist. Click on that and you can see the Root elements. Right click on the Root, add a row, set the key as ExternalHosts with type Array.
Expand the item, and add an item as item0. Give it type string and enter the value as '*'.
Don't forget to save the Cordova.plist after changes (just use cmd+s).

Creating j2me app that connects to facebook ( not the swt project)

I want to create a simple j2me application for a start which links with facebook
For this ,
I downloaded the facebook api from http://kenai.com/projects/facebookapime/downloads
Then i followed this site for tutorials http://j2megroup.blogspot.in/2011/06/facebook-api-me-10-tutorial.html
But then for first i got 2 problems
1) I did not get Browser class ( it gives a compilation error in eclipse even after adding the external library )
2) I did not got what to put in Redirect uri
(i got first 2 parameters (App id and App secret but not redirect uri)
later ... when i came to know that its for swt project ... not the j2me pure midlet
can anyone tell me what's for pure j2me midlet ?
help me with a code snippet or something like that ... that would be preffered
write below code in startApp method
boolean b;
String URL = "Your URL";
b = platformRequest(URL);
destroyApp(true);
notifyDestroyed();
That code will start browser and transffer you on that perticular URL and close your J2ME app.
Use
platformRequest(your URL);
May be it will work

call gwt service without gui

someone has some experiences/recommendations in mixing gwt & servlets ? on client-side it's not always possible to use gwt-gui to invoke remote-service. for example: on clientside code you can click a button to retrieve data & render it on page , if i do a normal GET from java-script or from firefox-addon, which needs to be pointed to a normal servlet. is there a way for this GET to invoke gwt-service ?
thanx
GWT RequestFactory
here is tutorial
http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html
http://javaasylum.blogspot.com/2010/11/gwt-21-request-factory.html
or you can call HTTP.GET request
http://www.gwtapps.com/doc/html/com.google.gwt.http.client.html