Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!

Rajan Punchouty

Greenhorn
+ Follow
since Mar 15, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajan Punchouty

both of the method u have written of request object return String or Principal. HttpRequest object is specific to Http protocol. To get more information about user etc u need to use JNDI.
Just a quick follow up.... rather a doubt...
How does Log4J work with EJB's then???
Hi Guys,
Please clarify this...

Session Bean psudo code

//this method has attribute = REQUIRED
public void method1(){
//statement 1 update some record
method2();
//statement 2
}

//this method has attribute = REQUIRED NEW
public void method2(){
//statement 3 update some other record
//exception is thrown
//statement 4
}

does statement 1,2,3,4 will happen in same transaction context OR 1,2 in different context and 3,4 in different context IF I CALL method1 FROM REMOTE INTERFACE

Thanx in Advance
Thanks for your reply.... but A quick follow up....
I think reason that you have given is TRUE FOR ANY IMMUTABLE OBJECT... I was just wondering why java have not provided String implementation one like that of say ArrayList ( or any other collection class as matter of fact )... where it is mutable by deafult... but utiltiy methods ( in Collections class ) provide me thread safe and immutable implementation of that object.

Pardon me for my wiered analogy... but i realy want to get into the fact....

[ August 05, 2004: Message edited by: Rajan Punchouty ]
[ August 05, 2004: Message edited by: Rajan Punchouty ]
16 years ago
Can some one tell me why string are immutable?
There is link http://www.acooke.org/andrew/immutable.html explaining it but i want to know answer from multithreading perspective.
Can some one explain this comparing it with StringBuffer.
Thanks
16 years ago
Hi,
I need my applet to interact with struts. More precisely i need to exchange serializable objects between applet and struts. Can some one tell me how to handle this in Action class. I tried two options.
1. first i returned null in execute method of Action class after reading from input stream and after writing to output stream. I am successful in reading object from applet. But inside applet i am unable to read the object.In Applet i m getting EmptyInputStream and there for EOF exception

<b>Action Class Code</b>

response.setContentType("application/x-java-serialized-object");
ObjectInputStream ojbin = new ObjectInputStream(request.getInputStream());
Integer i = (Integer)ojbin.readObject();
_log.info("+++++++++++++++++++++++++++++++++= " + i); ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
out.writeObject(new Date());
return null;

<b>Applet Class code<b>
URL url = new URL("http://localhost:8080/inTest.do");

HttpMessage msg = new HttpMessage(url);
msg.setCookie(SESSION_ID, sessionId);
InputStream in = msg.sendPostMessage(new Integer(1117));
ObjectInputStream result = new ObjectInputStream(in);
Object obj = result.readObject();
Date date = (Date)obj;
message.setText(date.toString());

<b>HttpMesssage Helper Class </b>
public InputStream sendPostMessage(Serializable obj) throws IOException {
URLConnection con = servlet.openConnection();

// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);

// Turn off caching
con.setUseCaches(false);

// Set the content type to be application/x-java-serialized-object
con.setRequestProperty("Content-Type",
"application/x-java-serialized-object");

// Send headers
sendHeaders(con);

// Write the serialized object as post data
ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
out.writeObject(obj);
InputStream in = con.getInputStream();
out.flush();
out.close();
return in;
}

2. Someone told me instead returning null from Action class, forward to some other servlet. And move all functionality from Action to servlet.

3. But then i tried calling this servlet from applet directly. And as it was simple applet servlet communication it worked without any problem.

CAN SOME ONE TELL ME WHAT I AM MISSING. IN CASE OF EXECUTING SERVLET VIA STRUTS FRAMEWORK, I AM GETTING EMPTY INPUT STREAM BUT IN CASE OF EXECUTING DIRECTLY I DONT HAVE ANY PROBLEM.

Thanx in Advance.
-Rajan
16 years ago
Just a quick look into it.. i think there is a spelling mistake... in Application Resources it is errors.username with extra... "s"
16 years ago
The problem is with tag nesting. If u have nested tags, then deeply nested tag should process first and then the sorrounding tags. In your case just use this line WITHOUT any use bean tags.
<html:text property="txtEmployerFname" name="contactDetails" value="employerFname" />
It will work.....
16 years ago
Your resource file is not in class path. Put your resource file in WEB-INF/classes and in struts-config.xml specify its name.
If you have put your file in some package inside WEB-INF/classes e.g. WEB-INF/classes/some/package give the fully qualified name in struts-config.xml e.g. some.package.MyResources.properties
16 years ago
My Application need to reload application resources. Can anybody tell me how to acheieve it???
Thanx in advance
17 years ago
Got it myself.
Add the Context tag in jboss-service.xml in deploy\jbossweb-tomcat41.sar\META-INF.
<Host name="localhost">
<!-- Access logger -->
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="localhost_access" suffix=".log"
pattern="common" directory="${jboss.server.home.dir}/log"/>
<!-- This valve clears any caller identity set by the realm
and provides access to the realm about the existence of an
authenticated caller to allow a web app to run with a realm
that support unauthenticated identities. It also establishes
any run-as principal for the servlet being accessed.
-->
<Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
<Context path="/images" docBase="C:/blue/images" debug="0"/>
</Host>
17 years ago
Hi,
I need to define a context that point to some folder on hard disk. In tomcat i can define it as
<Context path="/images" docBase="C:\\upload" debug="0"/>
How to achieve same thing in JBoss-tomcat installation.
Thanx in Advance.
17 years ago
Can u provide small code fragment... which text box are u talking about??
17 years ago
Hi,
I have upload directory for images on my hard disk. I want to access them in HTML image tag. how to access them with respect to application context. As example C:/upload has images and i put my war file in C:/tomcat/webapps.
Thanx in advance,
Rajan
17 years ago
Can you give sample data... It will be easy to understand your problem that way
17 years ago
JSP