httpservletrequest

Where are the request method constants in the Servlet API?

I want to write if (POST.equals(req.getMethod())) instead of if ("POST".equals(req.getMethod())) but I cannot find the constant definitions in the Servlet API (only looked in HttpServletRequest, where I expected them to be). Where are they (I am using lots of libraries, so if someone else defines them, that would also work)? ...

HttpClientParams timout

how I can Use HttpClientParams to set timout time ? ...

accesing value data using request

Hi All, I have form with two buttons having same name but different values ,how to get the value of both the buttons having same name but different value using request ? <form action="controller"> <input class="smallbutton" name="op" value="login" type="submit"/> <input class="smallbutton" name="op" value="SignUp" type="submi...

parseRequest returning no items

i'm using the commons.fileupload .. when i try to parse the request i get no items from it which later leads to a null pointer exception... as far as i understand, this happens because "Why is parseRequest() returning no items? This most commonly happens when the request has already been parsed, or processed in some other way. Since th...

red5 and servlets: can i get HttpServerRequest and HttpServerResponse?

Hiya I'm trying to write an application for red5 that uses some servlet classes in order to package a requestion for facebook. the client side is a Adobe flash builder application. is it possible to send session information from the flex application in order for the red5 client side to create proper HttpServletRequest and HttpServletR...

jetty: dynamically changing idle time

I have a jetty server which is configured to expire requests after 30 seconds, this is the configuration line in the xml config file: <Set name="maxIdleTime">30000</Set> There are two kinds of requests that are accepted by this server: requests which have to be served in real time and requests that come from batch scripts that can tak...

HttpServletRequest.getServerName() occasionally returning null in concurrent use?

Under JBoss 4.0.1SP1, I have a servlet that makes multiple, concurrent calls to web services that are running under the same instance. I'm using request.getServerName() (on HttpServletRequest) to construct the endpoint URL. This normally works fine, but every once in a while returns null. I hadn't seen this before running the web servic...

Why are there magic attributes exposed in the Servlet spec?

It's always seemed a little at odds with the principles of Java that the Java Servlet Spec (2.5 version here) includes a set of magic attributes containing info about included resources, namely: javax.servlet.include.request_uri javax.servlet.include.context_path javax.servlet.include.servlet_path javax.servlet.include.path_info javax.s...

Strange values coming from HttpServletRequest.getReader

I built a restful ajax app using Java and servlets. When making POST requests, I send json in the body, but when making GET requests, I rely solely on the URL. While testing, I made it so that the app gets the raw request body using HttpServletRequest.getReader on each request, no matter what. What I found was that extremely rarely and s...

unable to implement HTTP Tunneling correctly in order to enable Java rmi calls over internet(and under ISP)

in my previous question :-How to Setup RMI Server under(NAT/ISP) Now,i m able to start my RMI server by Installing apache Tomcat 6.0 server. i have also installed servlet programs into apache Tomcat server in order to enable HTTP tunneling. my servlet codes:- (1) [SimplifiedServletHandler.java][2] (2) [ServletForwar...

Is Java File object from a MultipartRequest written to disk as temp file or stored in memory?

If I accept a file from a MultipartRequest and call File f = request.getFile("fileName"); Is the file written to disk (as a temp file) or is it only stored in memory at this point? ...

Get MAC address from Jetty HTTPServletRequest

Hi all, Does anybody know if there is a way to get the sender's MAC address from an HTTPServletRequest in Jetty? (Note: by sender, I mean immediate sender aka the last hop before my server). If there isn't a direct way, does anybody know a way to translate an IP address to a MAC address in Java? Other note: I completely realize th...

How to get the request url from HttpServletRequest

Say i make a get request like this: GET http://cotnet.diggstatic.com:6000/js/loader/443/JS_Libraries,jquery|Class|analytics|lightbox|label|jquery-dom|jquery-cookie?q=hello#frag HTTP/1.0 Host: cotnet.diggstatic.com:6000 My servlet takes request like this: HttpServletRequest req; When i debug my server and execute, i get the following:...

Mimic an HTTPRequest and HTTPResponse object in Java

How do I mimic an HTTPServletRequest and HTTPServletResponse object. The reason is I want to test the behaviour of some servlets. I know JUnit probably provides this functionality but I don't know how to use it (I will learn soon) and need to do this reasonably quickly. HTTPServletRequest and HTTPServletResponse are both interfaces so ...

Tomcat servlet doesn't fetch request param

The problem is that my servlet doesn't fetch the parameter "protocolversion" (see below) for my Python script for some odd reason. The getParameter call always returns null! Is perhaps the HTTP post request invalid? I use Tomcat 6 with default configuration. A strange thing I've noticed when logging with Wireshark is that Tomcat responds...

How can i load Java HttpSession from JSESSIONID ?

I want to get Java HttpSession by JSESSIONID. Is it possible? If yes, how? ...

Efficient access to HttpServletRequest for debug prints

Hello, In order to debug failing requests I would like to print all information coming from HttpServletRequest. Now, it's possible that a request will partially fail (for ex. Several matches are successful, yet one has failed) in which case I would like to catch the exception in the internal method that failed, print the error + the S...

HttpServletRequest - setCharacterEncoding seems to do nothing

I am trying to read UTF-8 info from the request. I used "request.setCharacterEncoding("UTF-8");", but it seems to do nothing - the info read is non UTF-8. What am i doing wrong? ...

Get the request URL in a JSF bean?

How do you get the request URL in a bean backing a JSF page? I've been looking through the FacesContext docs and the best way I could find seems terribly long: public String getRequestURL() { Object request = FacesContext.getCurrentInstance().getExternalContext().getRequest(); if(request instanceof HttpServletRequest) { ...

HttpServletRequest: How to determine Content-Type of requested asset

Hi All, I am writing a quick-and-dirty static file server using Jetty. I need to set the Content-Type for each response: HttpServletResponse.setContentType("content/type"); For a given file request, how do I reliably determine what content type to set? Is it a question of examining the file extension, or is there a more sophisticated...