public class HttpPidMinter extends Object implements PidMinter
Modifier and Type | Field and Description |
---|---|
protected org.apache.http.client.HttpClient |
client |
protected String |
method |
protected String |
password |
protected String |
url |
protected String |
username |
Constructor and Description |
---|
HttpPidMinter(String url,
String method,
String username,
String password,
String regex,
String xpath)
Create a new HttpPidMinter.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.client.HttpClient |
buildClient()
Setup authentication in httpclient.
|
String |
mintPid()
Mint a unique identifier using an external HTTP API.
|
protected String |
responseToPid(String responseText)
Remove unwanted text from the minter service response to produce the desired identifer.
|
protected org.apache.http.client.HttpClient client
public HttpPidMinter(String url, String method, String username, String password, String regex, String xpath)
url
- The URL for the minter service. This is the only required argument -- all
other parameters can be blank.method
- The HTTP method (POST, PUT or GET) used to generate a new PID (POST will
be used if the method is blank.username
- If not blank, use this username to connect to the minter service.password
- If not blank, use this password used to connect to the minter service.regex
- If not blank, use this regular expression used to remove unwanted text from the
minter service response. For example, if the response text is "/foo/bar:baz" and the
desired identifier is "baz", then the regex would be ".*:".xpath
- If not blank, use this XPath expression used to extract the desired identifier
from an XML minter response.protected org.apache.http.client.HttpClient buildClient()
protected String responseToPid(String responseText) throws Exception
Exception
Copyright © 2013-2015 DuraSpace, Inc.. All Rights Reserved.