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

Change Zinc seaside adaptors to allow ZnZincSeasideAdaptor to also stream #1319

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public
safeToStream
"Will stream this response"

self url addField: '_f'
5 changes: 2 additions & 3 deletions repository/Seaside-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testing
hasQueryField: aString

^ (self queryFields includesKey: aString) or: [
self postFields includesKey: aString ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isSafeToStream

^ self hasQueryField: '_f'
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
writing
writeStatusOn: aStream
aStream nextPutAll: self httpVersion.
aStream
nextPut: $ ;
nextPutAll: self status greaseString.
self message isNil ifFalse: [
aStream
nextPut: $ ;
nextPutAll: self message ].
aStream crlf
writeStatusOn: aStream
"32 = ascii value for Character space"

aStream nextPutAll: self httpVersion.
aStream
space;
nextPutAll: self status greaseString.
self message isNil
ifFalse: [
aStream
space;
nextPutAll: self message ].
aStream crlf
19 changes: 9 additions & 10 deletions repository/Seaside-Core.package/WAResponse.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"commentStamp" : "pmm 2/18/2011 23:07",
"super" : "WAObject",
"category" : "Seaside-Core-HTTP",
"classinstvars" : [ ],
"pools" : [ ],
"classinstvars" : [
],
"classvars" : [
"StatusMessages"
],
"StatusMessages" ],
"commentStamp" : "pmm 2/18/2011 23:07",
"instvars" : [
"headers",
"cookies",
"status",
"message"
],
"message" ],
"name" : "WAResponse",
"type" : "normal"
}
"pools" : [
],
"super" : "WAObject",
"type" : "normal" }
2 changes: 0 additions & 2 deletions repository/Seaside-Core.package/monticello.meta/categories.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SystemOrganization addCategory: #'Seaside-Core'!
SystemOrganization addCategory: #'Seaside-Core-Backtracking'!
SystemOrganization addCategory: #'Seaside-Core-Base'!
SystemOrganization addCategory: #'Seaside-Core-Cache'!
Expand All @@ -10,7 +9,6 @@ SystemOrganization addCategory: #'Seaside-Core-Exceptions'!
SystemOrganization addCategory: #'Seaside-Core-Filter'!
SystemOrganization addCategory: #'Seaside-Core-HTTP'!
SystemOrganization addCategory: #'Seaside-Core-Libraries'!
SystemOrganization addCategory: #'Seaside-Core-Manifest'!
SystemOrganization addCategory: #'Seaside-Core-Rendering'!
SystemOrganization addCategory: #'Seaside-Core-RequestHandling'!
SystemOrganization addCategory: #'Seaside-Core-Server'!
Expand Down
5 changes: 2 additions & 3 deletions repository/Seaside-GemStone-Adaptors-Zinc.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
as yet unclassified
process: aNativeRequest

^GRPlatform current
seasideProcessRequest: aNativeRequest
adaptor: self
resultBlock: [:aRequest | super process: aRequest ]
aNativeRequest isSafeToStream
ifTrue: [ ^ self processStreamingRequest: aNativeRequest ]
ifFalse: [
^ GRPlatform current
seasideProcessRequest: aNativeRequest
adaptor: self
resultBlock: [ :aRequest | self processBufferedRequest: aRequest ] ]
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"commentStamp" : "",
"super" : "ZnZincServerAdaptor",
"category" : "Seaside-GemStone-Adaptors-Zinc",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "WAGsZincAdaptor",
"type" : "normal"
}
"pools" : [
],
"super" : "ZnZincServerAdaptor",
"type" : "normal" }
5 changes: 2 additions & 3 deletions repository/Seaside-Session.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
accessing
actionUrlForKey: aString
^ self url
addField: self actionField value: aString;
yourself
| url |
url := self url.
url addField: self actionField value: aString.
self requestContext request isSafeToStream
ifTrue: [ url addField: '_f' ].
^ url
19 changes: 10 additions & 9 deletions repository/Seaside-Session.package/WASession.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"commentStamp" : "pmm 2/18/2012 11:03",
"super" : "WARequestHandler",
"category" : "Seaside-Session-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "pmm 2/18/2012 11:03",
"instvars" : [
"continuations",
"properties",
"documentHandlers",
"key"
],
"key" ],
"name" : "WASession",
"type" : "normal"
}
"pools" : [
],
"super" : "WARequestHandler",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SystemOrganization addCategory: #'Seaside-Session'!
SystemOrganization addCategory: #'Seaside-Session-Base'!
SystemOrganization addCategory: #'Seaside-Session-Continuations'!
SystemOrganization addCategory: #'Seaside-Session-Filter'!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
rendering-steps
renderExamplesStepOn: html

html heading
level3;
with: 'Try out some examples'.

html
unorderedList: [
html listItem: [
html anchor
callback: [ self show: WAWelcomeExampleCounter new ];
with: 'Counter'.
html text: ', a simple Seaside component.' ].
html listItem: [
html anchor
callback: [ self show: WAWelcomeExampleMultiCounter new ];
with: 'Multi-Counter'.
html text: ', showing how Seaside components can be re-used.' ].
html listItem: [
html anchor
callback: [ self show: WAWelcomeExampleFlow new ];
with: 'Task'.
html text: ', illustrating Seaside''s innovative approach to application control flow.' ] ]

html unorderedList: [
html listItem: [
html anchor
safeToStream;
navigation;
callback: [ self show: WAWelcomeExampleCounter new ];
with: 'Counter'.
html text: ', a simple Seaside component.' ].
html listItem: [
html anchor
safeToStream ;
callback: [ self show: WAWelcomeExampleMultiCounter new ];
with: 'Multi-Counter'.
html text: ', showing how Seaside components can be re-used.' ].
html listItem: [
html anchor
callback: [ self show: WAWelcomeExampleFlow new ];
with: 'Task'.
html text:
', illustrating Seaside''s innovative approach to application control flow.' ] ]
5 changes: 2 additions & 3 deletions repository/Zinc-Seaside.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Zinc-Seaside
crlf
self nextPut: 13; nextPut: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Zinc-Seaside
space
self nextPut: 32
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "ZdcAbstractSocketStream" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
writing
isStreamingResponse
^ true
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"commentStamp" : "<historical>",
"super" : "ZnResponse",
"category" : "Zinc-Seaside",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
"onWrite"
],
"onWrite" ],
"name" : "ZnDeferredResponse",
"type" : "normal"
}
"pools" : [
],
"super" : "ZnResponse",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Zinc-Seaside
hasQueryField: aString
^self uri hasQueryField: aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Zinc-Seaside
isSafeToStream
^self hasQueryField:'_f'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Zinc-Seaside
nativeRequest
^self
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "ZnRequest" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Zinc-Seaside
isStreamingResponse
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "ZnResponse" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
isSafeToStream
^true
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
nativeRequest: anObject

nativeRequest := anObject
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
nativeRequest

^ nativeRequest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*Zinc-Seaside
hasQueryField: aString

self queryAt: aString ifAbsent: [ ^ false ].
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "ZnUrl"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
converting
bufferedResponseFor: aZnRequest

^ super responseFor: aZnRequest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
converting
bufferedResponseFrom: aRequestContext
| partialHeaders cookies fullHeaders seasideResponse contents entity contentType |
seasideResponse := aRequestContext response.
partialHeaders := seasideResponse headers.
cookies := seasideResponse cookies.
fullHeaders := ZnHeaders defaultResponseHeaders.
partialHeaders keysAndValuesDo: [ :key :value |
fullHeaders at: key add: value greaseString ].
cookies do: [ :each |
fullHeaders at: 'Set-Cookie' add: each rfc6265String ].
contentType := seasideResponse contentType greaseString.
contents := seasideResponse contents.
entity := (ZnEntity bytes: contents) contentType: contentType; yourself.
^ ZnResponse new
statusLine: (ZnStatusLine code: seasideResponse status);
headers: fullHeaders;
entity: entity;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
processing
process: aZnRequest
^ aZnRequest isSafeToStream
ifTrue: [ self processStreamingRequest: aZnRequest ]
ifFalse: [ self processBufferedRequest: aZnRequest ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
processing
processBufferedRequest: aZnRequest
^ super process: aZnRequest
Loading