Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suppor for CURIEs #70

Merged
merged 4 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions source/Hyperspace-Extensions/ZnClient.extension.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : #ZnClient }
Extension { #name : 'ZnClient' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> logLevel [

^ logLevel
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> query [
"Execute an HTTP QUERY the request set up and return the response #contents."

Expand All @@ -17,32 +17,32 @@ ZnClient >> query [
]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> resetRequest [

request := ZnRequest empty.
response := nil
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> setAccept: object [

request setAccept: object
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> setIfMatchTo: etag [

request setIfMatchTo: etag
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> setIfNoneMatchTo: etag [

request setIfNoneMatchTo: etag
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnClient >> setLogLevelAtLeastTo: integer [

self logLevel: (integer max: logLevel)
Expand Down
4 changes: 2 additions & 2 deletions source/Hyperspace-Extensions/ZnEntity.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ZnEntity }
Extension { #name : 'ZnEntity' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnEntity class >> with: anObject ofType: aMimeType [

| entity |
Expand Down
10 changes: 5 additions & 5 deletions source/Hyperspace-Extensions/ZnMimeType.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ZnMimeType }
Extension { #name : 'ZnMimeType' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnMimeType >> accepts: aMimeType [

^ (aMimeType main = '*' or: [ aMimeType main = self main ]) and: [
Expand All @@ -9,19 +9,19 @@ ZnMimeType >> accepts: aMimeType [
($+ split: self sub) includes: aMimeType sub ] ] ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnMimeType >> asMediaType [

^ self
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnMimeType >> quality [

^ Float readFrom: (self parameterAt: 'q' ifAbsent: [ ^1.0 ])
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnMimeType >> version: aVersionString [

self parameters at: 'version' put: aVersionString
Expand Down
18 changes: 9 additions & 9 deletions source/Hyperspace-Extensions/ZnRequest.extension.st
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
Extension { #name : #ZnRequest }
Extension { #name : 'ZnRequest' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest >> acceptLanguage [

^ self headers at: 'Accept-Language'
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest >> hasLanguageProrityList [

^ self headers includesKey: 'Accept-Language'
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest class >> query: urlObject [

^ self supportQUERYDuring: [ self method: #QUERY url: urlObject ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest >> readFrom: stream [

^ self class supportQUERYDuring: [ super readFrom: stream ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest >> setAcceptLanguage: acceptLanguageDirectives [

self headers at: 'Accept-Language' put: acceptLanguageDirectives asString
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest >> setIfMatchTo: etag [

self headers at: 'If-Match' put: etag asString
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest >> setIfNoneMatchTo: etag [

self headers at: 'If-None-Match' put: etag asString
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnRequest class >> supportQUERYDuring: aBlock [

^ aBlock
Expand Down
26 changes: 13 additions & 13 deletions source/Hyperspace-Extensions/ZnResponse.extension.st
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
Extension { #name : #ZnResponse }
Extension { #name : 'ZnResponse' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> addCachingDirective: aDirective [

self headers at: 'Cache-Control' add: aDirective
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> addContentLanguage: aLanguageTag [

self headers at: 'Content-Language' add: aLanguageTag
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> addLink: aLink [

self headers at: 'Link' add: aLink
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> addToVary: headerName [

self headers at: 'Vary' add: headerName
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> cachingDirectives [

| directives |
Expand All @@ -35,7 +35,7 @@ ZnResponse >> cachingDirectives [
ifFalse: [ Array with: directives ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> contentLanguageTags [

| headerValue |
Expand All @@ -46,19 +46,19 @@ ZnResponse >> contentLanguageTags [
ifFalse: [ Array with: headerValue asLanguageTag ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> entityTag [

^ (self headers at: 'ETag') asEntityTag
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> hasLocation [

^ self headers includesKey: 'Location'
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> links [

| headerValue |
Expand All @@ -69,13 +69,13 @@ ZnResponse >> links [
ifFalse: [ Array with: headerValue asWebLink ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> setEntityTag: aStringOrEntityTag [

self headers at: 'ETag' put: aStringOrEntityTag asEntityTag asString
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> varyHeaderNames [

| headerValue |
Expand All @@ -86,7 +86,7 @@ ZnResponse >> varyHeaderNames [
ifFalse: [ Array with: headerValue ]
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnResponse >> withEntityTagDo: foundBlock ifAbsent: absentBlock [

self headers at: 'ETag' ifPresent: [ :headerValue | ^ foundBlock cull: headerValue asEntityTag ].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : #ZnSingleThreadedServer }
Extension { #name : 'ZnSingleThreadedServer' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnSingleThreadedServer >> logLevel [

^ logLevel
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnSingleThreadedServer >> setLogLevelAtLeastTo: integer [

self logLevel: (integer max: logLevel)
Expand Down
24 changes: 18 additions & 6 deletions source/Hyperspace-Extensions/ZnUrl.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ZnUrl }
Extension { #name : 'ZnUrl' }

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnUrl >> asAbsoluteUrl [

AssertionChecker
Expand All @@ -11,7 +11,7 @@ ZnUrl >> asAbsoluteUrl [
^ self
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnUrl >> asHostedAt: aBaseUrl [

^ self copy
Expand All @@ -21,13 +21,19 @@ ZnUrl >> asHostedAt: aBaseUrl [
yourself
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnUrl >> asWebLink [

^ WebLink to: self
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnUrl >> expandToURIIn: context [

^ self
]

{ #category : '*Hyperspace-Extensions' }
ZnUrl >> queryAt: aKey putUrl: anUnencodedUrl [

| encodedUrl |
Expand All @@ -36,10 +42,16 @@ ZnUrl >> queryAt: aKey putUrl: anUnencodedUrl [
^ self queryAt: aKey put: encodedUrl
]

{ #category : #'*Hyperspace-Extensions' }
{ #category : '*Hyperspace-Extensions' }
ZnUrl >> start: startIndex limit: limitCount [

self
queryAt: 'start' put: startIndex;
queryAt: 'limit' put: limitCount
]

{ #category : '*Hyperspace-Extensions' }
ZnUrl >> withFragment: string [

^ self copy fragment: string
]
2 changes: 1 addition & 1 deletion source/Hyperspace-Extensions/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'Hyperspace-Extensions' }
Package { #name : 'Hyperspace-Extensions' }
Loading