• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting the statuscode for the response in a directAction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the statuscode for the response in a directAction


  • Subject: Re: Setting the statuscode for the response in a directAction
  • From: Chuck Hill <email@hidden>
  • Date: Sun, 19 Dec 2004 13:28:39 -0800

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_FOUND
>); // 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:
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

  • Follow-Ups:
    • Re: Setting the statuscode for the response in a directAction
      • From: Kaj Hejer <email@hidden>
References: 
 >Setting the statuscode for the response in a directAction (From: Kaj Hejer <email@hidden>)

  • Prev by Date: Re: Apache 2 Adaptor on RHEL3...Again...
  • Next by Date: Re: Apache 2 Adaptor on RHEL3...Again...
  • Previous by thread: Setting the statuscode for the response in a directAction
  • Next by thread: Re: Setting the statuscode for the response in a directAction
  • Index(es):
    • Date
    • Thread