Skip to main content

HTTP Servlet RA

18 replies [Last post]
abhayani
Offline
Joined: 2005-04-04
Points: 0

Hi Guys,

Here is the design page for HTTP Servlet RA for Mobicents
http://groups.google.com/group/mobicents-public/web/mobicents-http-servl...

Please provide your valuable feedback on design.

amit.bhayani

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
eduardomartins
Offline
Joined: 2005-10-10
Points: 0

Nice, I see you got convinced :-) What about you Ivelin?

ivelin
Offline
Joined: 2003-07-13
Points: 0

Irrelevant. It's Amit's game.

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

I'm not convinced, those not uncommon features as forward and redirects wouldn't be handled by an SBB, similar to B2BUA for SIP, which would be attached to 2 activities? If yes then it wouldn't matter if it's the same RA or not.

ivelin
Offline
Joined: 2003-07-13
Points: 0

> I'm not convinced, those not uncommon features as
> forward and redirects wouldn't be handled by an SBB,
> similar to B2BUA for SIP, which would be attached to
> 2 activities? If yes then it wouldn't matter if it's
> the same RA or not.

do not understand

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

I'm saying that those features does not need to be in the RA, it can be done in a SBB using the 2 RAs (servlet and client), just like a back 2 back sip user agent SBB does.

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

1) What is the problem to just use the servlet api? I don't see the need to use Apache's HttpClient for incoming requests!

3) Ivelin told me that the session creation is not an expensive operation, and I guess Http does not implies a low latency response, so why can't we always create a new one if it does not exist and just have one activity?

ivelin
Offline
Joined: 2003-07-13
Points: 0

> 1) What is the problem to just use the servlet api? I
> don't see the need to use Apache's HttpClient for
> incoming requests!

httpclient is for initiating requests from sbbs.

>
> 3) Ivelin told me that the session creation is not an
> expensive operation, and I guess Http does not
> implies a low latency response, so why can't we
> always create a new one if it does not exist and just
> have one activity?

this is an argument that made sense to me when we discussed it earlier.
For consistency though a design pattern similar to sip dialogs also makes sense.

abhayani
Offline
Joined: 2005-04-04
Points: 0

3) HttpSession creation will be for the purpose that SBB doesn't have to store the instance specific data as CMP but can store in HttpSession. This may not be required for all application's.

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

An application does not need to use every functionality of the activity. In SIP, because Dialogs affects message headers and performance I see the need to not have always a dialog activity, also a dialog can't be just server side resource. Here I don't really see the need for those 2 activities, it will just add complexity to the RA . You will loose a little performance on creating a session if does not exist, but everywhere else you will have better performance because you don't need to deal with 2 types of activities.

PS: My last attempt to convince you guys ;-)

abhayani
Offline
Joined: 2005-04-04
Points: 0

Eduardo,

Don't give up man at the end of the tunnel there is light ;0)

Eduardo and I had a big discussion on how Http Servlet RA should shape up. I am adding the main points here

1) Http Servlet RA should only take care of incoming HttpRequest and for out going HttpRequest we should have one more RA HttpClient RA which is based on Apache commons-httpclient.

2) Why two RA's?
Because both of them have completely different functionality. Http Servlet RA is a Server side component which only accepts the incoming request and sends response to it just like Web Server hosting HttpServlet never creates new Requests.

While HttpClient RA can be a full blown implementation of HttpCLient and which is responsible for creating the HttpRequest, receive response in Sync or Async way like a true Client side component.

3) What we loose in having two RA's?
Most of the applications using Http Servlet RA will use Http Client RA. Both of them will have different api's and hence developer will need to understand both.

4) What we gain?
A clear implementation of RA's having different responsibilities. Since both RA are using different STACK it is useful to have different RA implemetation's.

One more point that we discussed was in Http Servlet RA instead of having IncomingHttpServletRequestActivity for every incomng Request and whose life is only till Response is sent, we should have HttpSession as activity. RA is responsible to create the HttpSession for incoming request even though Session is not present initially as creating HttpSession is not a costly process. HttpSession Activity will end if SBB calls inValidate() explicitly or HttpSession times out.

To achieve this http-servlet-ra.war will register HttpSessionListener and the class implemnting HttpSessionListener will emit EndHttpSessionActivity event using RA.

What do you guys think?

amit.bhayani

ivelin
Offline
Joined: 2003-07-13
Points: 0

this is unfair. you two have a time zone proximity advantage. I can't compete this way :)

abhayani
Offline
Joined: 2005-04-04
Points: 0

And thats why we have forums ;)

abhayani
Offline
Joined: 2005-04-04
Points: 0

Hi Guys,

The final version of http-servlet-ra is released
To know more about http-servlet-ra look at link
http://groups.google.com/group/mobicents-public/web/mobicents-http-servl...

A very simple example using http-servlet-ra is ready, to check out follow the link
https://mobicents-examples.dev.java.net/source/browse/mobicents-examples...

amit.bhayani

eduardomartins
Offline
Joined: 2005-10-10
Points: 0

Stepping in, as a fully interested user of this RA:

1) IMHO we should have 2 RAs, one for HttpServlet and one for HttpClient. The integration of both in one RA will just complicate.

2) There is already a HttpClient RA, the XCAP Client RA, which uses that HttpClient from Apache inside OpenXDM Client API and it's sync and async. I can provide that RA in a few hours (but it's not on my priorities). Just one question, is there any need right now for a Http Client RA?

3) I refactored the Http Servlet RA in the whole RA set refactoring for common scripts and dir structure, it seemed good. The only thing is the Activity object, should we create new Http Session on incoming requests, if it does not exists, and use it as the activity, or should we support 2 activities, Http Session and Http Servlet Request.

4) We should discuss this on the forums, the google page has not the same visibility and a update or reply takes hours to show, last night I couldn't see the page, just the comments.

abhayani
Offline
Joined: 2005-04-04
Points: 0

1) In http-servlet-ra HttpClient will be used as one of the libraries to facilitate the creation of HttpServletRequest and HttpServletResponse. Its just the mediator to have smooth integration of Servlet and Slee Service. If both of them are different RA's than there is very high probability that one using http-servlet-ra will always have to use RA for HttpClient while other way may not be true. What is the use case of HttpClient RA?

3) The new design is not creating the HttpSession for every incoming Request instead the Activity (IncomingHttpServletRequestActivity) is created for every new Request and Activity ends as soon as the Response is sent like true stateless HTTP protocol. So the idea is to support two activities (in fact three activities and the third one is for Request created and sent by service) HttpServletRequest and HttpSession separately. We need to come-up with idea on how to implement the activity for HttpSession? The design on google pages currently doesn't cover that.

4) Agree

2) I will look at HttpClient usage within XCAP

ivelin
Offline
Joined: 2003-07-13
Points: 0

> 1) In http-servlet-ra HttpClient will be used as one
> of the libraries to facilitate the creation of
> HttpServletRequest and HttpServletResponse. Its just
> the mediator to have smooth integration of Servlet
> and Slee Service. If both of them are different RA's
> than there is very high probability that one using
> http-servlet-ra will always have to use RA for
> HttpClient while other way may not be true. What is
> the use case of HttpClient RA?

I agree. Most protocols are I/O. It is expected to see two directional protocol transport in one RA. Furthermore its not uncommon to use features as forward or redirect (as in http servlet dispatcher), which cross the server/client border.

>We need to come-up with idea
> on how to implement the activity for HttpSession? The
> design on google pages currently doesn't cover that.

we can use design pattern similar to sip ra 1.2 for dialog. An SBB receiving request event, asks for session activity and attaches to it.

abhayani
Offline
Joined: 2005-04-04
Points: 0

>we can use design pattern similar to sip ra 1.2 for dialog. An SBB receiving request event, asks for session activity and attaches to it.

Yes. Also for SBB that creates the Request using HttpServletRaSbbInterface should be able to initiate the Session explicitly (idea derived from SIP Servlet)

ivelin
Offline
Joined: 2003-07-13
Points: 0

great. feedback posted as comments on the page itself.