Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old November 14th, 2001, 06:53 AM
petern21 petern21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 petern21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Application -> Servlet Communication

Hello!!

Can anybody help me with this? I have an aplication running on a Solaris 7 server (www.sol1.comm). This application needs to send a Vector to a Servlet on another server (www.sol2.comm). I want to use HTTP. Is there somone out ther who has a code example for this?

Best reguards!

Reply With Quote
  #2  
Old November 14th, 2001, 04:42 PM
ACShafer ACShafer is offline
Not A Jedi Yet
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Salt Lake City
Posts: 8 ACShafer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to ACShafer
Is the application set up to make http requests? Do you understand how http works? Why do you want to use http? (firewall, etc?)

What is the "vector" exactly? Is it a Java Vector?

How are you going to send it in http?

Reply With Quote
  #3  
Old November 15th, 2001, 01:39 AM
petern21 petern21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 petern21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The only way to reach this machine is by HTTP.
Now I know that you can't send Objects over HTTP but variables.
I just want som code examples on how you connect to a servlet with HTTP and then I can make it on my own.

Reply With Quote
  #4  
Old November 16th, 2001, 04:25 PM
ACShafer ACShafer is offline
Not A Jedi Yet
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Salt Lake City
Posts: 8 ACShafer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to ACShafer
http is stateless.

99% of any sample code you see about servlets is "connecting" with http.

What is your application trying to send? (I don't need specifics, just a general idea)

What is your app written in?

To making an http request basically boils down to sending text to a listening port, typically 80. (Tomcat defaults to listening on 8080)

If I have more info I can try to point you to a solution or at least in the right direction.

What exactly is the servlet supposed to do when it gets the info?

Reply With Quote
  #5  
Old November 17th, 2001, 02:14 AM
petern21 petern21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 petern21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My app is written in Java. I've got three variables (var1=dbname,var2=user,var3=password) that I want to send to a Servlet (Servlet1).

Servlet1 should (when reseiving the three varables) create a database in mysql.

Reply With Quote
  #6  
Old November 17th, 2001, 08:40 PM
sLiPkNoT rUlEz sLiPkNoT rUlEz is offline
PHP Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Ontario
Posts: 66 sLiPkNoT rUlEz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to sLiPkNoT rUlEz Send a message via AIM to sLiPkNoT rUlEz Send a message via Yahoo to sLiPkNoT rUlEz
It's as simple as making a client/server dialog. The client asks for the info via short, descriptive commands and the server sends the database info to the client.

It's almost kind of fun, it's so easy. Just don't forget to put your server socket and every socket it spawns into their own threads, otherwise you will end up with some thread issues and multi-connection problems.
__________________
Click here and wait. It's a kewl effect, trust me.

Reply With Quote
  #7  
Old November 19th, 2001, 05:49 AM
petern21 petern21 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 8 petern21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have solved my problem!! I did it like this by using com.oreilly.servlet.

Application :

public static void connectToServlet() {
try {

URL url = new URL("http://localhost:8080/servlet/Servlet");

HttpMessage msg = new HttpMessage(url);

Properties props = new Properties();

props.put("database", "Test_database");
props.put("user", "Test_user");
props.put("password", "Test_password");

msg.sendPostMessage(props);


DataInputStream result = new DataInputStream(new BufferedInputStream(in));


in.close();

}
catch (Exception e) {
e.printStackTrace();

}
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Application -> Servlet Communication


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway