Examples of UrlBuilder


Examples of org.jboss.seam.ui.util.UrlBuilder

public class UrlBuilderTest
{
   @Test
   public void testBaseUrlAlreadyHasParams() throws UnsupportedEncodingException
   {
      UrlBuilder url = new UrlBuilder("/someurl?arg1=a", "", "UTF8");
      url.addParameter("foo", "bar");

      String encodedUrl = url.getEncodedUrl();
     
      assert "/someurl?arg1=a&foo=bar".equals(encodedUrl);
   }
View Full Code Here

Examples of org.jboss.seam.ui.util.UrlBuilder

   }
  
   @Test
   public void testParameterOrdering() throws UnsupportedEncodingException
   {
      UrlBuilder url = new UrlBuilder("/Hotel.seam", "", "UTF-8");
      url.addParameter("hotelId", "5");
      url.addParameter("cid", "10");
      url.addParameter("z", "z");
      url.addParameter("a", "a");
      String encodedUrl = url.getEncodedUrl();
      assert "/Hotel.seam?hotelId=5&cid=10&z=z&a=a".equals(encodedUrl) : "Parameters not properly ordered";
   }
View Full Code Here

Examples of org.jboss.seam.ui.util.UrlBuilder

      uiConversationId.setViewId(Pages.getViewId(getFacesContext()));
      String src = super.getSrc() != null ? super.getSrc().toString() : null;
      SafeStyleResources.instance().addSafeStyleResource(src);
      try
      {
         UrlBuilder urlBuilder = new UrlBuilder(StyleResource.WEB_RESOURCE_PATH + src, null, FacesContext.getCurrentInstance().getResponseWriter().getCharacterEncoding());
         urlBuilder.addParameter(uiConversationId);
         if (isIsolated())
         {
            UIComponent namingContainer = getParentNamingContainer(this);
            if (namingContainer != null)
            {
               UIParameter idPrefix = new UIParameter();
               idPrefix.setName("idPrefix");
               urlBuilder.addParameter("idPrefix", namingContainer.getClientId(getFacesContext()));
            }
         }
         return urlBuilder.getEncodedUrl();
      }
      catch (UnsupportedEncodingException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

Examples of org.linkedin.util.url.URLBuilder

   * @param url
   * @return the resource
   */
  public static Resource create(URL url)
  {
    URLBuilder rootURL = URLBuilder.createFromPath("/");
    rootURL.setScheme(url.getProtocol());
    rootURL.setHost(url.getHost());
    rootURL.setPort(url.getPort());
    rootURL.setUserInfo(url.getUserInfo());

    return create(rootURL.toJavaURL(), "/").createRelative(url.getPath());
  }
View Full Code Here

Examples of org.ocpsoft.rewrite.servlet.util.URLBuilder

         }


         if (redirectURL != null)
         {
            URLBuilder encodedRedirectUrl = URLBuilder.createFrom(redirectURL).encode();
            redirectURL = encodedRedirectUrl.toString();
            if (Redirect.PERMANENT.equals(rule.getRedirect()))
               ((HttpInboundServletRewrite) event).redirectPermanent(redirectURL);
            if (Redirect.TEMPORARY.equals(rule.getRedirect()))
               ((HttpInboundServletRewrite) event).redirectTemporary(redirectURL);
         }
View Full Code Here

Examples of org.ocpsoft.rewrite.servlet.util.URLBuilder

      else if (event instanceof HttpOutboundServletRewrite)
      {
         HttpOutboundServletRewrite out = (HttpOutboundServletRewrite) event;

         String outboundURL = out.getOutboundAddress().toString();
         URLBuilder url = URLBuilder.createFrom(outboundURL);

         url.getQueryStringBuilder().removeParameter(tokenName);

         QueryStringBuilder newQuery = QueryStringBuilder.createNew();
         for (String param : excludedParams) {
            newQuery.addParameter(param, url.getQueryStringBuilder().removeParameter(param).toArray(new String[] {}));
         }

         if (!params.isEmpty())
         {
            for (String param : url.getQueryStringBuilder().getParameterNames())
            {
               if (!params.contains(param))
               {
                  newQuery.addParameter(param,
                           url.getQueryStringBuilder().removeParameter(param).toArray(new String[] {}));
               }
            }
         }

         if (outboundURL.contains("?") && (outboundURL.startsWith(out.getContextPath()) || outboundURL.startsWith("/")))
         {
            if (!url.getQueryStringBuilder().isEmpty())
            {
               String encoded = checksumStrategy.embedChecksum(url.getQueryStringBuilder().toQueryString());
               encoded = encodingStrategy.encode(encoded);

               newQuery.addParameter(tokenName, encoded);
               out.setOutboundAddress(AddressBuilder.create(url.toPath() + newQuery.toQueryString()));
            }
         }
      }
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.servlet.util.URLBuilder

         if (result != null)
         {
            String parentActionURL = parent.getActionURL(context, viewId);
            if (parentActionURL.contains("?"))
            {
               URLBuilder builder = URLBuilder.createFrom(result);
               builder.getQueryStringBuilder().addParameters(parentActionURL);
               result = builder.toURL();
            }
         }
      }
      if (result == null)
         result = parent.getActionURL(context, viewId);
View Full Code Here

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

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

              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

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

   * @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
TOP
Copyright © 2018 www.massapi.com. 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.