• 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: appendToResponse
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: appendToResponse


  • Subject: Re: appendToResponse
  • From: Atli Páll Hafsteinsson <email@hidden>
  • Date: Mon, 02 Feb 2009 14:19:45 +0000
  • Thread-topic: appendToResponse

Already tryed that with the same result .. Or no results ;)

if( (((Session)session()).user() == null) && !(currentPage instanceof
Login))
 {
            Login loginPage = pageWithName( Login.class );


response.setContent( loginPage.generateResponse().content() );
        }
        else {

            super.appendToResponse( response, context );

        }


On 2/2/09 2:10 PM, "Dennis Cruel" <email@hidden> wrote:

> Hi Atli,
>
> instead of calling super.appendToResponse( r, context );
> overwrite the current content of the response with the content of the
> loginPage:
> response.setContent(r.content());
>
> Regards,
> Dennis
>
> Atli Páll Hafsteinsson schrieb:
>> Woha ...! That code block is unreadably formatted (I blame entourage and the
>> cold weather), lets try again:
>>
>>    public void appendToResponse( WOResponse response, WOContext context ) {
>>         logger.debug( "Entering appendToResponse in ApplicationLook" );
>>          WOComponent currentPage = context.page();
>>          if( (((Session)session()).user() == null) && !(currentPage
>> instanceof Login) ) {
>>             logger.debug( "Not logged in, showing login page" );
>>             Login loginPage = pageWithName( Login.class );
>>             WOResponse r = loginPage.generateResponse();
>>             System.out.println( r.contentString() );
>>             super.appendToResponse( r, context );
>>         }
>>         else {
>>             super.appendToResponse( response, context );
>>         }
>>     }
>>
>>
>>
>> On 2/2/09 12:38 PM, "Atli Páll Hafsteinsson" <email@hidden> wrote:
>>
>>> Hi guys
>>>
>>> In my attempt to make a user signin mechanism I override appendToResponse in
>>> a
>>> component that wrappes every page in my app and check if the user is signed
>>> in
>>> and if not try to display the content of my login page (the login page is
>>> not
>>> wrapped), code:
>>>
>>>     public void appendToResponse( WOResponse response, WOContext context ) {
>>> logger.debug( "Entering appendToResponse in ApplicationLook" );
>>> WOComponent currentPage = context.page();         if(
>>> (((Session)session()).user() == null) && !(currentPage instanceof Login) ) {
>>> logger.debug( "Not logged in, showing login page" );            Login
>>> loginPage = pageWithName( Login.class );            WOResponse r =
>>> loginPage.generateResponse();             System.out.println(
>>> r.contentString() );            super.appendToResponse( r, context );
>>> }
>>> else {            super.appendToResponse( response, context );        }    }
>>>
>>> This does not work, r.contentString() indeed has the content of the login
>>> page
>>> but nothing is delivered to the browser, just an empty page.
>>>
>>> Any ideas??
>>>
>>> Regards,
>>> Atli
>>>
>>>
>>> Fyrirvari á tölvupósti / e-mail disclaimer
>>> http://us.is/Apps/WebObjects/US.woa/wa/dp?id=3776
>>>
>>>
>>>  _______________________________________________
>>> 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
>>
>>
>> Fyrirvari á tölvupósti / e-mail disclaimer
>> http://us.is/Apps/WebObjects/US.woa/wa/dp?id=3776
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> ck.de
>>
>> This email sent to email@hidden
>


Fyrirvari á tölvupósti / e-mail disclaimer
http://us.is/Apps/WebObjects/US.woa/wa/dp?id=3776


 _______________________________________________
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

References: 
 >Re: appendToResponse (From: Dennis Cruel <email@hidden>)

  • Prev by Date: Re: appendToResponse
  • Next by Date: Re: Handling Session timeout with ajax
  • Previous by thread: Re: appendToResponse
  • Next by thread: Re: appendToResponse
  • Index(es):
    • Date
    • Thread