Life cycle of a request object

How to keep alive a request object in a Chain request process? Or how to keep alive an object through the application? and without the use of session or cookie…

Simply I want to keep it alive through my request.

I don’t understand what you mean.

What kind of data exactly do you want to keep alive?

What use cases do you have in mind?

Anyway I think there’s no way of doing it without the use of user session.

Why don’t you use CWebUser::setState() and CWebUser::getState()?

Actually i was searching for the similar thing that happens in java with “forward”. As we know using forward if we forward a request to another page then we will be able to get all the objects over there in the next page. So there remains a chain link in such requests. and in the next page to get these objects I don’t have to use session.

So basically is there any way we can do the same functionality over here. Because I have seen there is


but don’t know whether will it do the same functionality or not…

So if you can tell me how to get this kinda functionality in yii, it will be very helpful.

Thanks for the reply.

PHP is state-less.

Life-cyle of a request is a http request.

It’s that simple.

I see.

I’m sorry but I don’t have experience in Java. Maybe someone over there …

[EDIT] Oh, jacmoe has already answered.


I don’t think this would be such a hard feature to implement your self. I would start by understanding how Java does its forwarding of requests. Read up on Java Servlet 2.4 specification.

According to the Java Doc the following occurs:

[sup]1. Java EE 6 Javadoc for RequestDispatcher[/sup]

In simplest forms you would recreate the incoming request and send it to another relative resource.

Since I’m new to Yii of course I did not know this but this feature already exists. See the post

Thanks everyone for throwing some light on this topic. Thanks guys. :)