Using a new approch for Object>>asResponse using #respondOn: and #displayOn: instead of #printOn: by Stefan Schmiedl
This commit is contained in:
parent
97efb27d2d
commit
e18b2a262c
|
@ -77,8 +77,8 @@ IliadObject subclass: Action [
|
|||
^self block cull: self value
|
||||
]
|
||||
|
||||
asResponse [
|
||||
<category: 'request handling'>
|
||||
^self value asResponse
|
||||
respondOn: aResponse [
|
||||
<category: 'converting'>
|
||||
^self value displayOn: aResponse
|
||||
]
|
||||
]
|
||||
|
|
|
@ -286,11 +286,11 @@ the application mode:
|
|||
^[:e | ]
|
||||
]
|
||||
|
||||
asResponse [
|
||||
<category: 'responding'>
|
||||
respondOn: aResponse [
|
||||
<category: 'converting'>
|
||||
self build.
|
||||
self updatePage.
|
||||
^self page asResponse
|
||||
self page respondOn: aResponse
|
||||
]
|
||||
|
||||
defaultPageClass [
|
||||
|
|
|
@ -89,9 +89,9 @@ My subclasses must override the #build method, which should return an instance o
|
|||
self application redirectToLocal: aString
|
||||
]
|
||||
|
||||
asResponse [
|
||||
<category: 'responding'>
|
||||
^self build asResponse
|
||||
respondOn: aResponse [
|
||||
<category: 'converting'>
|
||||
self build respondOn: aResponse
|
||||
]
|
||||
]
|
||||
|
||||
|
|
|
@ -39,18 +39,14 @@ Object extend [
|
|||
|
||||
asResponse [
|
||||
<category: 'converting'>
|
||||
^Iliad.Response ok
|
||||
nextPutAll: self printString;
|
||||
yourself
|
||||
| response |
|
||||
response := Iliad.Response ok.
|
||||
self respondOn: response.
|
||||
^response
|
||||
]
|
||||
]
|
||||
|
||||
String extend [
|
||||
|
||||
asResponse [
|
||||
respondOn: aResponse [
|
||||
<category: 'converting'>
|
||||
^Iliad.Response ok
|
||||
nextPutAll: self;
|
||||
yourself
|
||||
self displayOn: aResponse
|
||||
]
|
||||
]
|
||||
|
|
|
@ -177,15 +177,9 @@ I know how to print myself in HTML format with the #printHtmlOn: method'>
|
|||
^(AttributeNotUnderstood element: self attribute: aString) signal
|
||||
]
|
||||
|
||||
asResponse [
|
||||
<category: 'request handling'>
|
||||
| str |
|
||||
str := WriteStream on: ''.
|
||||
self printHtmlOn: str.
|
||||
children := OrderedCollection new.
|
||||
^Response ok
|
||||
contentType: self contentType;
|
||||
nextPutAll: str contents;
|
||||
yourself
|
||||
respondOn: aResponse [
|
||||
<category: 'converting'>
|
||||
self printHtmlOn: aResponse.
|
||||
aResponse contentType: self contentType
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue