aspose file tools*
The moose likes Servlets and the fly likes how to get data from an HTTPS request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to get data from an HTTPS request" Watch "how to get data from an HTTPS request" New topic
Author

how to get data from an HTTPS request

Zeonbong Wong
Greenhorn

Joined: Jun 12, 2013
Posts: 22

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

Joined: Mar 22, 2000
Posts: 12682
    
    5
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

Java Resources at www.wbrogden.com
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 865
    
    5


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

Joined: Jun 12, 2013
Posts: 22

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

Joined: Jun 12, 2013
Posts: 22

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
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    8

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

Joined: May 22, 2012
Posts: 865
    
    5
What URL are calling or what form do you submit against what URL?
Zeonbong Wong
Greenhorn

Joined: Jun 12, 2013
Posts: 22

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

Joined: Jun 12, 2013
Posts: 22

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

Joined: May 22, 2012
Posts: 865
    
    5



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

Joined: Jun 12, 2013
Posts: 22

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get data from an HTTPS request
 
Similar Threads
Toggling from http to https using filters in Tomcat
About the security and role in web.xml
Filters
BASIC Authentication
SSL and certificates Configuration in WebSphere Application Server 7