SAFROLE YUTANI

Ranch Hand
+ Follow
since Jul 06, 2001
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 SAFROLE YUTANI

I know this is a Sun exam, and they would probably like to see the use of entity beans to represent Customer and Flight, but in reality, entity beans, especially read/write EJB's, are not a good idea for a production environment; they are simply too heavy in weight in nature. I know because I implemented them at my company. We thought that by using read-only and non-transactional entity beans we would increase the response time, but we observed a considerable decrease in performance instead, so we decided against them.

Did anyone NOT use entity beans and pass part II? This would be a good indicator as to how anal the examiners at Sun can be! Tee-hee! :-D

SAF

Originally posted by Roger Chang:
Dear all,

Does anyone know how to control transaction propagation from EJB to
a legacy System with web interface, say perl, cgi.... since I dont
want to replicate business logic that has been written in the existing
system?

Using HTTPConnection does not address the transaction propagation problem..
..... get stuck!!!

Thanks

Regards



I'm assuming that you are trying to devise a method for booking a flight within the COBOL mainframe and including the mileage update to the Oracle database in the same transaction. The mileage database has a CGI/Perl web server for accessing the database from a "read only" context. The documentation does not mention that travel agens use the web-based system to update the mileage, it only says that it's used for getting the mileage. You can assume that travel agents don't use the web server for "updating" the Oracle database since that would be very prone to data integrity issues. What would happen if the agent books the flight then gets killed by a stray bullet immediately after.

If you want to include the mileage update in the "Pay for Itinerary" use case, then create a DAO that uses JDBC to access the Oracle database and call it from the EJB method that books and pays for the flight.

The documentation does not mention exactly how the mileage database gets updated based on new flight bookings, so you can assume that it is updated with some type of out-of-process procedure (cron-job, who know's), and you cannot reuse that procedure.
[ June 11, 2004: Message edited by: SAFROLE YUTANI ]

Originally posted by Java Chela:
I think purpose is not to rewrite the fuctionalities provided by frequent flyer mileage system, but to reuse it. Whatever technology we use, we will be getting html as response. For indivudal users it is okay, but for travel agents, the client is a Java (Swing) client. How do we show the html in Java client? Are we gonna parse html code or write/use some peice of code that displays html in a Java(Swing) Client.

Am I missing something?

Thanks.
Chela



The FFMS is basically a web server running CGI/Perl, so it must be accessed from a HTTP/TCP-IP context, which means that you can only receive HTML data back from the web server. Knowing that, you have no choice but to parse the HTML and extract the customers mileage data. Once you have the data, you can return a object that nicely contains the mileage info, which then can be used in a JSP (for the customer client) or a Swing application (for the Travel Agent).

The entire process of accessing the FFMS web server should be performed via a Stateless EJB. That will make it easy for both types of clients to access the FFMS data.

Customer Web Client
-------------------
Web Browser -> Servlet -> Business Delegate -> SSB -> DAO -> HttpConnection -> CGI/Perl FFMS Web Server

Travel Agen Client (Swing App)
------------------------------
Swing Client -> Business Delegate -> SSB -> DAO -> HttpConnection -> CGI/Perl FFMS Web Server

Of course, when the response comes back from the HttpConnection, the DAO must be aware to parse out the mileage data, then return an object containing the data.
If I create a scrollable result set like this....
Statement st = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = statement.executeQuery("Select * from products");
rs.setFectchSize( 50);
Lets say that there are 10,000 rows that match the query criteria, I only want to fetch, say, 50 rows at a time. Clearly, I don't want the first fetch to get all the 10,000 rows because I am storing the result set in the session.
I tried that, and here's what happened (strange)...
In my program, I set the message text with something like...
message.setText("Hello \0x0A World!");
...and after the message is sent and displayed on my phone, it reads...
Hello

The "World" part is missing. Strange. Any ideas?
Tahanks
15 years ago
I'm using JavaMail to send an SMS message to my ATT phone. The message is consumed by the phone sucessfully, but I can't seem to generate a new line in the message. I've used \n, \r, but nothing seems to work. I even tried (char)13, which is the ASCII code for \n, I think!
15 years ago
I am writing a program that logs into a web site. On the first request, and after successful login, the server sends the following cookie header to my program...
Set-Cookie TaiChiChuan=kashmir=784b3d6d-bda5-4a89-996f-e0532acda531&tomorrow=30&timeoutofmind=3/30/2004 7:18:35 PM&semperfi=3/30/2004 7:48:35 PM; path=/
I extract the cookie from the response and resend the cookie to the server on the next request. For some strange reason, the server sends a response back to me indicating that my broswer does not support cookies. Should I set 1 cookie or multiple cookies for each name/value pair between the "&" delimiter from the initial set-cookie value above?
For example, is this correct? (1 cookie value)
Cookie TaiChiChuan=kashmir=784b3d6d-bda5-4a89-996f-e0532acda531&tomorrow=30&timeoutofmind=3/30/2004 7:18:35 PM&semperfi=3/30/2004 7:48:35 PM
...or is this the correct method? (multiple cookie values)
Cookie TaiChiChuan=kashmir=784b3d6d-bda5-4a89-996f-e0532acda531
Cookie tomorrow=30
Cookie timeoutofmind=3/30/2004 7:18:35 PM
Cookie semperfi=3/30/2004 7:48:35 PM
Thanks
[ March 30, 2004: Message edited by: SAFROLE YUTANI ]
15 years ago
Hi William,
I downloaded the HttpClient toolkit from Jakarta and installed it. I ran my test using a sample program from the Jakarta site and I still get the same response as I did when I submitted the request from my own custom program. I still get the HTML screen indicating that cookies are not enabled on the first request. Weird.
Which type of CookiePolicy do you use? I tried them all.
Thanks
15 years ago
You are a little lazy, but I will stil help...
Read these basics on MVC...
http://java.sun.com/blueprints/patterns/MVC-detailed.html
Here's an article...
http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html
Also read J2EE Blueprints at the Java site.
Hope it helps!
SAF
15 years ago
Try this..
http://forum.java.sun.com/thread.jsp?thread=65667&forum=33&message=165938
Serach for "Runtime.exec() Servlets" on Google, that will also be useful.
SAF
15 years ago
I have a simple program that submits a POST request to a web site. The page being accessed is a LogIn page. I have configured the request from my program to set all the request parameters and HTTP headers that would be set if the user was using a regular browser in order to fool the web site into thinking the request originated from a browser. When the request is made, the web site responds with content which, after dumping to a flat file, produces a page which instucts the user that their browser must be set to accept cookies.
I can't understand how the web site determined that I did not have cookies enabled. From the servers perspective, you need at least 1 1/2 rounds trip requests in order to determine if the browser has cookies enabled. In the first reponse, the web site will send a "Set-Cookie" header containing a sessions id which instructs the browser to resend this header for all subsequest requests. But in my case, I never see the "Set-Cookie" header, not even in the first response. I'm definitely looking for it, but I never see it.
The server must have a method for determining if cookies are enabled or not, even before the first response if committed, but there must be a way to fool the server.
15 years ago
Is there any method or API that allows sending a plain text message (not an email) to a cell phone?
I was able to configure Apache and Tomcat together on Windows 2000 so that Apache would server static content and forward all other requests to Tomcat. I did not use Tomcat from JBoss, I used Tomcat standalone instead, but nevertheless, these instructions might help you...
One quick note, I dont think jk2 works with Apache 1.x versions. You can check the documentation at the Apache site to be 100%, but I'm almost positive I remember reading something to that effect.
Configuration on Apache 2.0.43
------------------------------
1)You need to place module "mod_jk-2.0.43.dll" in the Apache2043\modules directory.
2)Make sure you have the following line in Apache\conf\httpd.conf (this should be the last line in the Dynamic Shared Object (DSO) section of the file)
LoadModule jk_module modules/mod_jk-2.0.43.dll
3)Make sure you have the file "workers.properties" in Apache2043\conf, and also make sure you have the following lines specified in the file (these are the properties that Apache uses to forward requests to Tomcat. Use your own custom settings for the port and host)
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
Configuration on Tomcat 4.1.27
------------------------------
1)Make sure that you have the following Connector specified in Tomcat4.1.27\conf\server.xml
<Connector
className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009"
minProcessors="5"
maxProcessors="75"
enableLookups="true"
redirectPort="8443"
acceptCount="10"
debug="0"
connectionTimeout="20000"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
2) My version of Tomcat4.1.27\conf\jk2.properties is empty and contains nothing but comments, so I don't think any configuration is required.
That should be it. Make sure the value for "port" in the Connector from step 1) is equal to the "worker.ajp13.port" in step 3).
If you run into ClassNotFoundExceptions thrown by Tomcat complaining about "org.apache.jk.server.JkCoyoteHandler", then you will most likely need to get the latest JARs from the Tomcat site (the file is called tomcat-jk2.jar)
Hope that helps,
15 years ago