Re: Setting the statuscode for the response in a directAction
Re: Setting the statuscode for the response in a directAction
- Subject: Re: Setting the statuscode for the response in a directAction
- From: Kaj Hejer <email@hidden>
- Date: Sun, 19 Dec 2004 22:32:58 +0100
Aha, even nicer! Thanks! :)
-Kaj :)
On 19. des 2004, at 22.28, Chuck Hill wrote:
You need to generate the response before you can do anything with it.
:-)
public WOActionResults invalidPageAction() {
WOComponent errorPage = pageWithName("MyInvalidPage");
WOResponse result = errorPage.generateResponse();
result.setStatus(WOMessage.HTTP_STATUS_NOT_FOUND);
return result;
}
Chuck
At 07:46 PM 19/12/2004 +0100, Kaj Hejer wrote:
Hi!
I have a directAction where I want to set the statuscode:
public WOActionResults invalidPageAction() {
WOComponent errorPage = pageWithName("MyInvalidPage");
System.out.println("context().response(): " +
context().response());
//
errorPage.context().response().setStatus(WOMessage.HTTP_STATUS_NOT_FOU
ND
); // gives a NPE
return errorPage;
}
The problem here is that context().response() and
errorPage.context().response() is null, so I don't have a
reponseobject
to set the statuscode on.
Ofcource I could do this in appendToResponse in MyInvalidPage, but it
would be nice to be able to set this in the directAction.
Any ideas?
TIA!
-Kaj :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
villag
e.net
This email sent to email@hidden
--
Chuck Hill email@hidden
Global Village Consulting Inc.
http://www.global-village.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden