Resolving Cross-domain access Problems with Serveresource in Liferay

Source: Internet
Author: User
Tags json

Brief introduction:

It is well known that cross-domain problems are a very common requirement, such as having a client's EXT-JS control render a JSON object from the server side. We can solve them in many ways, such as JSONP. However, in Liferay, we can use the Serveresource method to gracefully resolve Cross-domain access issues.

Whiteboard Analysis:

Here is the whiteboard on the technical symposium:

Workaround:

First write a Serveresource method to deal with the remote JSON object, which can be encapsulated as a middle-tier in the remoting JSON resource, and then provided to the EXT-JS code in this domain to render.

Of course, our resources here must be stated on the page with <portlet:resourceURL/> to allow the client Ext-js to use the specified variable to access the code:

The client, the basic EXT-JS, is able to render the JSON resources we serveresource provide, because it is within this domain, so there is no cross-domain.

This article from the "Cohesion of parallel Lines" blog, please be sure to retain this source http://supercharles888.blog.51cto.com/609344/1004251

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.