Question

Im new to liferay. My requirement is to display web application hosted on weblogic server(10.3.5) in liferay portal. This application is using JDK 1.6

To achieve this I wrote a sample portlet

public class TestPortlet extends GenericPortlet {
public static final String VIEW_PAGE = "/View.jsp";
public static final String VERSION = "version";
private String webVersion;

@Override
public void init(PortletConfig config) throws PortletException {
    super.init(config);
    webVersion = config.getInitParameter("webVersion");
}

@Override
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    request.setAttribute(VERSION, webVersion);
    PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(VIEW_PAGE);
    dispatcher.include(request, response);
}

}

JSP Code:

<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" session="false"
    isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects />
<jsp:useBean id="version" class="java.lang.String" scope="request" />
<div id="remote-container" style="width:100%;"></div>
<div>
<footer id="footer" class="foot-Note" role="contentinfo"><small>Version: <%=version%>  &#47; </small><small id="applicationVersion" ></small></footer>
</div>
<script>
   jQuery.support.cors = true;
    $("#remote-container").load('/contextRoot/test', function(response, status, xhr) {
    if (status == "error") {
        var msg = "If this problem persists please contact the Support ";
        $("#remote-container").html(msg + xhr.statusText);
    }
   });

</script>

Im using liferay 6.1.2 with weblogic 10.3.6 and JDK 1.7. Its working correctly if I deploy the web app in same liferay server.

I want to know how to redirect the context to the application hosted in other server. Please help me.

Was it helpful?

Solution 2

Liferay IFrame module is final solution. A few customizations are required to use the portal cookie.Its working now.

OTHER TIPS

It seams to me that you could do the same thing without codding at all, by simply utilizing either IFrame portlet or Proxy portlet. Portlets have been distributed with the portal for years and their configuration is straightforward.

If you really have a good reason to use the custom code you provide, please make sure you use the correct link to your service. In the code you are calling /contextRoot/test which refers to the same server. You need to change that to whatever server you wish to connect to. However since you are doing this on the browser side make sure you understand the Same-origin policy

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top