Hi Daniel,

Daniel, de la Cuesta Navarrete schrieb:
> Thank you,
> 
> Sorry for my late response, but I have a new idea.
> 
> My problem is  that I want to return a service ticket  in the POST response
> when a new resource is created. This service ticket can appear in a response
> header or in the response body.
> 
> I am agree with you, and I don't want to stop the node creation with my
> custom POST script.
> 
> Can I set up a filter that adds a new header to the http resonse and get
> this header in the final response to the client?

Yes, you can register a javax.servlet.Filter service which acts upon the
request. Or you might want to explore the SlingPostProcessor (though
this does not allow you to set a response header).

But in the SlingPostProcessor you can add a Modification to the list of
Modifications, which is then added as an entry in changelog of the response.

Hope this helps.

Regards
Felix

> 
> Any ideas?
> 
> Thank you.
> 
> 2009/4/3 Felix Meschberger <[email protected]>
> 
>> Hi Daniel,
>>
>> Posting to a resource with a trailing /* yields a StarResource of
>> default resource type "sling:syntheticStarResource". If you post to a
>> non-existing resource with a trailing slash / (which is recommended
>> here), a NonExistingResource with resource type "sling:nonexisting" is
>> assumed.
>>
>> So so the scripts would be looked up in
>> /apps/sling/syntheticStarResource in the first case or
>> /apps/sling/nonexisting in the second case.
>>
>> If you configure the path based resource type provider correctly (for
>> example to have requests to /content/blog/* to have a star resource of
>> type foo/bar) you may have your POST script in /apps/foo/bar.
>>
>> But unless you want to do something special to your newly created page,
>> I would suggest to not provide your own POST script and have the default
>> script handle the node creation.
>>
>> Hope this helps.
>>
>> Regards
>> Felix
>>
>>
>>
>> Daniel, de la Cuesta Navarrete schrieb:
>>> Hi,
>>>
>>> How can overwrite the http response when I create a new resurce?
>>>
>>> I mean,
>>>
>>> I have created a new resource with sling:resourceType=foo/bar.
>>> I have a POST.esp script in apps/foo/bar
>>>
>>> If a create a new resource the POST.esp is not resolved. It is only
>> resolved
>>> when I edit the resource
>>>
>>> What script is resolved when I create a new resource?
>>>
>>> For example when I do:
>>> curl -F"sling:resourceType=foo/bar" -F"title=Fuente 1" -F"file="
>>> -F"mimetype=" http://admin:ad...@localhost:8888/content/blog/*
>>>
>>> Thank you.
>>>
> 

Reply via email to