4 Replies - 576 Views - Last Post: 15 December 2011 - 11:19 AM Rate Topic: -----

#1 sattua  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 83
  • Joined: 20-March 08

Connection refused by tomcat at getting cookie value in eclipse

Posted 15 December 2011 - 10:33 AM

Hi I am trying to get a cookie value, I have the cookie name and then a need to get his value, but when I do this, an error appears with this message: "java.net.ConnectException: Connection refused: connect". I am using remote debugging in eclipse (Remote java application), this is the method that gets the error:
        private String getCookieValue(String cookieName)//The cookie name comes from some where, it doesn't matter
	{			
		try {
                        //I took the next three lines from an example in google, so maybe it's not the best way 
                        //to get a cookie value:
			HttpClient cl = new HttpClient();
			cl.getParams().setParameter("http.useragent", "My Browser");
			GetMethod me = new GetMethod("http://myDomain.com/");
			
			Cookie[] cs;
		
			cl.executeMethod(me);//THIS IS THE LINE THAT GETS THE ERROR
		        cs = cl.getState().getCookies();
			for(int i=0; i < cs.length; i++) 
			{
				 
				if (cs[i].getName().equals(cookieName)) 
				{
					return cs[i].getValue();
				}
			}
			return "";
		} catch (Exception e) {
			System.err.println(e);
			return "";
		}					
	}






By the way, this is a method inside a .java action strut.


thanks in advance.

This post has been edited by sattua: 15 December 2011 - 12:52 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Connection refused by tomcat at getting cookie value in eclipse

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2553
  • View blog
  • Posts: 10,637
  • Joined: 20-September 08

Re: Connection refused by tomcat at getting cookie value in eclipse

Posted 15 December 2011 - 10:42 AM

What you're really doing is unclear. What is your goal? See

http://technojeeves....smart-questions
Was This Post Helpful? 0
  • +
  • -

#3 sattua  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 83
  • Joined: 20-March 08

Re: Connection refused by tomcat at getting cookie value in eclipse

Posted 15 December 2011 - 10:59 AM

my goal is to get the cookie value using that method, the problem is: "java.net.ConnectException: Connection refused: connect" at that method.

And sorry for be unclear.
Was This Post Helpful? 0
  • +
  • -

#4 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2553
  • View blog
  • Posts: 10,637
  • Joined: 20-September 08

Re: Connection refused by tomcat at getting cookie value in eclipse

Posted 15 December 2011 - 11:04 AM

You either didn't read, or didn't understand, the link i posted. All you've done is repeat yourself.
Was This Post Helpful? 0
  • +
  • -

#5 sattua  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 83
  • Joined: 20-March 08

Re: Connection refused by tomcat at getting cookie value in eclipse

Posted 15 December 2011 - 11:19 AM

I don't understand u g00se, I do not need to read any article for asking:

-"java.net.ConnectException: Connection refused: connect" is about permissions on tomcat's port, if not why this happens.

-It's that the best way to get a cookie value?


If you (g00se) are thinking in replay for saying something like "learn to ask" or "u were unclear", please, please do not do it, just close the tap and find another post to help coz obviously u can not help me.

thanks.

This post has been edited by sattua: 15 December 2011 - 11:20 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1