Package de.innovationgate.wgpublisher.webtml.utils

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLException


        status.receptorTag.setRootTagStatus((Status) getStatus());
       
        // Test for inclusion depth. Evaluation will stop, if level 32 reached for stability reasons (stack overflow)
        Integer includeLevel = (Integer) getTMLContext().option(WGACore.ATTRIB_INCLUDELEVEL);
        if (includeLevel.intValue() >= 32) {
          throw new TMLException("Maximum tml:include level of 32 reached. No further inclusions allowed.", true);
        }
        else {
          status.setOption(WGACore.ATTRIB_INCLUDELEVEL, new Integer(includeLevel.intValue() + 1), null);
        }
       
View Full Code Here


                if (!status._isAjaxNoRefreshCall) {
                    javaScript.append("</script>");
                }
              this.setSuffix(getSuffix() + javaScript.toString());
            } catch (UnsupportedEncodingException e) {
              throw new TMLException("Unable to serialize form data.", e, false);
            }
                }
              }
            }
           
View Full Code Here

        // Language behaviour
        if (this.stringToBoolean(this.getAlllanguages()) != true) {
            List<WGLanguage> langs = chooser.getQueryLanguages(db);
            if (langs.size() == 0) {
                throw new TMLException("No allowed query languages for database '" + db.getDbReference() + "' from context " + getTMLContext().getpath(), true);
            }
            parameters.put(WGDatabase.QUERYOPTION_ONLYLANGUAGE, langs.get(0).getName()); // Compatibility with query types not supporting multiple languages
            parameters.put(WGDatabase.QUERYOPTION_LANGUAGES, langs);
        }
       
View Full Code Here

                else {
                  this.setResult(Arrays.asList(param));
                }
            }
            catch (Exception e) {
                throw new TMLException("Exception retrieving url param", e, true);
            }
  }
View Full Code Here

        if (!exprResult.isError()) {
            result = exprResult.getResult();
            return result;
        }
        else {
            throw new TMLException("Error evaluation option expression: " + exprResult.getException().getClass() + exprResult.getException().getMessage(), true);
        }
       
    }
View Full Code Here

    public void tmlStartTag() throws TMLException, WGAPIException {
       
        Status status = (Status) getStatus();
        String name = getOnevent();
        if (name == null) {
            throw new TMLException("Event name was not specified", true);
        }
       
        TMLPortlet portlet = getTMLContext().getportlet();
        if (portlet == null) {
            throw new TMLException("Personalisation is not available", true);
        }
       
        // Test if an event of that name has been issued since last run
        status._executeEvent = false;
        Long beginIndex = (Long) getTMLContext().option(Base.OPTION_PORTLET_EVENT_STARTINDEX);
View Full Code Here

            super.tmlEndTag();
            try {
                getTMLContext().removevar("portletEvent");
            }
            catch (WGAPIException e) {
                throw new TMLException("Exception removing portletEvent variable", e, true);
            }
        }
        else {
            setResult("");
        }
View Full Code Here

            getMethod.setParams(methodParams);
            getMethod.setFollowRedirects(true);
           
            int httpStatus = client.executeMethod(getMethod);
            if (httpStatus != HttpServletResponse.SC_OK) {
                throw new TMLException("Response status " + httpStatus + " (" + getMethod.getStatusText() + ") for included URL " + ref, true);
            }
           
            String encoding = getEncoding();
            if (encoding != null) {
                Reader reader = new InputStreamReader(getMethod.getResponseBodyAsStream(), encoding);
View Full Code Here

        Status status = (Status) getStatus();
       
        // Locate resource
        String tmlName = status.ref;
        if( tmlName == null || tmlName.equals("") ){
          throw new TMLException("Could not retrieve result of included static resource. No reference given.");
        }
       
        String jspPath = "/static/tml/" + tmlName + ".jsp";
       
        // Perform include
        String oldDesignDB = (String) getOption(Base.OPTION_DESIGNDB);
        this.pageContext.setAttribute(ATTRIB_INCLUDEPARENT, status, PageContext.REQUEST_SCOPE);
        getStatus().setOption(Base.OPTION_DESIGNDB, designDB, null);
        try {
           this.pageContext.include(jspPath);
        }
        catch (Exception e) {
          throw new TMLException("Error executing static tml module \"" + tmlName + "\"", e, false);
        }
        finally {
            this.pageContext.setAttribute(ATTRIB_INCLUDEPARENT, null, PageContext.REQUEST_SCOPE);
            getStatus().setOption(Base.OPTION_DESIGNDB, oldDesignDB, null);
        }

        // Import the included root tag result
        if (status.rootTag != null) {
          this.setResult(status.rootTag.result);
          status.rootTag.result = null;
        } else {
          throw new TMLException("Could not retrieve result of included static resource: " + tmlName);
        }
       
        if (getTMLContext().getwgacore().isProfilingEnabled()) {
          HttpServletRequest request = getTMLContext().getrequest();
          if (request != null) {
View Full Code Here

        // Fetch the TML module to include
        WGTMLModule tmllib;
        if (type.equals(TYPE_INNERLAYOUT)) {
          WGContent currentContent =  this.getTMLContext().content();
          if (currentContent.isDummy() || !currentContent.hasCompleteRelationships()) {
            throw new TMLException("The inner layout of this content cannot be determined, bc. it is either a dummy document, or it doesnt have complete document relationships.");
          }
          tmllib = currentContent.getStructEntry().getInnerLayout(mediaKey);
          designDBKey =  currentContent.getDatabase().getDbReference();
          if (tmllib == null || tmllib.isDummy()) {
            throw new TMLException("Cannot find inner layout for doctype " + this.getTMLContext().content().getStructEntry().getContentType().getName());
          }
        }
       
        else {
          WGDatabase designdb = database;
          if (designDBKey != null) {
            try {
              designdb = this.openContentDB(designDBKey);
            }
            catch (WGUnavailableException e1) {
            }
                catch (WGException e) {
                    throw new TMLException(e.getMessage(), true);
                }
            if (designdb == null || !designdb.isSessionOpen()) {
              throw new TMLException("Cannot open design db: " + designDBKey, true);
            }
          }
         
            tmllib = (WGTMLModule) designdb.getDesignObject(WGDocument.TYPE_TML, status.ref, mediaKey);
          if (tmllib == null) {
            throw new TMLException("Cannot find requested tml module: " + status.ref + " (" + mediaKey + ")");
          }
        }

        // Locate the resource
        try {
            tmlResource = this.getDeployer().locateTmlResource(tmllib);
        }
        catch (DeployerException e1) {
            throw new TMLException("Error deploying WebTML resource", e1, true);
        }
       
        if (tmlResource == null) {
          throw new TMLException("Cannot locate requested tml module: " + tmllib.getName() + " (" + tmllib.getMediaKey() + ")");
        }

        // Do the include
        this.pageContext.setAttribute(ATTRIB_INCLUDEPARENT, status, PageContext.REQUEST_SCOPE);
        String oldDesignDB = (String) getOption(Base.OPTION_DESIGNDB);
        status.setOption(Base.OPTION_DESIGNDB, designDBKey, null);
        try {
           this.pageContext.include(tmlResource);
        }
        catch (Exception e) {
          throw new TMLException("Error executing tml module \"" + tmllib.getName() + "/" + tmllib.getMediaKey() + "\"", e, false);
        }
        finally {
            this.pageContext.setAttribute(ATTRIB_INCLUDEPARENT, null, PageContext.REQUEST_SCOPE);
            status.setOption(Base.OPTION_DESIGNDB, oldDesignDB, null);
        }

        // Transfer result from included root to this tag
        if (status.rootTag != null) {
            this.setResult(status.rootTag.result);
            status.rootTag.result = null;
        } else {
            throw new TMLException("Could not retrieve result of included resource: " + tmlResource);
        }
       
        if (getTMLContext().getwgacore().isProfilingEnabled()) {
          HttpServletRequest request = getTMLContext().getrequest();
          if (request != null) {
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.webtml.utils.TMLException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.