Tag Archives: https

What's the difference between getRequestURI and getPathInfo methods in HttpServletRequest?

Questions: I’m making a simple, very lightweight front-controller. I need to match request paths to different handlers (actions) in order to choose the correct one. On my local machine HttpServletRequest.getPathInfo() and HttpServletRequest.getRequestURI() return the same results. But I’m not sure what will they return in the production environment. So, what’s the difference between these method… Read More »

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

Questions: I’m developing a servlet that receives a multipart request with content of multiple files, and I’m using apache commons file upload libraries. When I call parseRequest(request); method servlet throws following exception: GRAVE: Servlet.service() for servlet DiffOntology threw exception java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest at org.apache.commons.fileupload.servlet.ServletRequestContext.getContentType(ServletRequestContext.java:73) at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:882) at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331) at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349) at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) at DiffOntology.doPost(DiffOntology.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)… Read More »

How can I read an HttpServletReponses output stream?

Questions: I want to make a Servlet filter that will read the contents of the Response after it’s been processed and completed and return that information in XML or PDF or whatever. But I’m not sure how to get any information out of the HttpServletResponse object. How can I get at this information? Answers: Add… Read More »

how to get a client's MAC address from HttpServlet?

Questions: I was asked to write a servlet that collects client’s details such as ip, mac address etc. getting his IP is pretty straight-forward (request.getRemoteAddr()) but I dont find an elegant way to get his MAC address. seems reasonable that the web server has access to data such as Mac address etc, since it gets… Read More »

PHP: HTTP or HTTPS? [duplicate]

Questions: This question already has an answer here: How to find out if you're using HTTPS without $_SERVER['HTTPS'] 22 answers Answers: If the request was sent with HTTPS you will have a extra parameter in the $_SERVER superglobal – $_SERVER[‘HTTPS’]. You can check if it is set or not if( isset($_SERVER[‘HTTPS’] ) ) { Questions:… Read More »

Redirecting from HTTP to HTTPS with PHP

Questions: I’m working on a shopping cart website and I would like to redirect the user to a HTTPS page when he’s entering his billing details and maintain the HTTPS connection for the next pages until he logs out. What do I need to install on the server (I’m using Apache) in order to do… Read More »

Make a HTTPS request through PHP and get response

Questions: I want to make HTTPS request through PHP to a server and get the response. something similar to this ruby code http = Net::HTTP.new(“www.example.com”, 443) http.use_ssl = true path = “uri” resp, data = http.get(path, nil) Thanks Answers: this might work, give it a shot. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // Set so… Read More »

CURL and HTTPS, “Cannot resolve host”

Questions: I’m trying to fetch the contents of a page using CURL. The page that is doing the fetching is https and the page it is trying to fetch is also https. I’m getting an error “Couldn’t resolve host” with all of the settings I try. $c=curl_init(); curl_setopt($c, CURLOPT_URL,$url); //curl_setopt($c, CURLOPT_USERAGENT, “Mozilla/5.0 (Windows; U; Windows… Read More »