Newbii Plz help me

Reply

Join Date: Jan 2009
Posts: 15
Reputation: shirish_kal has a little shameless behaviour in the past 
Solved Threads: 0
shirish_kal shirish_kal is offline Offline
Newbie Poster

Newbii Plz help me

 
0
  #1
Jan 10th, 2009
Hi ,
I am a new to java and am stuck with coupe of lines i wonder if any of you ppl could help me i wud be gr8full...
URL localURL = new URL("http://www.xyz.com");
URLConnection localURLConnection = localURL.openConnection();
String str2 = localURLConnection.getHeaderField("string1");
What wud these lines actually do or to be more precise wt wud i receive in str2 is there a way to see wt the string wud be.

Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,188
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 482
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Newbii Plz help me

 
0
  #2
Jan 10th, 2009
You could already answered your question if you checked API
URLConnection.getHeaderField(String name)

getHeaderField

public String getHeaderField(String name)

Returns the value of the named header field.

If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.

Parameters:
name - the name of a header field.
Returns:
the value of the named header field, or null if there is no such field in the header.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 15
Reputation: shirish_kal has a little shameless behaviour in the past 
Solved Threads: 0
shirish_kal shirish_kal is offline Offline
Newbie Poster

Re: Newbii Plz help me

 
0
  #3
Jan 10th, 2009
Ok still not clear am confused anyway... is their a way i could see wt it returns without actually having to write any java ... i mean something from the src coad or something
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 15
Reputation: shirish_kal has a little shameless behaviour in the past 
Solved Threads: 0
shirish_kal shirish_kal is offline Offline
Newbie Poster

Re: Newbii Plz help me

 
0
  #4
Jan 10th, 2009
Ok still not clear am confused anyway... is their a way i could see wt it returns without actually having to write any java ... i mean something from the source code of page having the applet or something and wt is the value is it like an integer number or a string of characters.

Thanx for the reply
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Newbii Plz help me

 
0
  #5
Jan 10th, 2009
You need to know at least something about the HTTP protocol before understanding that piece of code.

But what comes to my mind is why do you want to know what that piece of code does, are you involved in plagiarism .... trying to use someone else's code and showing it off as you own, because for a person trying out something new the question is always on the lines of "How do I do this ..", where as yours is the opposite "What does this do ..." ?????
Last edited by stephen84s; Jan 10th, 2009 at 6:28 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 15
Reputation: shirish_kal has a little shameless behaviour in the past 
Solved Threads: 0
shirish_kal shirish_kal is offline Offline
Newbie Poster

Re: Newbii Plz help me

 
-1
  #6
Jan 10th, 2009
well no am not into any plagiarism or anything ...its just that there is this challange in a website i had to solve it and the thing is i understood almost all of the code other than these cpl of lines ...I guess i will have to go thru HTTP but still any suggestion as to what am i supposed to look at. It wud be gr8 help....AND BELIEVE ME AM DOING NOTHIN LIKE PLAGIARISM ....thanx FOR THE REPLY

AND YA THANKS FOR ADDING A NEW WORD IN MY VOCABULARY REALLY DINT KNEW PLAGIARISM
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Newbii Plz help me

 
0
  #7
Jan 10th, 2009
Well what you are looking for is a quick fix, an explanation of a couple of lines which will solve all your problems ... May be the following line will do :-

The couple of lines of code you have pointed, get the value of the HTTP Header "string1" set by the server when you invoke the default page of "http://www.xyz.com".

Now if you do not understand that I suggest you begin to read more about HTTP, cause there are no short cuts when you are gathering knowledge.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 15
Reputation: shirish_kal has a little shameless behaviour in the past 
Solved Threads: 0
shirish_kal shirish_kal is offline Offline
Newbie Poster

Re: Newbii Plz help me

 
0
  #8
Jan 11th, 2009
Thnx Buddy....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC