Project

General

Profile

Revision 563

Added by Matt Jones about 20 years ago

Added a new URL protocol handler class for the metacat protocol. This
class will replace the current MetacatURL class in a much simpler and
extensible manner. See the documentation for java.net.URLConnection and
java.net.URL for details.

View differences:

src/edu/ucsb/nceas/protocols/metacat/MetacatURLConnection.java
1
package edu.ucsb.nceas.protocols.metacat;
2

  
3
import java.io.IOException;
4
import java.net.URL;
5

  
6
public class MetacatURLConnection extends java.net.URLConnection
7
{
8
  public MetacatURLConnection(URL u)
9
  {
10
    super(u);
11
  }
12

  
13
  public void setRequestHeader(String name, String value)
14
  {
15
  }
16

  
17
  public void connect() throws IOException
18
  {
19
    super.connected = true;
20
  }
21
}
0 22

  
src/edu/ucsb/nceas/protocols/metacat/Handler.java
1
package edu.ucsb.nceas.protocols.metacat;
2

  
3
import java.net.URL;
4
import java.net.URLConnection;
5

  
6
public class Handler extends java.net.URLStreamHandler
7
{
8
  protected URLConnection openConnection(URL u)
9
  {
10
    //...create and return a custom 
11
    // URLConnection initialized
12
    // with a reference to the target 
13
    // URL object...
14
    return new MetacatURLConnection(u);
15
  }
16
}
0 17

  

Also available in: Unified diff