public String getContentType() { final String ct = _req.getResponseContentType(); return ct != null ? ct : "text/html"; }
protected void setContentType(RenderRequest request, RenderResponse response) { if (response.getContentType() == null) { String portalPreferredContentType = request .getResponseContentType(); if (portalPreferredContentType != null) { response.setContentType(portalPreferredContentType); } else { response.setContentType("text/html"); } } }
public static void sendToJSP(PortletContext pContext, RenderRequest request, RenderResponse response, String jspPage) throws PortletException { response.setContentType(request.getResponseContentType()); if (jspPage != null && jspPage.length() != 0) { try { PortletRequestDispatcher dispatcher = pContext .getRequestDispatcher(jspPage); dispatcher.include(request, response); } catch (IOException e) { throw new PortletException("Sakai Dispatch unabble to use " + jspPage, e); } } } }
protected void setContentType(RenderRequest request, RenderResponse response) { if (response.getContentType() == null) { String portalPreferredContentType = request.getResponseContentType(); if (portalPreferredContentType != null) { response.setContentType(portalPreferredContentType); } else { response.setContentType("text/html"); } } }
public static void sendToJSP(PortletContext pContext, RenderRequest request, RenderResponse response, String jspPage) throws PortletException { response.setContentType(request.getResponseContentType()); if (jspPage != null && jspPage.length() != 0) { try { PortletRequestDispatcher dispatcher = pContext .getRequestDispatcher(jspPage); dispatcher.include(request, response); } catch (IOException e) { throw new PortletException("Sakai Dispatch unabble to use " + jspPage, e); } } } }
response.setContentType(request.getResponseContentType()); PortletServiceHome nsh = null; javax.naming.Context ctx;
private void renderView(String viewName, RenderRequest req, RenderResponse res) throws PortletException, MalformedURLException { res.setContentType(req.getResponseContentType()); String viewPath = settings.getValue(Settings.Entry.VIEW_PREFIX) + viewName + settings.getValue(Settings.Entry.VIEW_SUFFIX); URL url = getPortletConfig().getPortletContext().getResource(viewPath); if (url == null) { // This won't work at all... String msg = "The specified viewPath is not found: " + viewPath; throw new RuntimeException(msg); } runScript(url, req, res); }
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { String autoNonFacesViewDispatch = getInitParameter("javax.portlet.faces.automaticNonFacesViewDispatching"); String nonFacesTargetPath = renderRequest.getParameter(Bridge.NONFACES_TARGET_PATH_PARAMETER); if ((autoNonFacesViewDispatch != null) && autoNonFacesViewDispatch.equalsIgnoreCase("true") && (nonFacesTargetPath != null)) { PortletContext portletContext = getPortletContext(); String responseContentType = renderRequest.getResponseContentType(); // TCK TestPage017: requestProcessingNonFacesTest renderResponse.setContentType(responseContentType); PortletRequestDispatcher portletRequestDispatcher = portletContext.getRequestDispatcher(nonFacesTargetPath); try { portletRequestDispatcher.forward(renderRequest, renderResponse); } catch (Exception e) { e.printStackTrace(); } } else { super.doDispatch(renderRequest, renderResponse); } }
String responseContentType = renderRequest.getResponseContentType();
res.setContentType(req.getResponseContentType());