|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.impl.empire.model.ModelUtils
public class ModelUtils
Contains utilities to manipulate Jena models as they are read or written by this API.
Field Summary | |
---|---|
static java.lang.String |
BNODE_NS
The namespace used for prefixing Jena BNodes. |
private static int |
COMMENTED_OUTPUT_INDENT
Specifies the identation depth of the generated XML (while commenting RDF/XML) |
private static java.util.Set<java.lang.String> |
KNOWN_URI_SCHEMES
|
private static java.lang.String |
KNOWN_URI_SCHEMES_FILE
The file name that contains known URI schemes registered by IANA (so that we can distinguish a use of an undefined namespace from a valid URI with an unusual scheme). |
private static int |
MAX_REDIRECTS
A constant specifying how many redirects an invocation of a RIG/RQG should be allowed before giving up (e.g., because the redirects may be an infinite loop). |
private static com.hp.hpl.jena.rdf.model.Resource[] |
PRETTY_TYPES
Constant for name of types that will be passed as "prettyTypes" to Jena. |
private static com.hp.hpl.jena.rdf.model.Resource[] |
SSWAP_NODE_TYPES
Types of SSWAPNodes (resources that require special handling in SSWAP Protocol) |
private static java.lang.String |
SSWAP_PROTOCOL_COMMENTS_STYLESHEET
The file name of the XSL StyleSheet that adds comments to an RDF/XML serialization of a SSWAP protocol graph |
Constructor Summary | |
---|---|
ModelUtils()
|
Method Summary | |
---|---|
private static void |
addImportStatements(com.hp.hpl.jena.rdf.model.Model originalModel,
com.hp.hpl.jena.rdf.model.Model partitionedModel)
Copies all import statements from the original model. |
private static void |
addStatementsToPartitionedModel(com.hp.hpl.jena.rdf.model.Resource resource,
com.hp.hpl.jena.rdf.model.Model originalModel,
com.hp.hpl.jena.rdf.model.Model partitionedModel,
java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> alreadyAdded,
boolean followAllResources)
Copies statements that only relate to a specific resource. |
private static void |
addTypeStatements(com.hp.hpl.jena.rdf.model.Resource resource,
com.hp.hpl.jena.rdf.model.Model originalModel,
com.hp.hpl.jena.rdf.model.Model partitionedModel)
|
private static void |
commentRdfXmlProtocolGraph(java.io.InputStream is,
java.io.OutputStream os)
Adds XML comments to RDF/XML representation of a sswap protocol graph. |
private static int |
connect(java.net.HttpURLConnection httpConn,
byte[] inputBytes)
|
private static java.lang.String |
convert(com.hp.hpl.jena.rdf.model.RDFNode node)
|
private static com.hp.hpl.jena.rdf.model.Resource |
convertBNode(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource resource)
Converts a bnode resource into a non-bnode resource (by generating a URI that belongs to a reserved namespace). |
private static java.lang.String |
convertBNodeId(java.lang.String anonId)
Converts an identifier of an anonymous node (AnonId) into a valid URI in the special, reserved namespace that will later be used to convert that node back into a bnode (during serialization) |
static void |
convertSSWAPNodesToBNodes(com.hp.hpl.jena.rdf.model.Model model)
Converts all SSWAP nodes (nodes that require special handling in SSWAP protocol; e.g., sswap:Resource) to BNodes (or more exactly to nodes named using the special BNode naming scheme). |
private static void |
convertToBNodes(java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> resources)
Converts a given set of resources to BNodes (i.e., resources named using the BNode naming scheme) |
private static void |
convertToOWLOntology(org.semanticweb.owlapi.model.OWLOntology ontology,
com.hp.hpl.jena.rdf.model.Model... models)
|
private static com.hp.hpl.jena.rdf.model.Model |
createOutputModel(com.hp.hpl.jena.rdf.model.Model model)
Creates a model that is suitable for writing out using Jena Writers. |
static org.semanticweb.owlapi.model.OWLOntology |
createOWLOntology(org.semanticweb.owlapi.model.OWLOntologyManager manager,
java.lang.String url,
com.hp.hpl.jena.rdf.model.Model model)
|
static org.semanticweb.owlapi.model.OWLOntology |
createOWLOntology(org.semanticweb.owlapi.model.OWLOntologyManager manager,
java.lang.String url,
com.hp.hpl.jena.rdf.model.Model baseModel,
com.hp.hpl.jena.rdf.model.Model closure)
|
static com.hp.hpl.jena.rdf.model.RDFList |
createRDFList(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource listResource)
Creates an RDFList object based on the rdf:List data in the underlying Jena model. |
static com.clarkparsia.utils.web.Response |
executeRequest(java.net.URLConnection requestConn)
Executes the HTTP request associated with the given connection without any input. |
static com.clarkparsia.utils.web.Response |
executeRequest(java.net.URLConnection requestConn,
java.io.InputStream requestBody)
Executes the HTTP request associated with the given connection with the given input which may be null. |
private static com.clarkparsia.utils.web.Response |
executeRequest(java.net.URLConnection requestConn,
java.io.InputStream requestBody,
boolean returnOnHTTPError)
Executes the HTTP request associated with the given connection with the given input which may be null. |
private static void |
forEachResource(com.hp.hpl.jena.rdf.model.Model model,
com.google.common.base.Function<com.hp.hpl.jena.rdf.model.Resource,java.lang.Void> function)
Applies a function to each resource in the model that is mentioned as a subject or an object in any statement in the model. |
static java.lang.String |
generateBNodeId()
|
static java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> |
getAllResourcesForList(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource listResource)
Gets all resources involved in an rdf:List. |
static java.util.Collection<com.hp.hpl.jena.rdf.model.Statement> |
getAllStatementsForList(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource listResource)
Gets all Jena Statements that encode an RDFList |
static com.hp.hpl.jena.rdf.model.RDFNode |
getFirstObjectValue(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource subject,
com.hp.hpl.jena.rdf.model.Property predicate)
A utility method for extracting the first encountered value in the object position for the given resource and predicate. |
static com.hp.hpl.jena.rdf.model.Statement |
getFirstStatement(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource subject,
com.hp.hpl.jena.rdf.model.Property predicate)
Gets the first encountered statement for the with the given resource in the subject position and the predicate |
private static int |
getInvocationTimeout()
|
private static java.io.InputStream |
getKnownURISchemesStream()
|
private static com.hp.hpl.jena.rdf.model.Resource |
getListHead(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource listNode)
Gets a head of a list for a given internal node (not a list member!) |
static java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> |
getListURIs(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource listMember)
Gets the URIs of all lists the given resource is a member |
private static java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> |
getResourcesByType(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource typeResource)
Gets all resources that have the specified type (via rdf:type property) |
static java.util.Collection<java.lang.String> |
getResourcesInNS(com.hp.hpl.jena.rdf.model.Model model,
java.lang.String ns)
Gets URIs of all resources in the model that belong to the specified namespace |
private static java.io.InputStream |
getSSWAPProtocolCommentsXsltStream()
Opens a stream that leads to an XSL style sheet that adds comments to a sswap protocol graph |
static java.util.Collection<java.lang.String> |
getTermsWithoutValidScheme(com.hp.hpl.jena.rdf.model.Model model)
Gets the terms in the model whose URIs do not have a valid scheme (i.e., registered by IANA). |
private static boolean |
hasDeclaredType(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource resource,
com.hp.hpl.jena.rdf.model.Resource type)
Checks whether a resource has a certain declared (rdf:type) type. |
static boolean |
hasKnownScheme(java.lang.String uriString)
Checks whether the URI has a known scheme (i.e., registered by IANA). |
private static java.net.HttpURLConnection |
httpConn(java.net.URL url)
Creates a new HTTP connection for the given URL. |
private static java.net.HttpURLConnection |
httpConn(java.net.URLConnection conn)
Casts the given connection to an HTTP connection |
private static java.net.HttpURLConnection |
httpConn(java.net.URL url,
java.net.HttpURLConnection conn,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> props)
Creates a new HTTP connection for the given URL and copies the settings from the given connection and request properties. |
static com.clarkparsia.utils.web.Response |
invoke(java.net.URI invocationURI)
Convenience method to invoke(URI invocationURI, InputStream graphContentsStream)
to execute a HTTP GET. |
static com.clarkparsia.utils.web.Response |
invoke(java.net.URI invocationURI,
byte[] graphContentsArray)
Convenience method to invoke(URI invocationURI, InputStream graphContentsStream)
to execute a HTTP POST with array data as the body of the POST. |
static com.clarkparsia.utils.web.Response |
invoke(java.net.URI invocationURI,
java.io.InputStream graphContentsStream)
Invokes HTTP GET or POST to URL. |
static com.clarkparsia.utils.web.Response |
invoke(java.net.URI invocationURI,
java.io.InputStream graphContentsStream,
boolean returnOnHTTPError)
Invokes HTTP GET or POST to URL. |
static com.clarkparsia.utils.web.Response |
invoke(java.net.URI invocationURI,
java.io.InputStream graphContentsStream,
boolean returnOnHTTPError,
long timeout)
Invokes HTTP GET or POST to URL. |
static boolean |
isBNodeURI(java.lang.String bnodeURI)
|
static boolean |
isSchemeKnown(java.lang.String scheme)
Checks whether the scheme is a known URI scheme (i.e., registered by IANA) |
static java.lang.String |
normalizeURI(java.lang.String uriStr)
Trims the #fragment identifier from a URI string to allow subsequent matching on the URI string minus any fragment identifier. |
static com.hp.hpl.jena.rdf.model.Model |
partitionModel(com.hp.hpl.jena.rdf.model.Model originalModel,
java.lang.String uri,
boolean followAllResources)
Extracts from the original Jena Model facts that relate only to the specified individual. |
private static java.util.Set<java.lang.String> |
readKnownURISchemes()
|
static void |
removeBNodes(com.hp.hpl.jena.rdf.model.Model model)
Removes BNodes from a model by converting them into a resource with a URI (which belongs to a reserved namespace). |
private static void |
removeBNodes(com.hp.hpl.jena.rdf.model.Model model,
java.util.Iterator<? extends com.hp.hpl.jena.rdf.model.RDFNode> it)
Removes BNodes from a Node iterator by converting them into a resource with a URI (which belongs to a reserved namespace). |
static void |
serializeModel(com.hp.hpl.jena.rdf.model.Model model,
java.io.OutputStream os,
RDFRepresentation rdfRepresentation,
boolean commentedOutput)
Serializes a Jena model into the output stream in the specified RDF representation. |
private static boolean |
shouldRemainAnon(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Resource resource)
Checks whether a resource should remain anonymous. |
static void |
validateSSWAPVocabulary(com.hp.hpl.jena.rdf.model.Model model)
Validates whether all resources in SSWAP namespace used in the model are defined in SSWAP ontology. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String SSWAP_PROTOCOL_COMMENTS_STYLESHEET
private static final java.lang.String KNOWN_URI_SCHEMES_FILE
private static java.util.Set<java.lang.String> KNOWN_URI_SCHEMES
private static final int COMMENTED_OUTPUT_INDENT
public static final java.lang.String BNODE_NS
private static int MAX_REDIRECTS
private static final com.hp.hpl.jena.rdf.model.Resource[] SSWAP_NODE_TYPES
private static final com.hp.hpl.jena.rdf.model.Resource[] PRETTY_TYPES
Constructor Detail |
---|
public ModelUtils()
Method Detail |
---|
public static void serializeModel(com.hp.hpl.jena.rdf.model.Model model, java.io.OutputStream os, RDFRepresentation rdfRepresentation, boolean commentedOutput)
model
- the Jena model to be serializedos
- the output stream to which the model should be serializedrdfRepresentation
- the RDF representation in which the model should be serializedcommentedOutput
- true, if the RDF/XML output should be commented, false otherwise (this flag is ignored for outputs
other than RDF/XML, and should only be used for protocol graphs).private static void commentRdfXmlProtocolGraph(java.io.InputStream is, java.io.OutputStream os) throws javax.xml.transform.TransformerException, java.io.IOException
is
- the input stream from which the data for commenting is read.os
- the output stream to which the commented data is written
javax.xml.transform.TransformerException
- if an exception occurs during the XSLT transformation
java.io.IOException
- if an I/O error should occurprivate static java.io.InputStream getSSWAPProtocolCommentsXsltStream() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- if the underlying XSL data cannot be foundprivate static java.io.InputStream getKnownURISchemesStream() throws java.io.FileNotFoundException
java.io.FileNotFoundException
private static java.util.Set<java.lang.String> readKnownURISchemes() throws java.io.IOException
java.io.IOException
public static boolean isSchemeKnown(java.lang.String scheme)
scheme
- the scheme to be checked
public static boolean hasKnownScheme(java.lang.String uriString)
uriString
- string containing a URI
public static java.util.Collection<java.lang.String> getTermsWithoutValidScheme(com.hp.hpl.jena.rdf.model.Model model)
model
- Jena model that should be checked for terms without a valid scheme
public static void removeBNodes(com.hp.hpl.jena.rdf.model.Model model)
model
- the model from which all bnodes should be removedpublic static void convertSSWAPNodesToBNodes(com.hp.hpl.jena.rdf.model.Model model)
model
- the model whose SSWAP nodes should be converted to BNodesprivate static void convertToBNodes(java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> resources)
resources
- the resources to be convertedprivate static java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> getResourcesByType(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource typeResource)
model
- the model where the resources aretypeResource
- the resource describing the type
private static void removeBNodes(com.hp.hpl.jena.rdf.model.Model model, java.util.Iterator<? extends com.hp.hpl.jena.rdf.model.RDFNode> it)
model
- the model from which all bnodes should be removedit
- the iteratorprivate static boolean shouldRemainAnon(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource resource)
model
- the model to which the resource belongsresource
- the resource to be checked
private static boolean hasDeclaredType(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource resource, com.hp.hpl.jena.rdf.model.Resource type)
model
- model to which the resource belongsresource
- the resource to be checkedtype
- the type to which the resource should belong
private static com.hp.hpl.jena.rdf.model.Resource convertBNode(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource resource)
model
- the model to which this resource belongsresource
- the bnode resource
java.lang.IllegalArgumentException
- if the resource is not a bnode resourceprivate static java.lang.String convertBNodeId(java.lang.String anonId)
anonId
- anonymous node (blank node) id
public static java.lang.String generateBNodeId()
public static boolean isBNodeURI(java.lang.String bnodeURI)
private static com.hp.hpl.jena.rdf.model.Model createOutputModel(com.hp.hpl.jena.rdf.model.Model model)
model
- the source model for the new model
private static void forEachResource(com.hp.hpl.jena.rdf.model.Model model, com.google.common.base.Function<com.hp.hpl.jena.rdf.model.Resource,java.lang.Void> function)
model
- the model that contains the resourcesfunction
- the function that should be appliedpublic static com.hp.hpl.jena.rdf.model.RDFNode getFirstObjectValue(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate)
model
- the model from which the value should be extractedsubject
- the subject for which the value should be extractedpredicate
- the predicate for which the value should be extracted
public static com.hp.hpl.jena.rdf.model.Statement getFirstStatement(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property predicate)
model
- model that should contain the statementsubject
- the subject of the requested statementpredicate
- the predicate for the statement
public static java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> getListURIs(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource listMember)
model
- model where the resource is locatedlistMember
- a (potential) member of some lists (not an internal node within a list!)
private static com.hp.hpl.jena.rdf.model.Resource getListHead(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource listNode)
model
- model where the node is locatedlistNode
- the list node for the list
public static com.hp.hpl.jena.rdf.model.RDFList createRDFList(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource listResource) throws java.lang.IllegalArgumentException
model
- the model containing the data describing the listlistResource
- the resource containing the head of the list
java.lang.IllegalArgumentException
- if the underlying data does not form a well-formed listpublic static java.util.Collection<com.hp.hpl.jena.rdf.model.Statement> getAllStatementsForList(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource listResource)
model
- the model with the Jena StatementslistResource
- the first resource of the list
public static java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> getAllResourcesForList(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource listResource)
model
- the model containing the list datalistResource
- the resource that is the head of the list
public static com.hp.hpl.jena.rdf.model.Model partitionModel(com.hp.hpl.jena.rdf.model.Model originalModel, java.lang.String uri, boolean followAllResources)
originalModel
- the model containing all the factsuri
- the URI of the individual
private static void addStatementsToPartitionedModel(com.hp.hpl.jena.rdf.model.Resource resource, com.hp.hpl.jena.rdf.model.Model originalModel, com.hp.hpl.jena.rdf.model.Model partitionedModel, java.util.Collection<com.hp.hpl.jena.rdf.model.Resource> alreadyAdded, boolean followAllResources)
resource
- the resource for which statements should be copied.originalModel
- the original model that contains all the statementspartitionedModel
- the partitioned model being createdalreadyAdded
- a collection of the resources that were already processed (to speed up the process, in case some resources are referenced
multiple times).private static void addTypeStatements(com.hp.hpl.jena.rdf.model.Resource resource, com.hp.hpl.jena.rdf.model.Model originalModel, com.hp.hpl.jena.rdf.model.Model partitionedModel)
private static void addImportStatements(com.hp.hpl.jena.rdf.model.Model originalModel, com.hp.hpl.jena.rdf.model.Model partitionedModel)
originalModel
- the model from which the import statements should be copiedpartitionedModel
- the model to which the import statements should be copiedpublic static org.semanticweb.owlapi.model.OWLOntology createOWLOntology(org.semanticweb.owlapi.model.OWLOntologyManager manager, java.lang.String url, com.hp.hpl.jena.rdf.model.Model model) throws org.semanticweb.owlapi.model.OWLOntologyCreationException
org.semanticweb.owlapi.model.OWLOntologyCreationException
public static org.semanticweb.owlapi.model.OWLOntology createOWLOntology(org.semanticweb.owlapi.model.OWLOntologyManager manager, java.lang.String url, com.hp.hpl.jena.rdf.model.Model baseModel, com.hp.hpl.jena.rdf.model.Model closure) throws org.semanticweb.owlapi.model.OWLOntologyCreationException
org.semanticweb.owlapi.model.OWLOntologyCreationException
private static void convertToOWLOntology(org.semanticweb.owlapi.model.OWLOntology ontology, com.hp.hpl.jena.rdf.model.Model... models) throws org.semanticweb.owlapi.model.OWLOntologyCreationException
org.semanticweb.owlapi.model.OWLOntologyCreationException
private static java.lang.String convert(com.hp.hpl.jena.rdf.model.RDFNode node)
public static java.util.Collection<java.lang.String> getResourcesInNS(com.hp.hpl.jena.rdf.model.Model model, java.lang.String ns)
model
- the model whose resources are to be returnedns
- the namespace URI
public static void validateSSWAPVocabulary(com.hp.hpl.jena.rdf.model.Model model) throws ValidationException
model
- the model to be validated
ValidationException
- if the model contains a resource from SSWAP namespace that is not defined in SSWAP ontology.public static com.clarkparsia.utils.web.Response invoke(java.net.URI invocationURI) throws java.io.IOException
invoke(URI invocationURI, InputStream graphContentsStream)
to execute a HTTP GET.
invocationURI
- URI to invoke (upon successful conversion of URI to a URL)
java.io.IOException
- on any failure to execute call, including HTTP response
codes of 400- or 500- seriesinvoke(URI,InputStream,boolean)
public static com.clarkparsia.utils.web.Response invoke(java.net.URI invocationURI, byte[] graphContentsArray) throws java.io.IOException
invoke(URI invocationURI, InputStream graphContentsStream)
to execute a HTTP POST with array data as the body of the POST.
invocationURI
- URI to invoke (upon successful conversion of URI to a URL)graphContentsArray
- contents of a HTTP POST; set to null to invoke HTTP GET
java.io.IOException
- on any failure to execute call, including HTTP response
codes of 400- or 500- seriesinvoke(URI,InputStream,boolean)
public static com.clarkparsia.utils.web.Response invoke(java.net.URI invocationURI, java.io.InputStream graphContentsStream) throws java.io.IOException
getContent
on the
returned response.
invocationURI
- URI to invoke (upon successful conversion of URI to a URL)graphContentsStream
- contents of a HTTP POST; set to null to invoke HTTP GET
java.io.IOException
- on any failure to execute call, including HTTP response
codes of 400- or 500- seriesinvoke(URI,InputStream,boolean)
public static com.clarkparsia.utils.web.Response invoke(java.net.URI invocationURI, java.io.InputStream graphContentsStream, boolean returnOnHTTPError) throws java.io.IOException
getContent
on the
returned response.
invocationURI
- URI to invoke (upon successful conversion of URI to a URL)graphContentsStream
- contents of a HTTP POST; set to null to invoke HTTP GETreturnOnHTTPError
- if true, HTTP error response codes (e.g., 400-
or 500- series will not result in a thrown exception; returned
response object may be examined
java.io.IOException
- on any failure to execute callpublic static com.clarkparsia.utils.web.Response invoke(java.net.URI invocationURI, java.io.InputStream graphContentsStream, boolean returnOnHTTPError, long timeout) throws java.io.IOException
getContent
on the
returned response.
invocationURI
- URI to invoke (upon successful conversion of URI to a URL)graphContentsStream
- contents of a HTTP POST; set to null to invoke HTTP GETreturnOnHTTPError
- if true, HTTP error response codes (e.g., 400-
or 500- series will not result in a thrown exception; returned
response object may be examinedtimeout
- connect and read timeout in milliseconds
java.io.IOException
- on any failure to execute callprivate static java.net.HttpURLConnection httpConn(java.net.URLConnection conn) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the given connection is not an HTTP connectionprivate static java.net.HttpURLConnection httpConn(java.net.URL url) throws java.io.IOException
java.io.IOException
private static java.net.HttpURLConnection httpConn(java.net.URL url, java.net.HttpURLConnection conn, java.util.Map<java.lang.String,java.util.List<java.lang.String>> props) throws java.io.IOException
java.io.IOException
public static com.clarkparsia.utils.web.Response executeRequest(java.net.URLConnection requestConn) throws java.io.IOException
requestConn
-
java.io.IOException
- if an exception occurs or the HTTP response code indicates an errorpublic static com.clarkparsia.utils.web.Response executeRequest(java.net.URLConnection requestConn, java.io.InputStream requestBody) throws java.io.IOException
requestConn
- URL connectionrequestBody
- input to the request
java.io.IOException
- if an exception occurs or the HTTP response code indicates an errorprivate static int connect(java.net.HttpURLConnection httpConn, byte[] inputBytes) throws java.io.IOException
java.io.IOException
private static com.clarkparsia.utils.web.Response executeRequest(java.net.URLConnection requestConn, java.io.InputStream requestBody, boolean returnOnHTTPError) throws java.io.IOException
requestConn
- URL connectionrequestBody
- input to the requestreturnOnHTTPError
- if false an exception is thrown if the response code indicates an error
java.io.IOException
- if an exception occurs or the HTTP response code indicates an error and returnOnHTTPError is falseprivate static int getInvocationTimeout()
public static java.lang.String normalizeURI(java.lang.String uriStr)
Note: experience shows that query strings (part of the URI following a '?') are often encountered, so future modifications to this method should not ignore the query string, if any.
uriStr
- original full URI string (w/ fragment identifier, if any)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |