/** * @see org.opencms.loader.I_CmsResourceLoader#service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(CmsObject cms, CmsResource resource, ServletRequest req, ServletResponse res) throws IOException, CmsException { // get the selected element from the parameters String element = req.getParameter(I_CmsResourceLoader.PARAMETER_ELEMENT); // get the value as a String String value = dumpAsString(cms, resource, element, cms.getRequestContext().getLocale(), req, res); if (value != null) { // extract the XML document from the current request (should have been cached already) I_CmsXmlDocument doc = unmarshalXmlDocument(cms, resource, req); // append the result to the output stream byte[] result = value.getBytes(doc.getEncoding()); res.getOutputStream().write(result); } }
/** * @see org.opencms.loader.I_CmsResourceLoader#service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(CmsObject cms, CmsResource resource, ServletRequest req, ServletResponse res) throws IOException, CmsException { // get the selected element from the parameters String element = req.getParameter(I_CmsResourceLoader.PARAMETER_ELEMENT); // get the value as a String String value = dumpAsString(cms, resource, element, cms.getRequestContext().getLocale(), req, res); if (value != null) { // extract the XML document from the current request (should have been cached already) I_CmsXmlDocument doc = unmarshalXmlDocument(cms, resource, req); // append the result to the output stream byte[] result = value.getBytes(doc.getEncoding()); res.getOutputStream().write(result); } }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale selectedLocale, HttpServletRequest req, HttpServletResponse res) throws CmsException, IOException { if ((element == null) || (selectedLocale == null)) { // element and locale to display must be specified throw new CmsLoaderException(Messages.get().container( Messages.ERR_LOADER_XML_NEED_ELEMENT_LOCALE_1, resource.getRootPath())); } // get the value as a String String value = dumpAsString(cms, resource, element, selectedLocale, req, res); if (value != null) { // extract the XML document from the current request (should have been cached already) I_CmsXmlDocument doc = unmarshalXmlDocument(cms, resource, req); // convert the value to bytes return value.getBytes(doc.getEncoding()); } return new byte[0]; }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale selectedLocale, HttpServletRequest req, HttpServletResponse res) throws CmsException, IOException { if ((element == null) || (selectedLocale == null)) { // element and locale to display must be specified throw new CmsLoaderException( Messages.get().container(Messages.ERR_LOADER_XML_NEED_ELEMENT_LOCALE_1, resource.getRootPath())); } // get the value as a String String value = dumpAsString(cms, resource, element, selectedLocale, req, res); if (value != null) { // extract the XML document from the current request (should have been cached already) I_CmsXmlDocument doc = unmarshalXmlDocument(cms, resource, req); // convert the value to bytes return value.getBytes(doc.getEncoding()); } return new byte[0]; }
/** * @see org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void load(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, CmsException { // ensure the requested XML document gets cached in the request attributes unmarshalXmlDocument(cms, resource, req); CmsTemplateLoaderFacade loaderFacade = OpenCms.getResourceManager().getTemplateLoaderFacade( cms, resource, getTemplatePropertyDefinition()); loaderFacade.getLoader().load(cms, loaderFacade.getLoaderStartResource(), req, res); }
/** * @see org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void load(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, CmsException { // ensure the requested XML document gets cached in the request attributes unmarshalXmlDocument(cms, resource, req); CmsTemplateLoaderFacade loaderFacade = getTemplateLoaderFacade(cms, resource, req); CmsTemplateContext context = loaderFacade.getTemplateContext(); req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT, context); TemplateBean templateBean = new TemplateBean( context != null ? context.getKey() : loaderFacade.getTemplateName(), loaderFacade.getTemplate()); templateBean.setForced((context != null) && context.isForced()); req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean); loaderFacade.getLoader().load(cms, loaderFacade.getLoaderStartResource(), req, res); }
I_CmsXmlDocument doc = unmarshalXmlDocument(cms, resource, req);
I_CmsXmlDocument doc = unmarshalXmlDocument(cms, resource, req);