|
Class: URL
Object
|
+--URL
- Package:
- stx:libhtml
- Category:
- Net-Communication-Support
- Version:
- rev:
1.69
date: 2017/02/22 18:08:57
- user: cg
- file: URL.st directory: libhtml
- module: stx stc-classLibrary: libhtml
- Author:
- Claus Gittinger
(for now) only a holder for the parse URL info.
Will takeover more functionality in the near future.
Please Notice:
this class is more or less obsoleted by URI, which provides better support
for multiple transports, passwords etc.
However, a lot of old code still uses URL, and also Squeak has an URL as well.
So this remains here, although this has a slight duplicate-code odeur.
Please use URI if possible.
URI
FtpURI
HttpURI
FileURI
Compatibility-Squeak
-
schemeNameForString: urlString
-
self schemeNameForString:'https://www.cacert.org'
instance creation
-
classForScheme: schemeString
-
-
fromString: aString
-
check fragment and search part
usage example(s):
URL fromString: 'http://www'.
URL fromString: 'http://www/dir/file.html'.
URL fromString: 'http://www:10080/dir/file.html'.
URL fromString: 'http://www:10080/dir/file.html?x=100'.
URL fromString: 'http://www:10080/dir/file.html#section'.
URL fromString: 'ftp://ftp/pub/smalltalk'.
URL fromString: 'ftp://ftp:21/pub/smalltalk'.
URL fromString: 'ftp://user@ftp:21/pub/smalltalk'.
URL fromString: 'ftp://user@ftp/pub/smalltalk'.
URL fromString: 'ftp://user:passwd@ftp:21/pub/smalltalk'.
URL fromString: 'news:fj.lang.smalltalk'.
URL fromString: '/dir/file.html'.
URL fromString: 'file.html'.
URL fromString: 'file://D:\foo\bar\baz'.
|
-
fromURLString: aStringIn
-
hack for MSDOS-type files, with a volume
usage example(s):
self oldFromURLString:'checkout.stt'.
self fromURLString:'checkout.stt'.
|
-
method: methodString host: hostString port: portNumber path: pathString
-
-
method: methodString path: pathString
-
-
new
-
-
scheme: schemeString host: hostString port: portNumber path: pathString
-
-
scheme: schemeString path: pathString
-
self scheme:'http' path:'foo/bar/baz'
self scheme:'http' host:'www.exept.de' port:80 path:'foo/bar/baz'
self fromString:'http://www.exept.de/foo/bar/baz&foo=1&bar=2'
utilities
-
constructPath: path1 with: path2
-
trim path tail (file name).
Compatibility-Squeak
-
authority
-
-
fullPath
-
-
retrieveContents
-
squeak compatibility
-
retrieveContentsAccept: mimeType
-
squeak compatibility
-
retrieveContentsArgs: args
-
squeak compatibility
-
retrieveContentsArgs: args accept: mimeType
-
squeak compatibility
** This method raises an error - it must be redefined in concrete classes **
-
withoutFragment
-
what does it do ?
accessing
-
anchor
-
return the anchor in the fragment part;
that is the name of the local anchor within the document.
May be nil or empty
-
anchor: aString
-
set the anchor in the fragment part;
that is the name of the local anchor within the document.
May be nil or empty
-
file
-
return the file/path part.
Same as path for compatibility
-
file: aString
-
set the file/path part.
Same as path: for compatibility
-
fragmentPart
-
-
fragmentPart: aString
-
-
host
-
return the host
-
host: aString
-
set the host
-
method
-
return the access scheme (http, https, ftp, etc.).
Same as scheme for compatibility
-
method: aString
-
set the access scheme (http, https, ftp, etc.).
Same as scheme: for compatibility
-
otherPart
-
-
path
-
return the file/path part.
Same as file for compatibility
-
path: aString
-
set the file/path part.
Same as file: for compatibility
-
port
-
return the port; may be nil
-
port: anInteger
-
set the port; may be nil
-
rest
-
return the value of the instance variable 'rest' (automatically generated)
-
rest: aString
-
set the value of the instance variable 'rest' (automatically generated)
-
scheme
-
return the access scheme (http, https, ftp, etc.).
Same as method for compatibility
-
scheme: aString
-
set the access scheme (http, https, ftp, etc.).
Same as method: for compatibility
comparing
-
= anURL
-
-
copyWithoutFragmentPart
-
-
copyWithoutOtherPart
-
-
hash
-
-
postCopy
-
super postCopy.
conversion
-
asURL
-
return an URL-object from myself - that's me.
usage example(s):
'http://www.exept.de:80/index.html' asURL host
'http://www.exept.de:80/index.html' asURL port
'http://www.exept.de:80/index.html' asURL method
'http://www.exept.de:80/index.html' asURL path
|
parsing
-
parseFromString: urlString
-
parse URL contained in a string and set my inst vars
printing & storing
-
displayOn: aGCOrStream
-
return a string to display the receiver - for display in Inspector
-
printOn: aStream
-
take care, used by #fullRequestString and #urlPrintString
-
urlPrintString
-
the printString of the full url (incl. method, host and port)
private
-
clearFragmentPart
-
-
clearOtherPart
-
-
flag
-
-
hasFragmentPartBitMask
-
-
hasPostDataBitMask
-
-
hasSearchPartBitMask
-
-
initialize
-
-
setOtherPart: aString flag: anInteger
-
queries
-
canCache
-
-
fullRequestString
-
-
hasFragmentPart
-
-
hasFragmentPart: aBoolean
-
aBoolean
usage example(s):
self new hasFragmentPart
(self new hasFragmentPart:true) hasFragmentPart
|
-
hasPostData
-
-
hasPostData: aBoolean
-
aBoolean
-
hasSearchPart
-
-
hasSearchPart: aBoolean
-
aBoolean
-
isFileScheme
-
-
isFragmentOnly
-
-
isHostRelativePath
-
-
isRelativePath
-
-
isValidMethod: aMethod
-
mhmh - is this a good idea (isn't it the task of a url-user to decide, which
methods it supports).
The URL does not really know...
-
newsGroup
-
If the receiver is an nntp url, return the news group; otherwise, return nil.
-
postData
-
-
postData: aString
-
-
requestString
-
everything but the host & scheme (i.e. path+options alone, as in an HTTP requests header line)
-
searchPart
-
-
searchPart: aString
-
testing
-
isURL
-
(comment from inherited method)
Return true if the receiver is a url.
Note: Do not override in any class except URL.
utilities
-
/ aString
-
filename compatibility protocol:
A a new instance with aString concatenated to my path.
We simply append aString to the end of the path.
Look at construct for a more enhanced
usage example(s):
'http://www.exept.de/start' asURL / 'bla'
'http://www.exept.de/start/' asURL / 'bla'
'http://www.exept.de' asURL / 'bla'
|
-
construct: anUrlOrString
-
filename compatibility protocol:
return a URL with a path which is the concatenation
of my path and anUrlOrString.
If anUrlOrString is a URL and has another method or host than the receiver,
it is returned plain.
Also, if anUrlOrString is either an URL representing an absolute path.
I.e. this method can be used to compute an html document's anchor's target URL
usage example(s):
(URL fromString: 'http://www/dir/file.html') construct: (URL fromString: 'subdir/image.gif').
(URL fromString: 'http://www/dir1/file.html') construct: (URL fromString: '/dir2/image.gif').
(URL fromString: 'http://www/dir1/file.html') construct: (URL fromString: '~kyasu/').
(URL fromString: 'http://www/dir/file.html') construct: (URL fromString: '#introduction').
(URL fromString: 'http://www/dir/file.html') construct: (URL fromString: '/cgi-bin/perl.pl&dest=/other').
(URL fromString: 'http://www/dir/file.html') construct: (URL fromString: 'http:/cgi-bin/perl.pl&dest=/other').
(URL fromString: 'http://www-s2.rsl.crl.fujixerox.co.jp/~kyasu/') construct: (URL fromString: 'http://arrow').
(URL fromString: 'gopher://www.com') construct: (URL fromString: '//www.com:70/ParcBenchMain').
(URL fromString: 'http://www/some.html') construct: (URL fromString: 'http://www/').
(URL fromString: '../tmp/table.html') construct: (URL fromString: 'kyasu.gif').
|
-
directory
-
filename compatibility protocol:
return a URL which represents the receiver's directoy
usage example(s):
'http://www.exept.de:8080/foo/bar/baz.txt' asURL directory
'file:///foo/bar/baz.txt' asURL directory
|
-
pathBasename
-
answer the baseName of my path as a string.
eg. for '/part1/part2/part3.suffix' this is 'part3.suffix'
usage example(s):
'http://www.exept.de:8080/foo/bar/baz.txt' asURL pathBasename
'file:///foo/bar/baz.txt' asURL pathBasename
|
-
pathSuffix
-
answer the suffix of my path as a string.
eg. for '/part1/part2/part3.suffix' this is 'suffix'
usage example(s):
'http://www.exept.de:8080/foo/bar/baz.txt' asURL pathSuffix
'file:///foo/bar/baz.txt' asURL pathSuffix
|
-
pathWithoutSuffix
-
answer the baseName of my path as a string.
eg. for 'http://host/part1/part2/part3.suffix' this is '/part1/part2/part3'
usage example(s):
'http://www.exept.de:8080/foo/bar/baz.txt' asURL pathWithoutSuffix
'file:///foo/bar/baz.txt' asURL pathWithoutSuffix
|
|