SSE4E GPError GPSystem ByteString ByteBuffer TLV TLVList Card Atr Key Crypto Application GPApplication GPSecDomain ASN1 CardFile IsoSecureChannel ApplFactory GPXML JsScript CardSim X509 CRL KeyStore CMSSignedData CMSGenerator XMLSignature OCSPQuery LDAP SOAP URLConnection PKCS11Provider PKCS11Session PKCS11Object OutlineNode OpenSCDP |
URLConnection - Reference Documentation
Class implementing an URL connection to a resource. This class can be used to put, get, post or delete local and remote resources (CRUD operations). Index of MethodsProperties
ConstructorPrototypeURLConnection(String url) DescriptionCreate a connection object to access a resource identified by the URL.Arguments
Exceptions
Examplevar cwd = GPSystem.mapFilename("urltest.dat", GPSystem.CWD); var urlConnection = new URLConnection("file:" + cwd); get()PrototypeString get() DescriptionRead from the resource the full content as string. Return
Exceptions
Examplevar page = urlConnection.get(); assert(page.equals("Hello World\n")); post()PrototypeString post(String str) DescriptionWrite the text to the resource and receive response. Arguments
Return
Exceptions
Examplevar url = "http://localhost:8081/scriptingservlet/"; var urlConnection = new URLConnection(url + "admin?restart"); var page = urlConnection.get(); print("GET:\n" + page); print(urlConnection.responseCode + " - " + urlConnection.responseMessage); print("ContentEncoding : " + urlConnection.contentEncoding); print("ContentLength : " + urlConnection.contentLength); print("ContentType : " + urlConnection.contentType); print("Date : " + urlConnection.date); print("Expiration : " + urlConnection.expiration); print("Last Modified : " + urlConnection.lastModified); assert(urlConnection.responseCode == 200); var urlConnection = new URLConnection(url + "admin"); var script = "GPSystem.trace(\"Hello World\");\n"; var result = urlConnection.post(script); print("POST:\n" + result); var result = urlConnection.post(script); print("POST:\n" + result); var urlConnection = new URLConnection(url + "admin"); var page = urlConnection.get(); print("GET:\n" + page); put()PrototypeString put(String str) DescriptionWrite the text to the resource and receive response. Arguments
Return
Exceptions
Examplevar url = "http://localhost:8081/scriptingservlet/"; var urlConnection = new URLConnection(url + "admin?restart"); var page = urlConnection.get(); print("GET:\n" + page); var urlConnection = new URLConnection(url + "admin"); var script = "GPSystem.trace(\"Hello World\");\n"; var result = urlConnection.put(script); print("PUT:\n" + result); var result = urlConnection.put(script); print("PUT:\n" + result); var urlConnection = new URLConnection(url + "admin"); var page = urlConnection.get(); print("GET:\n" + page); deleteResource()Prototypevoid deleteResource() DescriptionDelete the resource. The delete operation only works for connections using HTTP. The method is not named "delete" because delete is a reserved name in the Rhino JavaScript implementation. Return
Exceptions
Examplevar url = "http://localhost:8081/scriptingservlet/"; var urlConnection = new URLConnection(url + "admin"); urlConnection.deleteResource(); © Copyright 2003 - 2010 CardContact Software & System Consulting, Minden, Germany |