@Override public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { contextPath = request.getContextPath(); } }
private RenderHttpServletRequest(RenderRequest req) { if (req == null) throw new IllegalArgumentException("null"); _req = req; _hreq = getHttpServletRequest(req); String ctxpath = req.getContextPath(); if (ctxpath == null) ctxpath = ""; _attrs.put(Attributes.INCLUDE_CONTEXT_PATH, ctxpath); _attrs.put(Attributes.INCLUDE_SERVLET_PATH, ""); _attrs.put(Attributes.INCLUDE_PATH_INFO, ""); _attrs.put(Attributes.INCLUDE_QUERY_STRING, ""); _attrs.put(Attributes.INCLUDE_REQUEST_URI, ctxpath); }
return resp.encodeURL(req.getContextPath() + sb.toString());
protected void processXslt ( URI xslUri, Source xmlSource, Map xslParams, RenderRequest request, RenderResponse response ) throws PortletException, IOException { try { Transformer transformer=transformerHelper.getTransformer(xslUri); // add render response to the transformer parameters to enable extension element url construction transformer.setParameter(PortletUrlXalanElements.RENDER_RESPONSE_PARAMETER_NAME,response); // set context path param transformer.setParameter(CONTEXT_PATH_PARAM_NAME,request.getContextPath()); // TODO: add support for stylesheet sets. Among other things, the content type would be determined from them. response.setContentType("text/html"); StreamResult streamResult=new StreamResult(response.getWriter()); if ( xslParams != null ) { for ( Iterator names = xslParams.keySet().iterator(); names.hasNext(); ) { String paramName = (String) names.next(); transformer.setParameter(paramName,xslParams.get(paramName)); } } try { transformer.transform(xmlSource,streamResult); } catch (TransformerException e) { throw new PortletException("unable to transform",e); } } catch (PortalException e) { throw new PortletException("unable to obtain transformer for xmlSource="+xmlSource!=null?xmlSource.toString():null,e); } }
String contextPath = renderRequest.getContextPath(); if(renderResponse!=null) { contextPathEncoded = renderResponse.encodeURL(contextPath);
protected void readSwfFileInfo( RenderRequest request, RenderResponse response, Context context, SWFContext swfContext ) { String swfSrc = swfContext.getSrc(); int swfSrcLen = ( swfSrc != null ? swfSrc.length() : 0 ); if ( swfSrcLen > 0 ) { SWFHeader swfH = new SWFHeader(); String contextPath = request.getContextPath(); int contextPathLen = ( contextPath != null ? contextPath.length() : 0 ); if ( contextPathLen > 0 && swfSrcLen > contextPathLen && swfSrc.startsWith( contextPath ) ) { swfSrc = swfSrc.substring( contextPathLen ); } if ( swfH.parseHeader( this.getPortletContext().getResourceAsStream( swfSrc ) ) ) { swfContext.setHeader( swfH ); } } }
protected void readSwfFileInfo( RenderRequest request, RenderResponse response, Context context, SWFContext swfContext ) { String swfSrc = swfContext.getSrc(); int swfSrcLen = ( swfSrc != null ? swfSrc.length() : 0 ); if ( swfSrcLen > 0 ) { SWFHeader swfH = new SWFHeader(); String contextPath = request.getContextPath(); int contextPathLen = ( contextPath != null ? contextPath.length() : 0 ); if ( contextPathLen > 0 && swfSrcLen > contextPathLen && swfSrc.startsWith( contextPath ) ) { swfSrc = swfSrc.substring( contextPathLen ); } if ( swfH.parseHeader( this.getPortletContext().getResourceAsStream( swfSrc ) ) ) { swfContext.setHeader( swfH ); } } }
logger.debug("Processing portal render request " + req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/" + req.getContextPath() + " (scriptUrl=" + scriptUrl + ")");
protected void readSwfFileInfo( RenderRequest request, RenderResponse response, Context context, SWFContext swfContext ) { String swfSrc = swfContext.getSrc(); int swfSrcLen = ( swfSrc != null ? swfSrc.length() : 0 ); if ( swfSrcLen > 0 ) { SWFHeader swfH = new SWFHeader(); String contextPath = request.getContextPath(); int contextPathLen = ( contextPath != null ? contextPath.length() : 0 ); if ( contextPathLen > 0 && swfSrcLen > contextPathLen && swfSrc.startsWith( contextPath ) ) { swfSrc = swfSrc.substring( contextPathLen ); } if ( swfH.parseHeader( this.getPortletContext().getResourceAsStream( swfSrc ) ) ) { swfContext.setHeader( swfH ); } } }
logger.debug("Processing portal render request " + req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/" + req.getContextPath() + " (scriptUrl=" + scriptUrl + ")");
logger.debug("Processing portal render request " + req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/" + req.getContextPath() + " (scriptUrl=" + scriptUrl + ")");
handlerScript = request.getContextPath() + "/javascript/iframe_handler.js";
handlerScript = request.getContextPath() + "/javascript/iframe_handler.js";
public String getURLSource(RenderRequest request, RenderResponse response, PortletPreferences prefs) { String [] srcReplaceValues = { request.getServerName(), Integer.toString(request.getServerPort()), request.getContextPath() }; String source = (String) PortletMessaging.receive(request, IFRAME_SRC_URL); if (source == null) { source = StringUtils.replaceEach(getAttributePreference(prefs, "SRC"), SRC_REPLACE_KEYS, srcReplaceValues); } // Sometimes, iframe's SRC attribute can be set to a local url to allow cross-domain scripting. // If proxy remote URL and its corresponding local path are set, then the proxy remote URL prefix // should be replaced by the local path. String proxyRemoteURL = StringUtils.replaceEach(getAttributePreference(prefs, "PROXYREMOTEURL"), SRC_REPLACE_KEYS, srcReplaceValues); String proxyLocalPath = StringUtils.replaceEach(getAttributePreference(prefs, "PROXYLOCALPATH"), SRC_REPLACE_KEYS, srcReplaceValues); if (StringUtils.isNotEmpty(proxyRemoteURL) && StringUtils.isNotEmpty(proxyLocalPath) && StringUtils.startsWith(source, proxyRemoteURL)) { source = proxyLocalPath + source.substring(proxyRemoteURL.length()); } return source; }
public String getURLSource(RenderRequest request, RenderResponse response, PortletPreferences prefs) { String [] srcReplaceValues = { request.getServerName(), Integer.toString(request.getServerPort()), request.getContextPath() }; String source = (String) PortletMessaging.receive(request, IFRAME_SRC_URL); if (source == null) { source = StringUtils.replaceEach(getAttributePreference(prefs, "SRC"), SRC_REPLACE_KEYS, srcReplaceValues); } // Sometimes, iframe's SRC attribute can be set to a local url to allow cross-domain scripting. // If proxy remote URL and its corresponding local path are set, then the proxy remote URL prefix // should be replaced by the local path. String proxyRemoteURL = StringUtils.replaceEach(getAttributePreference(prefs, "PROXYREMOTEURL"), SRC_REPLACE_KEYS, srcReplaceValues); String proxyLocalPath = StringUtils.replaceEach(getAttributePreference(prefs, "PROXYLOCALPATH"), SRC_REPLACE_KEYS, srcReplaceValues); if (StringUtils.isNotEmpty(proxyRemoteURL) && StringUtils.isNotEmpty(proxyLocalPath) && StringUtils.startsWith(source, proxyRemoteURL)) { source = proxyLocalPath + source.substring(proxyRemoteURL.length()); } return source; }
handlerScript = request.getContextPath() + "/javascript/iframe_handler.js";
handlerScript = request.getContextPath() + "/javascript/iframe_handler.js";
/** * This method follows JSF Spec section 2.1.1. It renders a view from a non-faces * request. This is useful for a default view as well as for views that need to * be rendered from the portlet's edit and help buttons. * * @param request The portlet render request. * @param response The portlet render response. * @param view The name of the view that needs to be rendered. */ protected void nonFacesRequest(RenderRequest request, RenderResponse response, String view) throws PortletException { if (log.isTraceEnabled()) log.trace("Non-faces request: contextPath = " + request.getContextPath()); setContentType(request, response); // do this in case nonFacesRequest is called by a subclass ApplicationFactory appFactory = (ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); Application application = appFactory.getApplication(); ViewHandler viewHandler = application.getViewHandler(); FacesContext facesContext = facesContext(request, response); UIViewRoot viewRoot = viewHandler.createView(facesContext, view); viewRoot.setViewId(view); facesContext.setViewRoot(viewRoot); lifecycle.render(facesContext); }