Session in Services

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Session in Services

Deepa Priolkar
Hi All,

 

We are facing some issue related to the HTTP Session.

How can we access the HTTP Session in the Ofbiz Services.

 

Please let me know...

Thanks & Regards,

Deepa


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================
Reply | Threaded
Open this post in threaded view
|

Re: Session in Services

Rishi Solanki
Hi Deepa,

You can add the request and response objects as in parameters to service to
get them inside the service.
<attribute name="request" mode="IN"
type="javax.servlet.http.HttpServletRequest"/>
<attribute name="response" mode="IN"
type="javax.servlet.http.HttpServletResponse"/>

get the request object from the context in side the service and from request
object get the session.
But it is not good to directly define the request and response object as in
parameter for the service. You will be always able to get all the parameters
from request/session by defining them as in parameter for the service.

--
Rishi Solanki
Manager, Enterprise Software Development
HotWax Media Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxmedia.com


On Wed, Nov 17, 2010 at 4:50 PM, Deepa Priolkar <[hidden email]>wrote:

> Hi All,
>
>
>
> We are facing some issue related to the HTTP Session.
>
> How can we access the HTTP Session in the Ofbiz Services.
>
>
>
> Please let me know...
>
> Thanks & Regards,
>
> Deepa
>
>
> ============================================================================================================================Disclaimer:
>  This message and the information contained herein is proprietary and
> confidential and subject to the Tech Mahindra policy statement, you may
> review the policy at <a href="http://www.techmahindra.com/Disclaimer.html
> ">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="
> http://tim.techmahindra.com/Disclaimer.html">
> http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech
> Mahindra.============================================================================================================================
>
Reply | Threaded
Open this post in threaded view
|

Re: Session in Services

Adrian Crum
I agree with Rishi - the Session object should not be accessed in
services. Services should not "know" about the Session object. The
session attributes are copied to the service context, so there should be
no need to access the Session object directly.

-Adrian

On 11/17/2010 6:39 AM, Rishi Solanki wrote:

> Hi Deepa,
>
> You can add the request and response objects as in parameters to service to
> get them inside the service.
> <attribute name="request" mode="IN"
> type="javax.servlet.http.HttpServletRequest"/>
> <attribute name="response" mode="IN"
> type="javax.servlet.http.HttpServletResponse"/>
>
> get the request object from the context in side the service and from request
> object get the session.
> But it is not good to directly define the request and response object as in
> parameter for the service. You will be always able to get all the parameters
> from request/session by defining them as in parameter for the service.
>
> --
> Rishi Solanki
> Manager, Enterprise Software Development
> HotWax Media Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxmedia.com
>
>
> On Wed, Nov 17, 2010 at 4:50 PM, Deepa Priolkar<[hidden email]>wrote:
>
>> Hi All,
>>
>>
>>
>> We are facing some issue related to the HTTP Session.
>>
>> How can we access the HTTP Session in the Ofbiz Services.
>>
>>
>>
>> Please let me know...
>>
>> Thanks&  Regards,
>>
>> Deepa
>>
>>
>> ============================================================================================================================Disclaimer:
>>   This message and the information contained herein is proprietary and
>> confidential and subject to the Tech Mahindra policy statement, you may
>> review the policy at<a href="http://www.techmahindra.com/Disclaimer.html
>> ">http://www.techmahindra.com/Disclaimer.html</a>  externally and<a href="
>> http://tim.techmahindra.com/Disclaimer.html">
>> http://tim.techmahindra.com/Disclaimer.html</a>  internally within Tech
>> Mahindra.============================================================================================================================
>>
>