/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsLoaderException(container, cause); } }
/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsLoaderException(container, cause); } }
/** * Returns the initialized resource type instance for the given id.<p> * * @param typeId the id of the resource type to get * * @return the initialized resource type instance for the given id * * @throws CmsLoaderException if no resource type is available for the given id */ public I_CmsResourceType getResourceType(int typeId) throws CmsLoaderException { I_CmsResourceType result = m_configuration.getResourceTypeById(typeId); if (result == null) { throw new CmsLoaderException( Messages.get().container(Messages.ERR_UNKNOWN_RESTYPE_ID_REQ_1, new Integer(typeId))); } return result; }
/** * Returns the initialized resource type instance for the given id.<p> * * @param typeId the id of the resource type to get * * @return the initialized resource type instance for the given id * * @throws CmsLoaderException if no resource type is available for the given id */ public I_CmsResourceType getResourceType(int typeId) throws CmsLoaderException { I_CmsResourceType result = m_configuration.getResourceTypeById(typeId); if (result == null) { throw new CmsLoaderException(Messages.get().container( Messages.ERR_UNKNOWN_RESTYPE_ID_REQ_1, new Integer(typeId))); } return result; }
/** * Returns the initialized resource type instance for the given resource type name.<p> * * @param typeName the name of the resource type to get * * @return the initialized resource type instance for the given name * * @throws CmsLoaderException if no resource type is available for the given name */ public I_CmsResourceType getResourceType(String typeName) throws CmsLoaderException { I_CmsResourceType result = m_configuration.getResourceTypeByName(typeName); if (result != null) { return result; } throw new CmsLoaderException(Messages.get().container(Messages.ERR_UNKNOWN_RESTYPE_NAME_REQ_1, typeName)); }
/** * Returns the initialized resource type instance for the given resource type name.<p> * * @param typeName the name of the resource type to get * * @return the initialized resource type instance for the given name * * @throws CmsLoaderException if no resource type is available for the given name */ public I_CmsResourceType getResourceType(String typeName) throws CmsLoaderException { I_CmsResourceType result = m_configuration.getResourceTypeByName(typeName); if (result != null) { return result; } throw new CmsLoaderException(Messages.get().container(Messages.ERR_UNKNOWN_RESTYPE_NAME_REQ_1, typeName)); }
/** * Creates a new template loader facade.<p> * * Some resource types are actually not loadable themself but require a template * to be processed. This template is attached using the <code>template</code> property. * Depending on the resource type of the template itself, a loader is then selected that * processed the requested resource. The processing itself might start on the template, * or on the requested resource (this will depend on the loader and the resource type implementation).<p> * * @param loader the loader to use * @param resource the file to use * @param template the template to use (ignored if null) * @throws CmsLoaderException in case the template file does not use a loader that actually supports templates */ public CmsTemplateLoaderFacade(I_CmsResourceLoader loader, CmsResource resource, CmsResource template) throws CmsLoaderException { if (!loader.isUsableForTemplates()) { throw new CmsLoaderException(Messages.get().container(Messages.ERR_LOADER_NOT_TEMPLATE_ENABLED_0)); } m_loader = loader; m_resource = resource; m_template = template; }
/** * Creates a new template loader facade.<p> * * Some resource types are actually not loadable themself but require a template * to be processed. This template is attached using the <code>template</code> property. * Depending on the resource type of the template itself, a loader is then selected that * processed the requested resource. The processing itself might start on the template, * or on the requested resource (this will depend on the loader and the resource type implementation).<p> * * @param loader the loader to use * @param resource the file to use * @param template the template to use (ignored if null) * @throws CmsLoaderException in case the template file does not use a loader that actually supports templates */ public CmsTemplateLoaderFacade(I_CmsResourceLoader loader, CmsResource resource, CmsResource template) throws CmsLoaderException { if (!loader.isUsableForTemplates()) { throw new CmsLoaderException(Messages.get().container(Messages.ERR_LOADER_NOT_TEMPLATE_ENABLED_0)); } m_loader = loader; m_resource = resource; m_template = template; }
/** * @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 IOException, CmsException { if ((res == null) || res.isCommitted()) { // nothing we can do return; } String pointer = new String(cms.readFile(resource).getContents()); if (CmsStringUtil.isEmptyOrWhitespaceOnly(pointer)) { throw new CmsLoaderException(Messages.get().container( Messages.ERR_INVALID_POINTER_FILE_1, resource.getName())); } if (pointer.indexOf(':') < 0) { pointer = OpenCms.getLinkManager().substituteLink(cms, pointer); } res.sendRedirect(pointer); }
/** * @see org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public void load(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws IOException, CmsException { if ((res == null) || res.isCommitted()) { // nothing we can do return; } String pointer = new String( cms.readFile(resource).getContents(), CmsLocaleManager.getResourceEncoding(cms, resource)); if (CmsStringUtil.isEmptyOrWhitespaceOnly(pointer)) { throw new CmsLoaderException( Messages.get().container(Messages.ERR_INVALID_POINTER_FILE_1, resource.getName())); } if (pointer.indexOf(':') < 0) { pointer = OpenCms.getLinkManager().substituteLink(cms, pointer); } else { pointer = CmsEncoder.convertHostToPunycode(pointer); } // conditionally append parameters of the current request: pointer = appendLinkParams(pointer, req); res.sendRedirect(pointer); }
/** * @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]; }
if (!(req instanceof HttpServletRequest) || !(res instanceof HttpServletResponse)) { CmsLoaderException e = new CmsLoaderException(Messages.get().container( Messages.ERR_BAD_REQUEST_RESPONSE_0)); throw new JspException(e);
if (!(req instanceof HttpServletRequest) || !(res instanceof HttpServletResponse)) { CmsLoaderException e = new CmsLoaderException( Messages.get().container(Messages.ERR_BAD_REQUEST_RESPONSE_0)); throw new JspException(e);
throw new CmsLoaderException(Messages.get().container( Messages.ERR_NONDEF_PROP_2, templateProperty,
if (locale == null) { throw new CmsLoaderException(Messages.get().container( Messages.ERR_LOADER_UNKNOWN_LOCALE_5, new Object[] {
if (locale == null) { throw new CmsLoaderException( Messages.get().container( Messages.ERR_LOADER_UNKNOWN_LOCALE_5,
if (namedTemplate == null) { throw new CmsLoaderException( Messages.get().container(Messages.ERR_NONDEF_PROP_2, templateProperty, cms.getSitePath(resource)));