Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Note:  Work in progress.  Information taken from http://jasig.275507.n4.nabble.com/data-ajax-returns-does-not-display-data-within-webproxy-portlet-td4355777.html.

The following best practices will make it much easier to successfully use the Web Proxy portlet.  You should also follow the other portlet best practices documented on Portlet Development.

URL Rewriting in Javascript

The Web Proxy Portlet will re-write URLs in content to direct the destination of the request back to the Web Proxy Portlet so it can proxy the operation.  URLs in Javascript are not processed so the content and javascript must be constructed in a manner that takes advantage of the portlet's URL rewriting behavior.  Using psedo-code to illustrate the technique:

Doesn't work, URL is hidden from the portlet content processing in a javascript block:

<script>
function doSomething() {
    $.ajax('/some/url?param1' + p1, function() { AJAX HANDLER });
}
</script>

Should work, URL is a hidden, named, anchor:

<!-- In JSP page -->
<!-- Store the portlet namespace string in the JSP page variable "n" -->
<c:set var="n"><portlet:namespace/></c:set>

<script>
function doSomething() {
    var u = $("#{n}decentLinkName").href();
    $.ajax(u, {'param1', p1,}, function() { AJAX HANDLER });
}
</script>
<a id="{n}decentLinkName" class="ajax_link hidden" href="/some/url" />

 

 

  • No labels