/** * @see {@link #getComponentParameter(String)} * @deprecated since 2.26.01. Use {@link #getComponentParameter(String)} instead */ @Deprecated public String getParameter(String name, HstRequest request) { return this.getComponentConfiguration().getParameter(name, request.getRequestContext().getResolvedSiteMapItem()); }
/** * @see {@link #getComponentLocalParameter(String)} * @deprecated since 2.26.01. Use {@link #getComponentLocalParameter(String)} instead */ @Deprecated public String getLocalParameter(String name, HstRequest request) { return (String)this.getComponentConfiguration().getLocalParameter(name, request.getRequestContext().getResolvedSiteMapItem()); }
/** * See {@link #getComponentLocalParameters()}, * @deprecated since 2.26.01. Use {@link #getComponentLocalParameters()} instead */ @Deprecated public Map<String,String> getLocalParameters(HstRequest request){ return this.getComponentConfiguration().getLocalParameters(request.getRequestContext().getResolvedSiteMapItem()); }
@Override public void doBeforeRender(HstRequest request, HstResponse response) throws HstComponentException { if(getComponentConfiguration().getRenderPath() == null || "".equals(getComponentConfiguration().getRenderPath())) { // set default builtin template. This is hardcoded. The freemarker templates are relative to the current package name String xtype = getComponentConfiguration().getXType(); if ("HST.UnorderedList".equalsIgnoreCase(xtype)) { response.setRenderPath("classpath:ul.ftl"); } else if ("HST.OrderedList".equalsIgnoreCase(xtype)) { response.setRenderPath("classpath:ol.ftl"); } else if ("HST.Span".equalsIgnoreCase(xtype)) { response.setRenderPath("classpath:span.ftl"); } else if ("HST.vBox".equalsIgnoreCase(xtype)) { response.setRenderPath("classpath:vbox.ftl"); } else if ("HST.NoMarkup".equalsIgnoreCase(xtype)) { response.setRenderPath("classpath:nomarkup.ftl"); } else { response.setRenderPath("classpath:vbox.ftl"); } } super.doBeforeRender(request, response); }
/** * Add <code>params</code> metadata to the {@code model} from the {@code window}. * @param window HST Component Window instance * @param model the {@link MetadataContributable} model instance where the parameter map should be contributed to */ private void addParametersInfoMetadata(HstComponentWindow window, HstRequest hstRequest, MetadataContributable model) { final ComponentConfiguration compConfig = window.getComponent().getComponentConfiguration(); if (compConfig == null) { return; } final Object paramsInfo = ParametersInfoUtils.createParametersInfo(window.getComponent(), compConfig, hstRequest); JsonNode paramsInfoNode = null; if (paramsInfo != null) { try { paramsInfoNode = getObjectMapper().valueToTree(paramsInfo); model.putMetadata(PARAMETERS_INFO_METADATA, paramsInfoNode); } catch (Exception e) { log.warn("Failed to convert ParametersInfo instance ({}) to ObjectNode.", paramsInfo, e); } } final ResolvedSiteMapItem resolvedSiteMapItem = RequestContextProvider.get().getResolvedSiteMapItem(); final ObjectNode paramsNode = getObjectMapper().getNodeFactory().objectNode(); for (String paramName : compConfig.getParameterNames()) { final String paramValue = compConfig.getParameter(paramName, resolvedSiteMapItem); if (paramValue != null) { paramsNode.put(paramName, paramValue); } } model.putMetadata(PARAMETERS_METADATA, paramsNode); }
/** * @see {@link #getComponentParameters()} * @deprecated since 2.26.01. Use #getComponentParameters()} instead */ @Deprecated public Map<String,String> getParameters(HstRequest request){ return this.getComponentConfiguration().getParameters(request.getRequestContext().getResolvedSiteMapItem()); }
private String getComponentRenderPath() { final HstComponentWindow window = getCurrentComponentWindow(); if (window == null) { return ""; } final HstComponent component = window.getComponent(); if (component == null) { return ""; } final ComponentConfiguration componentConfiguration = component.getComponentConfiguration(); if (componentConfiguration == null) { return ""; } return componentConfiguration.getRenderPath(); }
public void doBeforeServeResource(HstRequest request, HstResponse response) throws HstComponentException { if (componentConfig.getServeResourcePath() == null && request.getResourceID() != null) { response.setServeResourcePath(request.getResourceID()); } }
" waste you are not aware of. If it is on purpose, for example because the component does only some" + " processing that does not involve direct response contribution, you can mark the component with '{} = true'.", RequestContextProvider.get().getServletRequest(), childWindow.getComponent().getComponentConfiguration().getCanonicalPath(), getRenderer(childWindow, childResponseImpl), COMPONENT_PROPERTY_SUPPRESS_WASTE_MESSAGE); } else { " If it is on purpose, for example because the component does only some" + " processing that does not involve direct response contribution, you can mark the component with '{} = true'.", RequestContextProvider.get().getServletRequest(), childWindow.getComponent().getComponentConfiguration().getCanonicalPath(), getRenderer(childWindow, childResponseImpl), COMPONENT_PROPERTY_SUPPRESS_WASTE_MESSAGE);
/** * See {@link #getComponentParameter(String)}, where we now return all resolved parameters (thus with inheritance of * ancestor components) * @return Map of all parameters, and when no parameters present, return empty map. */ public Map<String,String> getComponentParameters(){ return this.getComponentConfiguration().getParameters(RequestContextProvider.get().getResolvedSiteMapItem()); }
/** * Returns resolved parameter from HstComponentConfiguration : resolved means that possible property placeholders like * ${1} or ${year}, where the first refers to the first wildcard matcher in a resolved sitemap item, and the latter * to a resolved parameter in the resolved HstSiteMapItem * * The parameter map used has inherited parameters from ancestor components, which have precedence over child components) * * @param name * @return the resolved parameter value for this name, or <code>null</null> if not present */ public String getComponentParameter(String name) { return this.getComponentConfiguration().getParameter(name, RequestContextProvider.get().getResolvedSiteMapItem()); }
/** * See {@link #getParameter(String, HstRequest)}, but now, only resolved parameters directly on the HstComponent are taken into * acoount: in other words, no inheritance of parameters is applied * @param name * @param request * @return the resolved parameter value for this name, or <code>null</null> if not present */ public String getLocalParameter(String name, HstRequest request) { return (String)this.getComponentConfiguration().getLocalParameter(name, request.getRequestContext().getResolvedSiteMapItem()); }
/** * See {@link #getParameters(HstRequest)}, but now, only resolved parameter map of parameters is returned that is directly on * the HstComponenConfiguration, thus, no inheritance is applied * @param request * @return Map of all parameters, and when no parameters present, return empty map. */ public Map<String,String> getLocalParameters(HstRequest request){ return this.getComponentConfiguration().getLocalParameters(request.getRequestContext().getResolvedSiteMapItem()); }
/** * See {@link #getParameter(String, HstRequest)}, where we now return all resolved parameters (thus with inheritance of * ancestor components) * @param request * @return Map of all parameters, and when no parameters present, return empty map. */ public Map<String,String> getParameters(HstRequest request){ return this.getComponentConfiguration().getParameters(request.getRequestContext().getResolvedSiteMapItem()); }
protected String getParameter(String name, HstRequest request, String defaultValue) { String value = (String) this.getComponentConfiguration().getParameter(name, request.getRequestContext().getResolvedSiteMapItem()); return (value != null ? value : defaultValue); } }
/** * See {@link #getComponentParameter(String)}, but now, only resolved parameters directly on the HstComponent are taken into * account: in other words, no inheritance of parameters is applied * @param name * @return the resolved parameter value for this name, or <code>null</null> if not present */ public String getComponentLocalParameter(String name) { return (String)this.getComponentConfiguration().getLocalParameter(name, RequestContextProvider.get().getResolvedSiteMapItem()); }
/** * See {@link #getComponentParameters()}, but now, only resolved parameter map of parameters is returned that is directly on * the HstComponenConfiguration, thus, no inheritance is applied * @return Map of all parameters, and when no parameters present, return empty map. */ public Map<String,String> getComponentLocalParameters(){ return this.getComponentConfiguration().getLocalParameters(RequestContextProvider.get().getResolvedSiteMapItem()); }
protected String getParameter(String name, HstRequest request) { return (String)this.getComponentConfiguration().getParameter(name, request.getRequestContext().getResolvedSiteMapItem()); }
protected String getParameter(String name, HstRequest request) { return (String)this.getComponentConfiguration().getParameter(name, request.getRequestContext().getResolvedSiteMapItem()); }
protected String getParameter(String name, HstRequest request, String defaultValue) { String value = (String) this.getComponentConfiguration().getParameter(name, request.getRequestContext().getResolvedSiteMapItem()); return (value != null ? value : defaultValue); }