Search in sources :

Example 1 with MimeResponse

use of javax.portlet.MimeResponse in project core by wicketstuff.

the class PortletRequestMapper method encodeActionUrl.

private Url encodeActionUrl(Url url, boolean forceActionUrl) {
    if ((!forceActionUrl) && (ThreadPortletContext.isResourceRequest())) {
        return encodeResourceUrl(url);
    }
    if (url != null) {
        String qualifiedPath = getQualifiedPath(url.toString());
        PortletResponse portletResponse = ThreadPortletContext.getPortletResponse();
        if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) {
            try {
                ActionURL portletUrl = ((MimeResponse) portletResponse).createActionURL();
                portletUrl.getActionParameters().setValue(WicketPortlet.WICKET_URL_PORTLET_PARAMETER, qualifiedPath);
                qualifiedPath = portletUrl.toString();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
        url = parseUrl(qualifiedPath);
    }
    return markAsPortletUrl(url);
}
Also used : PortletResponse(javax.portlet.PortletResponse) MimeResponse(javax.portlet.MimeResponse) ActionURL(javax.portlet.ActionURL)

Example 2 with MimeResponse

use of javax.portlet.MimeResponse in project liferay-faces-bridge-impl by liferay.

the class ExternalContextImpl method getResponseCharacterEncoding.

@Override
public String getResponseCharacterEncoding() {
    if (portletResponse instanceof MimeResponse) {
        MimeResponse mimeResponse = (MimeResponse) portletResponse;
        String characterEncoding = mimeResponse.getCharacterEncoding();
        if (manageIncongruities) {
            incongruityContext.setResponseCharacterEncoding(characterEncoding);
        }
        return characterEncoding;
    } else {
        if (manageIncongruities) {
            return incongruityContext.getResponseCharacterEncoding();
        } else {
            if (portletResponse instanceof StateAwareResponse) {
                FacesContext facesContext = FacesContext.getCurrentInstance();
                ExternalContext externalContext = facesContext.getExternalContext();
                String characterEncoding = (String) externalContext.getRequestMap().get(BridgeExt.RESPONSE_CHARACTER_ENCODING);
                if (characterEncoding != null) {
                    // Workaround for patch applied to Mojarra in JAVASERVERFACES-3023
                    return characterEncoding;
                } else {
                    // TCK: getResponseCharacterEncodingEventTest
                    throw new IllegalStateException();
                }
            } else {
                return null;
            }
        }
    }
}
Also used : FacesContext(javax.faces.context.FacesContext) StateAwareResponse(javax.portlet.StateAwareResponse) ExternalContext(javax.faces.context.ExternalContext) MimeResponse(javax.portlet.MimeResponse)

Example 3 with MimeResponse

use of javax.portlet.MimeResponse in project liferay-faces-bridge-impl by liferay.

the class ExternalContextCompat_2_0_Impl method getResponseBufferSize.

/**
 * @see    ExternalContext#getResponseBufferSize()
 * @since  JSF 2.0
 */
@Override
public int getResponseBufferSize() {
    if (portletResponse instanceof MimeResponse) {
        MimeResponse mimeResponse = (MimeResponse) portletResponse;
        int responseBufferSize = mimeResponse.getBufferSize();
        if (manageIncongruities) {
            incongruityContext.setResponseBufferSize(responseBufferSize);
        }
        return responseBufferSize;
    } else {
        if (manageIncongruities) {
            return incongruityContext.getResponseBufferSize();
        } else {
            throw new IllegalStateException();
        }
    }
}
Also used : MimeResponse(javax.portlet.MimeResponse)

Example 4 with MimeResponse

use of javax.portlet.MimeResponse in project liferay-faces-bridge-impl by liferay.

the class ExternalContextCompat_2_0_Impl method responseReset.

/**
 * @see    ExternalContext#responseReset()
 * @since  JSF 2.0
 */
@Override
public void responseReset() {
    if (portletResponse instanceof MimeResponse) {
        MimeResponse mimeResponse = (MimeResponse) portletResponse;
        mimeResponse.reset();
    } else {
        if (manageIncongruities) {
            incongruityContext.responseReset();
        } else {
            throw new IllegalStateException();
        }
    }
}
Also used : MimeResponse(javax.portlet.MimeResponse)

Example 5 with MimeResponse

use of javax.portlet.MimeResponse in project liferay-faces-bridge-impl by liferay.

the class ExternalContextCompat_2_0_Impl method isResponseCommitted.

/**
 * @see    ExternalContext#isResponseCommitted()
 * @since  JSF 2.0
 */
@Override
public boolean isResponseCommitted() {
    if (portletResponse instanceof MimeResponse) {
        MimeResponse mimeResponse = (MimeResponse) portletResponse;
        boolean responseCommitted = mimeResponse.isCommitted();
        if (manageIncongruities) {
            incongruityContext.setResponseCommitted(responseCommitted);
        }
        return responseCommitted;
    } else {
        if (manageIncongruities) {
            return incongruityContext.isResponseCommitted();
        } else {
            throw new IllegalStateException();
        }
    }
}
Also used : MimeResponse(javax.portlet.MimeResponse)

Aggregations

MimeResponse (javax.portlet.MimeResponse)46 ExternalContext (javax.faces.context.ExternalContext)16 FacesContext (javax.faces.context.FacesContext)14 JSONArray (org.json.JSONArray)10 BridgeTest (com.liferay.faces.bridge.tck.annotation.BridgeTest)9 WebuiRequestContext (org.exoplatform.webui.application.WebuiRequestContext)7 PortletURL (javax.portlet.PortletURL)6 ResourceRequest (javax.portlet.ResourceRequest)6 ResourceURL (javax.portlet.ResourceURL)6 UserNode (org.exoplatform.portal.mop.user.UserNode)5 StringWriter (java.io.StringWriter)4 Writer (java.io.Writer)3 MalformedURLException (java.net.MalformedURLException)3 UIViewRoot (javax.faces.component.UIViewRoot)3 PortletResponse (javax.portlet.PortletResponse)3 PortletNamingContainerUIViewRoot (javax.portlet.faces.component.PortletNamingContainerUIViewRoot)3 NodeChangeQueue (org.exoplatform.portal.mop.navigation.NodeChangeQueue)2 UIPortalNavigation (org.exoplatform.portal.webui.navigation.UIPortalNavigation)2 BridgeNavigationHandler (com.liferay.faces.bridge.application.internal.BridgeNavigationHandler)1 CapturingWriter (com.liferay.faces.bridge.context.internal.CapturingWriter)1