I'm trying to implement a client application over https using commons-httpclient.
I have implemented a servlet at the server end to send data to client as blocks (chunks of data). each block contains 4MB. now my problem is, If i download using http url, i.e like http://localhost:8080/DownloadServlet/post it works fine. If I use https, some times I'm receiving 500 error and download stops in the middle. Can some one tell me what might be the problem.
thanks.
Related
When I say drop connection I mean actually closing the socket without reading any more bytes. I am trying to prevent a DoS attack where the attacker is trying to make a lot of HTTP requests that upload very very large files. For my purpose, I will consider any client trying to upload file larger than a pre-configured amount as attacker, and I would like to terminate the connection ASAP without reading even single more byte (I would like to send a HTTP 413 back to client if possible, but I don't care if the client receive the response or not, I just don't want any more byte from the client).
I have a app that runs within Jetty and from what I observed even if I throw exception, Jetty itself will still consume all the request body (and drop them) as part of the HTTP request life cycle.
So how do you guy do that? Through Jetty itself or through some kind of reverse proxy?
I know about maxFormContentSize and Apache File Upload, but they don't really do what I am looking for.
I have .war on the server which contains servlets. When I send an HTTP request through the browser, I am able to connect and retrieve files. Now, I want to do this programmtically in Java. In order to connect, I am first sending a get request that contains the user name and the password. Now assuming that I will stay logged in, I am sending another get request with its parameters to get the file, but I am unable to retrieve the file. Is there any way to do this? Currently, I use HttpClient and HttpGet to connect and execute the get requests.
Eventually what I am trying to do is to have an application, deployed on a server call a servlet on the same server but under a .war (i.e. implemented as another application) and retrieve a file. I have tried to call the servlet directly but also I have been able to figure that out.
I'm sending JSON data from my Java application to my local webserver with my PHP script that is receiving this message. Now as far as I know I can only view what has been received by for example inserting the data in a database. Is there a way/application to view the live POST requests sent to my PHP webserver?
I like to use fiddler for these kinds of tasks if the java HTTP library has support for proxies. Fiddler will list all information about the HTTP requests that is available. It will by default log all HTTP requests across your system, but can be told to limit to one application.
You can try setting your httpd logging level to verbose or (depending on what httpd it is) try to use extension that would do log all the data send in requests
For debugging purposes why not just write the POST data to a file?
i.e.
file_put_contents(<some filename>, $HTTP_RAW_POST_DATA);
My system:
Server: Java Soap Web Service generated by JAX WS 2.2.3 (-wsgen)
Client: iOS - Soap Web Service generated by SudzC
I am using SudzC on iOS to communicate with a Java web service. I want to upload NSData files from the iOS client to the Java Server or download byte[] files from the Java server to the client. For small amounts of data the web service runs fine, but when the data is greater than 4MB, there are problems. If i send a file which is greater than 4MB a HTTP Internal Error 500 occurred or everything get stuck and my application crashes.
Any suggestions? Perhaps, should I try something else than SudzC?
I know, that to send and receive large files, SOAP has an opportunity called MTOM.
This extracts the base64Binary data from the SOAP message and packages it as separate binary http attachments within the MIME message, in a similar manner to e-mail attachments.
So my problem is, how can i implement this option on the iOS client SudzC generated objective-C program code?
On the java server side the MTOM option is activated, but on the iOS client i have to implement this option?!
Perhaps someone can help?
I use WSClient++ to generate the classes and never had a problem.
http://wsclient.neurospeech.com/
I don't like SudzC, I have any problems when XML return has list of list.
I've used SudzC to upload larger files (20 + megabytes) so the issue probably isn't from SudzC. I remember having an issue with the file upload at the beginning aswell : the server didn't accept anything over X bytes and was returning an error.
However, what i have seen is that sudzC has a lot of issues with memory when uploading large files so i switched to wsdl2objc for file upload
I am developing a software which will be communicating with a server using HTTP (but it is not a web browser). Since the server part is not ready yet, I would like to debug my client software by sending HTTP messages to it. I know that I can send HTTP requests using Curl. But I am not sure if that is sufficient here.
I'm imagining an environment where I send a request from my application, check that it is correct using Wireshark and then reply to the request using some software. Using Curl, I think I would have open a listening port..?
I'd use a simple node.js server for this. You can write your own HTTP server in a few lines of code an simulate various return codes, response headers or response entities easily: http://nodejs.org/
PS: There are proxies that simply print out the HTTP messages. This might be helpful for you too, because you don't have to deal with WireShark anymore just for HTTP-level logging.
You can't do that with cURL. It is an http client, not a server.
The simplest way to do this is to actually implement a mock server application that just returns a static (i.e. hardcoded) message every time. You can do this using any server-side language you like (php, python, ruby, ...), or, you can even do it without a server side language, using just static files served by a webserver such as apache or nginx.
For example, if the server part (the API) would respond to /articles.json with something relevant (a JSON object containing some articles), you could put a file named articles.json that contains some hand-written data in your server's root. Then, your application would think it's calling an API when it's actually just downloading a static file.
You can use firebug addon of firefox browser to see content of HTTP request/response.
It does't require any server (but of course, if you dont have server which process requests from browser and send responses to browser, you 'll always see response "unable to connect").
If you still need to mock response, you can create simple server which is able to respond with mock responses, for example java servlet at tomcat server, with code like this:
public class MyMockServlet extends HttpServlet {
..
private String mockHeaders = "...";
private String mockResponse = "my response";
public void service(HttpRequest request, HttpResponse response){
setHeaderAndBodyInResponse(response);//your method
}
}