api-servlet/src/main/java/org/ocpsoft/rewrite/servlet/util/URLBuilder.java
public static URLBuilder createFrom(final String segments)
   {
      if (segments == null)
      {
         throw new IllegalArgumentException("URL cannot be null.");
      }
      if (segments.contains("?"))
      {
         String[] parts = segments.split("\\?", -1);
         String path = parts[0];
         String query = parts[1];
         if (parts.length > 2)
         {
            query = Strings.join(Arrays.asList(Arrays.copyOfRange(parts, 1, parts.length)), "?");
         }
         return new URLBuilder().appendPathSegments(path).addQueryParameters(query);
      }
      return new URLBuilder().appendPathSegments(segments);
   }
public static URLBuilder createFrom(final String segments)
   {
      if (segments == null)
      {
         throw new IllegalArgumentException("URL cannot be null.");
      }
      if (segments.contains("?"))
      {
         String[] parts = segments.split("\\?", -1);
         String path = parts[0];
         String query = parts[1];
         if (parts.length > 2)
         {
            query = Strings.join(Arrays.asList(Arrays.copyOfRange(parts, 1, parts.length)), "?");
         }
         return new URLBuilder().appendPathSegments(path).addQueryParameters(query);
      }
      return new URLBuilder().appendPathSegments(segments);
   }
public static URLBuilder createFrom ( final String segments ) { if ( segments == null ) { throw new IllegalArgumentException ( "URL cannot be null." ) ; } if ( segments . contains ( "?" ) ) { String [ ] parts = segments . split ( "\\?" , - 1 ) ; String path = parts [ 0 ] ; String query = parts [ 1 ] ; if ( parts . length > 2 ) { query = Strings . join ( Arrays . asList ( Arrays . copyOfRange ( parts , 1 , parts . length ) ) , "?" ) ; } return new URLBuilder ( ) . appendPathSegments ( path ) . addQueryParameters ( query ) ; } return new URLBuilder ( ) . appendPathSegments ( segments ) ; }
Create a new instance of {@link URLBuilder} from the given URL path segments.
Create a new instance of {