Package org.jboss.seam.ui.util

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


   }
  
   @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

      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

{

   @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

      UIConversationId uiConversationId = UIConversationId.newInstance();
      uiConversationId.setViewId(Pages.getViewId(getFacesContext()));
      try
      {
         UrlBuilder urlBuilder = new UrlBuilder(StyleResource.WEB_RESOURCE_PATH + super.getSrc(), 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

TOP

Related Classes of org.jboss.seam.ui.util.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.