Esempio n. 1
0
 @Override
 public String getInternalUrl(String page, Map<String, ?> params, Parameters frameworkParameters)
     throws FrameworkException {
   if (log.isDebugEnabled()) {
     log.debug("calling urlConverter " + urlConverter);
   }
   return urlConverter.getInternalUrl(page, params, frameworkParameters).getUrl();
 }
Esempio n. 2
0
 @Override
 public String getUrl(
     String path, Map<String, ?> parameters, Parameters frameworkParameters, boolean escapeAmps)
     throws FrameworkException {
   Url link = urlConverter.getUrl(path, parameters, frameworkParameters, escapeAmps);
   log.debug("got " + link + " from " + urlConverter);
   if (link == Url.NOT) {
     return fallbackConverter.getUrl(path, parameters, frameworkParameters, escapeAmps).getUrl();
   } else {
     return link.getUrl();
   }
 }
Esempio n. 3
0
 @Override
 public Parameter<?>[] getParameterDefinition() {
   if (parDef == null) {
     parDef =
         new Parameter<?>[] {
           ACTION,
           Parameter.REQUEST,
           Parameter.CLOUD,
           new Parameter.Wrapper(urlConverter.getParameterDefinition())
         };
   }
   return parDef;
 }
Esempio n. 4
0
 @Override
 public String getProcessUrl(
     String path, Map<String, ?> parameters, Parameters frameworkParameters, boolean escapeAmps)
     throws FrameworkException {
   HttpServletRequest request =
       BasicUrlConverter.getUserRequest(frameworkParameters.get(Parameter.REQUEST));
   State state = State.getState(request);
   frameworkParameters.set(ACTION, state.getId());
   Url url = urlConverter.getProcessUrl(path, parameters, frameworkParameters, escapeAmps);
   if (url == Url.NOT) {
     log.debug("Fall back url");
     return fallbackConverter
         .getProcessUrl(path, parameters, frameworkParameters, escapeAmps)
         .getUrl();
   } else {
     log.debug("Url converter url " + url);
     return url.getUrl();
   }
 }
Esempio n. 5
0
  /**
   * Configures the framework by reading its configuration file 'config/framework.xml' containing a
   * list with UrlConverters.
   */
  protected final void configure(Element el) {
    try {
      description.fillFromXml("description", el);

      NodeList urlconverters = el.getElementsByTagName("urlconverter");
      for (int i = 0; i < urlconverters.getLength(); i++) {
        Element element = (Element) urlconverters.item(i);
        UrlConverter uc;
        try {
          uc = (UrlConverter) Instantiator.getInstance(element, (Framework) this);
        } catch (NoSuchMethodException nsme) {
          uc = (UrlConverter) Instantiator.getInstance(element);
        } catch (ClassNotFoundException cnfe) {
          log.warn(org.mmbase.util.xml.XMLWriter.write(element) + " " + cnfe);
          continue;
        } catch (Throwable t) {
          log.error(org.mmbase.util.xml.XMLWriter.write(element) + ": " + t.getMessage(), t);
          if (t.getCause() != null) {
            log.error("Caused by: " + t.getCause().getMessage(), t.getCause());
          }
          continue;
        }
        urlConverter.add(uc);
      }
      parDef = null;

    } catch (Throwable e) {
      log.error(e.getMessage(), e);
    }
    /*
    BasicUrlConverter buc = new BasicUrlConverter(this);
    if (! urlConverter.contains(buc)) {
        urlConverter.add(buc);
    }
    */
    log.info(
        "Configured with "
            + el.getOwnerDocument().getDocumentURI()
            + " "
            + getClass()
            + " "
            + this);
  }
Esempio n. 6
0
 @Override
 public String toString() {
   return getName() + ": " + description + ": " + urlConverter.toString();
 }