Dimiter Stoilov

+ Follow
since Aug 11, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dimiter Stoilov

Object obj = ctx.getEJBLocalObject();
MyComponent comp = (MyComponent)PortableRemoteObject.narrow(obj, MyComponent.class);

1. What will happen if I narrow the Local Component instead of casting it?

2. Is it allowed?

3. Are there going to be any Exceptions?

Thank you guys,

[ August 21, 2004: Message edited by: Dimiter Stoilov ]
Tahnx Sujatha ,

I will stick to [4].
Thank you guys,

I had this question in one of the Soft SCBCD Exams.

And answer i remember very well was 'Plain Java Cast'. But i rather belive in the Spec than those buggy simulators. :-) After all Handle is Remote. To be portable our Bean, we should narrow the handle.
Thanx Giju,
plain clear.
Hi Ranchers,

I've got:
ObjectInputStream is = ... ;
Handle handle = (Handle)is.readObject();
Object ejbObj = handle.getEJBObject();
TheComponent component = ... ???

Question is how to cast the 'ejbObj' to desired Component interface?
[1]. Using reqular Java Cast
component = (TheComponent)ejbObj;
[2]. Using PortableRemoteObject
component = (TheComponent)PortableRemoteObject.narrow(ejbObj, TheComponent.class);

And another question. Do i always have to use PortableRemoteObject to cast TheComponent Interface and when can i use "reqular Java Cast" for it?

Thanx for your time guys,
Thanx Marco,

For stateless MyBean Container calls :
1. newInstance
2. setSessioCtx
3. ejbCreate

So if i understood right, In point 3 even though there is no EJBObject yet, in MyBean.ejbCreate i can access MyComponent. Container will create one for me. In a container specific way.

Sound strange because i didn't read it anywhere ...
Hi ranchers

Following problem buzzs me,

Stateless Bean creation is different for container and client:

1. Container creation - newInstance >> setSessionContext >> ejbCreate
Bean stays in pool. It's associated with Home, but NO EJBObject(Component interface not created yet)

2. Client creation - create() >> new EJBObject

Bean things which we can do in ejbCreate are:
a. sessionContext .getEJBHome
b. sessionContext .getEJBObject
c. JNDI access to java:comp/env

My question is:
How is possible in ejbCreate to access EJBObject, when there is no Component created yet?
Bean is in pool, there should be one Home and no Component yet. EJBObject is created from client.

Thank you for your time
Hi ranchers,
I have a multipart form uploading file. I want to limit the file upload to say 5mb. Everithing is fine, But with large uploads, request parse the whole input until it show my error.page for the 5mb limitation.

I tried to stop the request parsing the whole file.
Tried by redefining the request it in ServletRequestWrapper, changing its getInputStream method, throwing exceptions, calling RequestDispatcher, but no successs. Request have to parse whole file, after that it shows me whatever i told him to do.

Can you answer me is this HTTP protocol requirement or any hacks to stop the request?

Thank you for you time
19 years ago