Package org.olat.core.gui.render

Examples of org.olat.core.gui.render.URLBuilder


          }
          // render initial state of new window by redirecting (302) to the new
          // window id. needed for asyncronous data like images loaded
         
          // todo maybe better delegate window registry to the windowbackoffice?
          URLBuilder ubu = new URLBuilder(uriPrefix, resWindow.getInstanceId(), String.valueOf(resWindow.timestamp), resWindow.wbackofficeImpl);
          StringOutput sout = new StringOutput(30);
          ubu.buildURI(sout, null, null);
          mr = new RedirectMediaResource(sout.toString());
          ServletUtil.serveResource(request, response, mr);
          if (isDebugLog) {
            long diff = System.currentTimeMillis() - debug_start;
            debugMsg.append("rdirnw:").append(diff).append(LOG_SEPARATOR);
            Tracing.logDebug(debugMsg.toString(), Window.class);
          }
          return;
        }
      }

      if (inline) {
          // do inline rendering.
         
          Container top = getContentPane();
          // validate prior to rendering, but only if the timestamp was not null
          // /
          // the component just got dispatched
          if (validate) { // do not validate if a previous validate lead to a
            // redirect; validating makes no sense here
            //long t1 = System.currentTimeMillis();
            ValidatingVisitor vv = new ValidatingVisitor(gsettings, jsAndCssAdder);
            ComponentTraverser ct = new ComponentTraverser(vv, top, false);
            ct.visitAll(ureq);
            wbackofficeImpl.fireCycleEvent(Window.AFTER_VALIDATING);
            ValidationResult vr = vv.getValidationResult();
            String newModUri = vr.getNewModuleURI();

            vr.getJsAndCSSAdder().finishAndCheckChange(); // ignore the return value since we are just about rendering anyway
         
            if (newModUri != null) {
              // send 302 redirect without dispatching, but just rerender
              // inline.
              // set window id to cur id, timestamp to current timestamp,
              // component id to -1 -> indicates rerender
              String uri = buildURIForRedirect(newModUri);
              MediaResource mrr = new RedirectMediaResource(uri);
              // set this only for the first request (the .html request), but clear it afterwards for asyncmedia
              validatingCausedRerendering = true;
              ServletUtil.serveResource(request, response, mrr);
              if (isDebugLog) {
                long diff = System.currentTimeMillis() - debug_start;
                debugMsg.append("rdirva:").append(diff).append(LOG_SEPARATOR);
                Tracing.logDebug(debugMsg.toString(), Window.class);
              }
              return;
            }
          }

         
          wbackofficeImpl.fireCycleEvent(BEFORE_INLINE_RENDERING);
          String result;
          synchronized(render_mutex) { //o_clusterOK by:fj
            // render now
            if (incTimestamp) timestamp++;
            String newTimestamp = String.valueOf(timestamp);
            // add the businesscontrol path for bookmarking:
            // each url has a part in it (the so called business path), which, in case of an invalid url or invalidated
            // session, can be used as a bookmark. that is, urls from our framework are bookmarkable, but require some little
            // coding effort: setting an appropriate business path and launching for each controller.
            // note: the businesspath may also be used as a easy (but of course not perfect) back-button-solution:
            // if the timestamp of a request is outdated, simply jump to its bookmarked business control path.
            URLBuilder ubu = new URLBuilder(uriPrefix, getInstanceId(), newTimestamp, wbackofficeImpl);
            RenderResult renderResult = new RenderResult();
           
            // if we have an around-component-interception
            // set the handler for this render cycle
            InterceptHandler interceptHandler = wbackofficeImpl.getInterceptHandler();
View Full Code Here


              String result = null;
              try {
                toRender.setDomReplaceable(false);
                wrapper.setContent(toRender);
                String newTimestamp = String.valueOf(timestamp);
                URLBuilder ubu = new URLBuilder(uriPrefix,getInstanceId(), newTimestamp,wbackofficeImpl);

                renderResult = new RenderResult();

                // if we have an around-component-interception
                // set the handler for this render cycle
View Full Code Here

   * @param moduleUri
   * @param bc the businesscontrolpath
   * @return the new (relative) url as a string
   */
  private String buildURIFor(Window win, String timestampId, String moduleUri) {
    URLBuilder ubu = new URLBuilder(uriPrefix, win.getInstanceId(), timestampId, wbackofficeImpl);
    StringOutput so = new StringOutput();
    ubu.buildURI(so, null, null, moduleUri, 0);
    String uri = so.toString();
    return uri;
 
View Full Code Here

  public void testInlineTranslationReplaceLocalizationMarkupWithHTML() {
    I18nManager i18nMgr = I18nManager.getInstance();
    // enable inline translation markup
    i18nMgr.setMarkLocalizedStringsEnabled(null, true);
    Translator inlineTrans = Util.createPackageTranslator(InlineTranslationInterceptHandlerController.class, i18nMgr.getLocaleOrNull("de"));
    URLBuilder inlineTranslationURLBuilder = new jUnitURLBuilder();
    String testBundle = "org.olat.core.util.i18n.junittestdata";
    String testKey = "no.need.to.translate.this";
    String rawtext1 = "Lorem impsum<b>nice stuff</b>";
    String rawtext2 = "Holderadio <ul>lsdfsdf<y  asdf blblb";
    String combinedKey = testBundle + ":" + testKey;
View Full Code Here

 
  private String getRedirectToURL(UserSession usess) {
    ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute("AUTHCHIEFCONTROLLER");
    Window w = cc.getWindow();
   
    URLBuilder ubu = new URLBuilder("", w.getInstanceId(), String.valueOf(w.getTimestamp()), null);
    StringOutput sout = new StringOutput(30);
    ubu.buildURI(sout, null, null);
   
    return WebappHelper.getServletContextPath() + DispatcherAction.PATH_AUTHENTICATED + sout.toString();
  }
View Full Code Here

    currentWindow.setUriPrefix(WebappHelper.getServletContextPath() + DispatcherAction.PATH_AUTHENTICATED);
    Windows.getWindows(ureq).registerWindow(currentWindow);
 
    // redirect to AuthenticatedDispatcher
    // IMPORTANT: windowID has changed due to re-registering current window -> do not use ureq.getWindowID() to build new URLBuilder.
    URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherAction.PATH_AUTHENTICATED, currentWindow.getInstanceId(), "1", null)
    StringOutput sout = new StringOutput(30);
    ubu.buildURI(sout, null, null);
    ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(sout.toString()));
   
    return LOGIN_OK;
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.render.URLBuilder

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.