View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.file;
8   
9   import org.mule.api.endpoint.MalformedEndpointException;
10  import org.mule.endpoint.AbstractEndpointURIBuilder;
11  
12  import java.net.URI;
13  import java.util.Properties;
14  
15  /**
16   * <code>FileEndpointBuilder</code> File uris need some special processing because
17   * the uri path can be any length, and the default resolver relies on a particular
18   * path format.
19   */
20  
21  public class FileEndpointURIBuilder extends AbstractEndpointURIBuilder
22  {
23      @Override
24      protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
25      {
26          address = uri.getSchemeSpecificPart();
27          if (address.startsWith("//"))
28          {
29              address = address.substring(2);
30          }
31  
32          int i = address.indexOf("?");
33          if (i > -1)
34          {
35              address = address.substring(0, i);
36          }
37      }
38  }