iOS Development-cross-domain access to the Dwr method

Source: Internet
Author: User

Use PhoneGap to do mobile client, server with SPRING+DWR, need to access the server on the phone method, you need to do the following configuration, you can see http://www.iteye.com/topic/337460:

Server DWR configuration (Web. xml):

    <Init-param>          <Param-name>Allowgetforsafaributmakeforgeryeasier</Param-name>          <Param-value>True</Param-value>      </Init-param>            <Init-param>          <Param-name>Crossdomainsessionsecurity</Param-name>          <Param-value>False</Param-value>      </Init-param>            <Init-param>          <Param-name>Allowscripttagremoting</Param-name>          <Param-value>True</Param-value>      </Init-param>  

Mobile Client JS  

<script type= ' text/javascript ' src= '/ajax_chat/dwr/engine.js ' ></script>      <script type= ' text/ JavaScript ' src= '/ajax_chat/dwr/util.js ' ></script>      <script type= ' text/javascript ' src= '/http Www.myspace.com:8080/DWR_cross/dwr/interface/TestCross.js ' ></script>            <script type= "text/ JavaScript ">          function sendmsg () {              dwrengine.setmethod (dwrengine.scripttag);                         Testcross.greeting (Dwrutil.getvalue ("userName"), function (data) {alert (data);});                

Other server-side Java, Dwr.xml no special. It should be pointed out that the 3rd behavior in client JS requires a cross-site Dwr method, as for the 2nd, 3 lines, as needed.

iOS Development-cross-domain access to the Dwr method

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.