Exemplo n.º 1
0
 public void init(WebApp wapp) throws Exception {
   if (DHtmlUpdateServlet.getAuExtension(wapp, URI_PREFIX) == null) {
     try {
       DHtmlUpdateServlet.addAuExtension(wapp, URI_PREFIX, this);
     } catch (Throwable ex) {
       log.error("could not initialize AuRedirect extension", ex);
       throw new IllegalStateException("could not initialize AuRedirect extension", ex);
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Returns the AU extension that is associated the specified prefix.
  *
  * @since 5.0.0
  */
 public static final AuExtension getAuExtension(WebApp wapp, String prefix) {
   DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
   if (upsv == null) {
     synchronized (DHtmlUpdateServlet.class) {
       upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
       if (upsv == null) {
         Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS);
         return aues != null ? (AuExtension) aues.get(prefix) : null;
       }
     }
   }
   return upsv.getAuExtension(prefix);
 }
Exemplo n.º 3
0
  /**
   * Adds an AU extension and associates it with the specified prefix, even before {@link
   * DHtmlUpdateServlet} is started.
   *
   * <p>Unlike {@link #addAuExtension(String, AuExtension)}, it can be called even if the update
   * servlet is not loaded yet ({@link #getUpdateServlet} returns null).
   *
   * <p>If there was an AU extension associated with the same name, the the old AU extension will be
   * replaced.
   *
   * @since 5.0.0
   */
  public static final AuExtension addAuExtension(WebApp wapp, String prefix, AuExtension extension)
      throws ServletException {
    DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
    if (upsv == null) {
      synchronized (DHtmlUpdateServlet.class) {
        upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
        if (upsv == null) {
          checkAuExtension(prefix, extension);
          Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS);
          if (aues == null) wapp.setAttribute(ATTR_AU_PROCESSORS, aues = new HashMap(4));
          return (AuExtension) aues.put(prefix, extension);
        }
      }
    }

    return upsv.addAuExtension(prefix, extension);
  }