File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes HTTPServletRequest Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "HTTPServletRequest" Watch "HTTPServletRequest" New topic
Author

HTTPServletRequest

michael ancheta
Greenhorn

Joined: Sep 25, 2009
Posts: 4
Hi guys,

How can i use an HTTPServletRequest on a class?
I want to get the httpheader of a page.

Thanks
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48842

Welcome to the Ranch.

Here's a helpful tip: Be sure to take the time to compose descriptive subjects for your posts; read this for more information.

A title such as "HTTPServletRequest" is not helpful. What would happen if all posts had such a title?

Please go back and change your post to add a more meaningful subject by clicking the button on your post.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48842

The interface name is HttpServletRequest. Case counts!

An implementation of this interface is passed to the servlet's doPost() and doGet() methods when a servlet is invoked. Methods on this interface allow you to retrieve request headers.

This message was edited 1 time. Last update was at by Bear Bibeault

michael ancheta
Greenhorn

Joined: Sep 25, 2009
Posts: 4
Ok. Thanks for that.
michael ancheta
Greenhorn

Joined: Sep 25, 2009
Posts: 4
this would work right?
I just need to import the necessary servlet classes.

This message was edited 1 time. Last update was at by michael ancheta

Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48842

Another tip: Be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48842

What happened when you tried it?
michael ancheta
Greenhorn

Joined: Sep 25, 2009
Posts: 4
I dont know if its returning the correct value.
What does this method do?
What is it returning?



i want to use the method from the HttpServletRequest interface.

but i think i did right. just want a verification.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
It returns an enumeration of the HTTP header names in the request, as described in its javadocs.

Is it returning the names of the headers in your request? You can use a tool like Firebug or any general network sniffer to check what's coming across "on the wire".
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1287

michael ancheta wrote:
but i think i did right. just want a verification.


I do verify from Java doc HttpServletRequest Java Doc


Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
 
subject: HTTPServletRequest
 
MyEclipse, The Clear Choice