You Are Here:

Community: Developer Discussion Boards

#1 Old RE: "HttpURLConnection" do not work in pjava? - 1970-01-01, 02:00

Join Date: Mar 2003
Posts: 12
Location: Helsinki, Finland
teijap
Offline
Registered User
hi,
i have used "GET" and it works just fine with HttpURLConnection.
make URL from server address, then cast the url.openConnection() to HttpURLConnection, then use that.

Brs,
teija

#2 Old "HttpURLConnection" do not work in pjava? - 2002-12-16, 08:32

Join Date: Mar 2003
Posts: 4
yuychen
Offline
Registered User
I wish to make my pjava applicaton send data to servlet using
POST method. But when I compiled the applicaion, compiler said: "java.net.HttpURLConnection is abstract; cannot be instantiated". I wonder if I can use HttpURLConnection in Pjava app. If not, what other classes can I use to communicate with servlet.

Part of my program:

...
HttpURLConnection conn = null;
InputStream in = null;
OutputStream out = null;
String sentStr = "Request data to servlet";
String servletUrl = "http://127.0.0.1:8080/examples/servlet/MyServlet";
conn = new HttpURLConnection(servletUrl);
conn.setRequestMethod(POST);
out = conn.openOutputStream();
int requestLength = sentStr.length();
for (int i = 0; i < requestLength; ++i)
{
out.write(sentStr.charAt(i));
}
...

Thank a lot for any advises!

Brs,
Yuye Chen
  « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d5632X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZjavaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxjavaX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ