HttpServletResponse « IceFaces « JSF Q&A

1. get HttpServletResponse from liferay portal

I am trying to get the HttpServletResponse from liferay portal. I am also working with icefaces.

PortletResponse response1 = (PortletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
        HttpServletResponse response = (HttpServletResponse)response1;
I get ...

2. How to display response(HttpServletResponse) content.

ReportClientDocument clientDoc = buildClientDocument(report); // This method "buildClientDocument(...)" downloading file with report, joust like with JasperReport when you must download file ".jasper". CrystalReportViewer viewer = new CrystalReportViewer(); viewer.setReportSource(clientDoc.getReportSource()); FacesContext facesContext = FacesContext.getCurrentInstance(); ServletContext servletContext = (ServletContext)facesContext.getExternalContext().getContext(); HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); viewer.processHttpRequest(request, response, servletContext, null); // Ok this method is important a quotation from API "Handles ...

4. Problems with HttpServletResponse

Hello when I click the ice command button I cant get an HttpServletResponse object from ExternalContext because its always null and I need this object becase I have to thrown an stream to the client browser. It is the code of my ice comman button: And its a piece of code of my backing bean where ...

6. Getting HttpServletResponse from RenderREsponse

public class NoCachePhaseListener implements PhaseListener { public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } public void afterPhase(PhaseEvent phaseEvent) { } public void beforePhase(PhaseEvent phaseEvent) { FacesContext facesContext = phaseEvent.getFacesContext(); HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); response.addHeader("Pragma", "no-cache"); response.addHeader("Cache-Control", "no-cache"); response.addHeader("Cache-Control", "no-store"); response.addHeader("Cache-Control", "must-revalidate"); response.addHeader("Expires", "Mon, 1 Jan 2006 05:00:00 GMT");//in the past } }