httpresponse

Trouble determining proper decoding of a REST response from an existing REST service using IHttpModule and response filters.

First a little background on what I am trying to achieve. I have an application that is utilizing REST services served by ArcGIS Server and IIS7. The REST services return data in one of several different formats. I am requesting a JSON response. I want to be able to modify the response (remove or add parameters) before the response i...

Asp.Net MVC Combine and remove inline scripts during response.

I have been doing some performance analysis on a few websites I am working on and I am noticing that a big problem is the inline scripts. For the external scrips I wrote an http handler which combines, minifies, and gzips the javascript into one file. This is then stored for reuse later by hashing the filenames. What I am wondering (...

How can I tell if Response data has been sent to the client yet in ASP.NET?

I'm writing a helper method in C#/ASP.NET that streams a file to the browser, and I would like to be able to detect if any content has been written to the browser prior to clearing the response headers/content and sending file bytes. If a page that makes a call to my helper method is not set up correctly, it seems like it would be possib...

How can I return gzipped css/js

I'm using .NET and the simple question is: How or can I let the web browser know that <script type="text/javascript" src="/Scripts/myjsfile.js"/> is gzipped? can I just append .gz to the source? This article, which is pretty cool, shows how to to compress my dynamic html by plugging into the Response.Filter stream object to return...

Django return HttpResponseRedirect to an url with a parameter

Hello, I have a situation in my project where i need to make a redirection of the user to an url containing a parameter, (it is declared in the urls.py like: url(r'^notamember/(?P<classname>\w+)/$', notamember, name='notamember'),) How can i put that parameter in the return HttpR...

Random characters on an HTTP response using sockets.

I am using sockets to create a POST request to a given server. The response comes back mostly ok, and I'm using an InputStream with an encoding of "UTF-8" to read the response from the server. Most of the response makes sense and I'm able to view the HTML correctly, however, seemingly at random, I see codes such as "1ffa", "6e8", "1972",...

How to abort an ASMX request based on logic in the constructor?

I have a common base class from which all my ASMX webservice classes will inherit. In the constructor, I want to do some common authentication checks; if they fail, I would like to halt processing right away (subclass's code would not get executed) and return a 401-status-code response to the caller. However, the common ASPX-like ways ...

get HttpServletResponse from liferay portal

I am trying to get the HttpServletResponse from liferay portal. I am also working with icefaces. PortletResponse response1 = (PortletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse(); HttpServletResponse response = (HttpServletResponse)response1; I get the following Exception: Caused by: java.lang....

Specify supported media types when sending "415 unsupported media type"

If a clients sends data in an unsupported media type to a HTTP server, the server answers with status "415 unsupported media type". But how to tell the client what media types are supported? Is there a standard or at least a recommended way to do so? Or would it just be written to the response body as text? ...

Why does my custom HttpResponse throw exception on HttpResponse.End()?

I'm writing some code in which I need to use my own HttpResponse object to capture the output from a method on another object that takes an HttpResponse as a parameter. The problem is, this other object (which I cannot modify) calls HttpResponse.End(), which causes an "Object reference not set to an instance of an object" exception to b...

HttpRespond always throws IOException

I want to send Parameters to PHP page and wait for receive String Respond but it always throws IOException when i pass this HttpResponse response = httpclient.execute(httppost); it try to execute both android device and emulator this is my fuction public String HTTPPostData(String url,String... params) throws IllegalStateException, ...

How do I read the html from an HttpResponse object

I'm creating a custom module and I need to be able to read the html output that's written to the HttpResponse object. Can anyone provide direction on this? Thanks! ...

Disassemble HTTP Response (C)

Hi, In continuation of this question I ask the following question. I've managed to read and understand what D.Shawley has recommended and I already finished a lot of work. But a problem occured to me again. I've managed to get the Content-Length of the page out of the HTTP response, but now I'm experiencing some problems with getting th...

Log only http servlet response headers

This is a question related to http://stackoverflow.com/questions/3242236/capture-and-log-the-response-body. What if I only want to log the response headers, and not the entire body? Is there a different approach than described in the linked question? ...

sending content-encoding header in django

Hello I want to have a plaintext version of my content available. So I have a separate template for that. I am calling render_to_response with mimetype="text/plain" but i want to tell a browser opening that page in the http-response that the content is utf-8 encoded. How do i do that (e.g. what do i have to add to render_to_response)? ...

HTTP Content-Length incorrect size served?

I'm serving some files locally via HTTP using QTcpSocket. My problem is that only wget downloads the file properly, firefox adds four extra bytes to the end. This is the header I send: HTTP/1.0 200 Ok Content-Length: 382917; Content-Type: application/x-shockwave-flash; Content-Disposition: attachment; filename=file.swf; This i...

NSURLConnection validation

I am trying to validate weather the connection was successful but have been getting inconstant results. When I try to do an synchronous request using a bogus url with: NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; if (responseData) { did_send = TRUE; ...

What does HttpResponse.WriteFile Method parameter bool readIntoMemory do?

What does HttpResponse.WriteFile Method parameter bool readIntoMemory do? The MSDN documentation is very unhelpful in this regard as I came across this method and wasn't exactly sure why I'd want to do this or not do this. Note: should anyone respond with "well it reads the file into memory" with no further explanation will be downvot...

Trouble creating csv for download

Using this lovely example I am getting some funky results. What I have is: Protected Sub btnCSV_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCSV.Click Response.Clear() Response.Buffer = True Response.ContentType = "text/csv" Response.AppendHeader("Content-Disposition", "inline; filename=" + Fil...

view response content of ajax,flash http requests

I'm interested if there is some tool (preferably a firefox addon) that allows you to record http requests and view their response header and content. ...