Flex uses htmlservices to link moss rest (rest get post method) and htmlservicesmoss
I. flex debug (debugging) -- trace () -- moss Import
Flex learning: 1. If the trace debugging statement cannot be used in flex, no information is output on the console. You do not need to modify the parameters of the Installation File,
You only need to download the latest flashplayer_12_ax_debug. At runtime, you cannot debug through a Web application,
Press the F11 key for debugging. Otherwise, no information is output.
Engineering Integration
If you put bin-debug or bin-release under tomcat of liferay, you do not need to create a new portlet and add the function directly,
Add a bin-debug or bin-release/index.html (index.html can be omitted );
Another way is to copy swf and other related files to a folder in the portlet so that jsp and html can communicate with swf.
When importing a moss project, you can import the common project, change the build path jar path, and then cut and paste the applicationContext;
When importing a liferay project, first copy the project to portlets and theme, and then import the project according to the liferay project,
Build path jar (under your own tomcat/root ).
Ii. socket + httpservices pass Learning
Moss Background Service: @ QueryParam ("id") String id. This is the parameter passed by the http url;
@ FormParam ("id") String id: this parameter is passed through the form method; @ GET @ POST method refers to the implicit call parameter or display call parameter, that is, get parameters are displayed in the url of the browser.
/**
* @ Author zhangyapeng
* @ Function Positioning 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 positioning service, called by liferay
* @ Data 2014.06.10
*/
@ POST
@ Path ("/locate ")
@ Produces (MediaType. APPLICATION_JSON)
Public void locate (@ QueryParam ("id") String id ){
// Same as above...
}
GET
@ Path ("{contact }")
@ Produces (MediaType. TEXT_PLAIN)
Public String getres (@ PathParam ("contact") String contact)
{
Return "Hello," + contact;
}
In short, is it (@ PathParam ("contact") String contact) or (@ QueryParam ("id") String id) or @ (FormParam ("id") String id) it depends on the parameter transmission mode, whether it is url or form submission;
Here, @ GET @ POST refers to the method for sending the query results.
Iii. flex httpserviece:
Declare httpservice first
<Fx: Declarations>
<! -- Place non-visual elements (such as services and 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>
Then, the send () function is triggered...
// Call locateService (httpservice) by 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 must be written in the configuration file, GridManageWidget. mxml RouteWidget. mxml (path analysis is faulty) SocketWidget. mxml is in its own xml, and of course a CommonURL is also created. xml,
You can change the attribute value of config = "" In config. xml ..
Difficulty-Search. mxml, which comes with the system, has a lot of layer URLs in Search. xml, so you have to change it yourself ..
----- The current solution is to change the URLs through the system configuration file of config. xml, corresponding to the property value of config =.