Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get data from an HTTPS request

 
Zeonbong Wong
Greenhorn
Posts: 22
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,i got some trouble while getting data from an https request
my web.xml look like this......I wanna use https to send data to a servlet

and


here is my servlet:


however,when i run it,i got this in my log

all parameter values are null

can anyone one tell me what is wrong??thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your web.xml really looks like this:

it is rather surprising you got anything at all. Are you trying to do this in an IDE?

All classes used in servlets should be in a package and the class files stored accordingly - the reason being that when the JVM sees a reference to a class with no explicit package, it looks in the "current directory" - something you have no control over.

Bill
 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The classes should be in packages, that is right.

More accurately this a compile time thing. When the compiler is done with the code,
it puts complete class references (that is, along with the package names, even for the java.lang classes) into the class file.
The JVM does not guess the packages, the compiler does.

On the compilation level it is not possible to access a class in the default package from outside this package,
because the reference wihtout explicit package "path" will be understood by the compiler to be of the same package as the source class.

With reflection it is possible though, so it is possible for the servlet container.
 
Zeonbong Wong
Greenhorn
Posts: 22
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:If your web.xml really looks like this:

it is rather surprising you got anything at all. Are you trying to do this in an IDE?

All classes used in servlets should be in a package and the class files stored accordingly - the reason being that when the JVM sees a reference to a class with no explicit package, it looks in the "current directory" - something you have no control over.

Bill

My web.xml does look like that,and it works,except the wrong outcome
 
Zeonbong Wong
Greenhorn
Posts: 22
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:

The classes should be in packages, that is right.

More accurately this a compile time thing. When the compiler is done with the code,
it puts complete class references (that is, along with the package names, even for the java.lang classes) into the class file.
The JVM does not guess the packages, the compiler does.

On the compilation level it is not possible to access a class in the default package from outside this package,
because the reference wihtout explicit package "path" will be understood by the compiler to be of the same package as the source class.

With reflection it is possible though, so it is possible for the servlet container.

but i still cant solve my problem~any ideas?
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying this problem only occurs when you configure the servlet to use HTTPS? Or have you not tried HTTP, and you're just assuming that HTTPS must be the problem?
 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What URL are calling or what form do you submit against what URL?
 
Zeonbong Wong
Greenhorn
Posts: 22
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Are you saying this problem only occurs when you configure the servlet to use HTTPS? Or have you not tried HTTP, and you're just assuming that HTTPS must be the problem?

using HTTP it works perfectly,but using HTTPS,it doesn't
 
Zeonbong Wong
Greenhorn
Posts: 22
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:What URL are calling or what form do you submit against what URL?

i dont really remember is that matters??
 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



If those variables are assigned null, then there was no parameters
usernameorMailbox
password
isAutoLogin

From where on Earth are they supposed to be there if not from the URL or the form?
 
Zeonbong Wong
Greenhorn
Posts: 22
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:


If those variables are assigned null, then there was no parameters
usernameorMailbox
password
isAutoLogin

From where on Earth are they supposed to be there if not from the URL or the form?

the form~it is okay using http to post but isn't using https
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic