Flex Links Moss's Rest via htmlservices (rest's get post mode)

Source: Internet
Author: User


One: Flex debug (Debug)--trace ()--moss Import

Flex Learning: 1, Flex does not use the Trace debug statement problem, the console has no information output. There is no need to change the size of the installation file for this issue.
Just need to download the latest flashplayer_12_ax_debug. At the time of execution. Cannot be debugged through a Web application.
Instead, you should press the F11 key to debug, otherwise the same will not output information.

Project Consolidation
Suppose you put Bin-debug or bin-release under Liferay Tomcat. There is no need to create a new portlet, directly into the function,
Add a Bin-debug or bin-release/index.html (index.html can be omitted);
Another way to do this is to copy the relevant files, such as SWF, to a directory in the Portlet. So jsp,html can communicate with SWF.
When importing Mossproject, normal project import can, build path jar path change, then applicationcontext do corresponding cut paste;
When you import Liferay project. First copy project to Portlets, theme, and then press Liferay project to import,
Build path Jar (under your own tomcat/root).

Second: The socket + httpservices learning


Moss Background service: @QueryParam ("id") String ID This is the URL of the pass-through HTTP parameter;
@FormParam ("id") String ID This is the way the parameter is passed by form, @GET @POST means whether to implicitly invoke the parameter or to display the invocation parameter, that is, the GET's reference is displayed in the URL of the browser.


/**
* @author Zhangyapeng
* @function location Service browser address bar test Method--
* @data 2014.06.10
*/
@GET
@Path ("/locate")
@Produces (Mediatype.text_plain)
public string Locate2 (@QueryParam ("id") string id) {

Stringcmd = "Locate," +ID;
Flexsocket.sendmessage (CMD);
return cmd;
}

/**
* @author Zhangyapeng
* @function Location service, Liferay call
* @data 2014.06.10
*/
@POST
@Path ("/locate")
@Produces (Mediatype.application_json)
public void Locate (@QueryParam ("id") String ID) {

Ditto.

。。
}
GET
@Path ("{Contact}")
@Produces (Mediatype.text_plain)
public string Getres (@PathParam (' contact ') string contact)
{
Return "Hello," + contact;

}

Anyway. Whether (the @PathParam ("contact") string) or (@QueryParam ("id") string id) or @ (Formparam ("id") string ID) is related to how the number of references is passed is the URL or form form submitted;

And here @get @POST refers to the way the results of the query are sent.

Three: Flex's httpserviece:

First declare Httpservice to declare
<fx:Declarations>
<!--place non-visual elements (such as services, value objects) here--
<smt:mypopup id= "Mypopup"/>
<mx:httpservice id= "Locateservice" method = "POST" useproxy= "false" resultformat= "text"
fault= "Onfaluthandler (event)" result= "Onstemeeventresulthandler (event)"/>
</fx:Declarations>

After that, the Send () function is triggered ...
Call Locateservice (Httpservice) based on ID
Private Functiongetsmteeventbyid (id:string): void
{


Locateservice.url =baseurl + "/getsmteeventbyid";
Locateservice.method= "POST";
var params:object = new Object ();
params.id= ID;
locateservice.request= params;
Trace (Locateservice.url);
Locateservice.send ();
}

All URLs need to be written in the config file. , Gridmanagewidget.mxml Routewidget.mxml (the path analysis is problematic) Socketwidget.mxml in the respective XML. Of course, I also created a commonurl.xml.
You can change the value of the property in config. config= "" as appropriate.


Puzzle--search.mxml, is the system comes with, its search.xml has a lot of layers of the URL, you have to change the OH.
-----So today's solution is to change the URL by changing the property value of config= "" by the total system configuration file in config.

Flex Links Moss's Rest via htmlservices (rest's get post mode)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.