Content-Length Header Missing in Http Response
Hi folks,
Our application uses JSPs and Servlets. To solve a TCP level probelm, we would like to ensure that each response sent from the WebLogic Server includes a content-length header. All the pages are dynamic and therefore we cannot explicitly set the content-length.
To ensure that WebLogic has the opportunity to set this header, we have increased the response buffer size by adding a <%@ page buffer="nK" %> header to our JSPs and a response.setBufferSize call to our Servlets. The responses still do not contain a content-length header.
Is there anything else we can do to get WebLogic to set this header?
Thanks in advance,
Santosh
Anybody?
Similar Messages
-
Content-Lengh Header Missing in Http Response
Hi folks,
Our application uses JSPs and Servlets. To solve a TCP level problem, we would like to ensure that each response sent from the WebLogic Server includes a content-length header. All the pages are dynamic and therefore we cannot explicitly set the content-length.
To ensure that WebLogic has the opportunity to set this header, we have increased the response buffer size by adding a <%@ page buffer="nK" %> header to our JSPs and a response.setBufferSize call to our Servlets. The responses still do not contain a content-length header.
Is there anything else we can do to get WebLogic to set this header?
Thanks in advance,
SantoshAnyway, this works for me:
try {
URL u = new URL("http://localhost:9090/");
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setInstanceFollowRedirects(false);
c.connect();
Map<String,List<String>> hs = c.getHeaderFields();
for(Map.Entry e : hs.entrySet()) {
System.out.println(e.getKey() + ": " + e.getValue());
} catch (Exception ex) {
ex.printStackTrace();
}Where on localhost:9090 I have a server that will issue a redirect on / and content on anything else.
This code will issue the request, then read the response headers, including the Location: header. -
Content-Length header not changed after url-rewrite... yields cut page.
We use iPlanet6 ,service pack 4. The pages that return from the servlets are
changed by the Application Server. The Application Server adds
GXHC_GX_jst=901a10a6662d6164& to the all the URLs (which increase the
page's size). The problem is that Application Server does not change the
Content-Length header in the servlet response. This yields cut pages in the
browser (IExplorer5).
If we don't add the Content-Length header it works fine. (I.e., The pages
are not cut.) Our problem is that we work with mobile devices that must have
the Content-Length header to work properly.
Q: Do you know if there is a patch that fix the problem?
Q: Is it possible to configure the Application Server to prevent this
url-rewrite?
Regards,
AviramHi guys,
I would like to do url rewriting on our CF app but am worried I'll break something if I try and do it myself - is there anyone who would be interested in a bit of consultancy to help us achieve this?
I want to turn http://www.allchichesterjobs.com/search-results.cfm?sector=21&q=part-time-jobs
into http://www.allchichesterjobs.com/part-time-jobs
I've tried this using IIS and URL Rewrite, when I browsed to http://www.allchichesterjobs.com/search-results.cfm?sector=21&q=part-time-jobs
my browser was redirected to http://www.allchichesterjobs.com/part-time-jobs ok - but then I got a 404 error
I'm wondering if I can pay someone to remote view my screen while we talk on skype and tell me what to do?
Hope it's ok to post this sort of request on here
Thanks very much indeed.
Nick -
Content-Length Header being stripped out of Gatewayed pages
I am working to integrate the GPL'ed Moodle e-learning web application with Plumtree. However, I'm hitting a snag. For certain POST events, Moodle expects to receive a content-length header.
When I use the application outside the portal, it works fine, and the Content-Length header is sent. However, when I have the application gatewayed through the portal, the Content-Length header seems to get stripped out of the HTTP request and I get HTTP error 411 (Content Length Required).
Is there a way I can convince the portal to not strip out the Content Length HTTP header?I'm working with .NET portal.
For the particular file that caused the error as reported in the tcptrace log, I opened IIS manager, found the virtual directory, right clicked to open the properties dialog and checked directory security.
Select edit anonymous access to check the account used for anonymous access, supply the user account needed and allow IIS to manage password. If in doubt check the settings on pages containing http post that are functioning properly.
Check Integrated Widows Authentication
I found this virutal directory had no user in the anonymous account, not sure how this happened. This resulted in pages that contained post/postbacks giving the "length required" error when I hit a button to perform the post/postback. Pages that did not contain Posts/Postback work correctly. -
Let me know if it possible to add P3P header in the HTTP responses of Oracl
Let me know if it possible to add P3P header in the HTTP responses of Oracle applications 11.5.10
Could you please elaborate more on what you are trying to do/achieve?
Thanks,
Hussein -
SPA303 - Reordering the position of Content-Length header in SIP INVITE
Hi,
I have SPA303 IP Phone connected behind a SIP ALG router but have been facing issues with media setup for incoming and outgoing calls.
Further investigation using SIPp script helped me out to understand the root cause of the issue which is as follows:
If the SIP INVITE or 200 OK for SIP INVITE has Content-Length header ahead of the Content-Type header, the SIP ALG router is not able to handle the RTP traffic for the calls. Cisco SPA303 IP phone exhibits this behaviour and hence couldn't successfully establish call with the SIP ALG that I use.
Can you please confirm if it is configurable to reposition or re-order the Content-Length header to resolve this issue?
Thanks in advance.
Regards,
Anand KrishnanAs far as I know it's not configurable. According SIP protocol, the order of SIP headers is not meaningfull.
Your router need to accept both orders as both are corrrect and have same meaning. Ask the vendor of router for updated firmware ... -
SunOne Web Server 6.1 and JSP response content-length
Hi,
I am looking for help for a problem in my previous post
http://swforum.sun.com/jive/thread.jspa?threadID=58612.
It seems to me the only significant difference of the response to the same jsp file from 6.0 and 6.1 server is the content-length header.
6.0 response has the content-length header;
6.1 response does not have the content-length header.
HttpUrlConnection::getContentLength() returns the actual content length of the 6.0 response;
HttpUrlConnection::getContentLength() returns -1 for the 6.1 response.
Here is the dump,
SunOne WebServer 6.0
allowUserInteraction? false
content? sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@1eed786
contentEncoding? null
contentLength? 999
contentType? application/x-java-jnlp-file
Date? 1131378080000
DefaultAllowUserInteraction? false
DefaultUseCaches? true
DoInput? true
DoOutput? false
Expiration? Wed Dec 31 19:00:00 EST 1969
FileNameMap? java.net.URLConnection$1@1a1c887
lastModified? Wed Dec 31 19:00:00 EST 1969
requestMethod? GET
responseCode? 200
responseMessage? OK
HEADER::Set-cookie=[JSESSIONID=pkand013-1%253A436f75a0%253A5b909ee2e5bbe3bc;path=/]
HEADER::Date=[Mon, 07 Nov 2005 15:41:20 GMT]
HEADER::Server=[Netscape-Enterprise/6.0]
HEADER::null=[HTTP/1.1 200 OK]
HEADER::Content-length=[999]
HEADER::Content-type=[application/x-java-jnlp-file]
SunOne WebServer 6.1
allowUserInteraction? false
content? sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@1fee6fc
contentEncoding? null
contentLength? -1
contentType? application/x-java-jnlp-file
Date? Mon Nov 07 10:49:07 EST 2005
DefaultAllowUserInteraction? false
DefaultUseCaches? true
DoInput? true
DoOutput? false
Expiration? Wed Dec 31 14:00:00 EST 1969
FileNameMap? java.net.URLConnection$1@1503a3
lastModified? Wed Dec 31 19:00:00 EST 1969
requestMethod? GET
responseCode? 200
responseMessage? OK
HEADER::null=[HTTP/1.1 200 OK]
HEADER::Expires=[Wed, 31 Dec 1969 19:00:00 EST]
HEADER::Set-cookie=[JSESSIONID=44A318F4BC0802A4C70C27FD4AB1C115;Path=/]
HEADER::Transfer-encoding=[chunked]
HEADER::Date=[Mon, 07 Nov 2005 15:49:07 GMT]
HEADER::Pragma=[No-cache]
HEADER::Server=[Sun-ONE-Web-Server/6.1]
HEADER::Content-type=[application/x-java-jnlp-file]
HEADER::Cache-control=[no-cache]
In my test env, 6.0 and 6.1 are installed on the same machine (Win2K), using the same directory as web root, same http port. Browser runs on a different machine.
Thanks
HarryHi, elving
This is good information. Thanks very much.
Actually, I am not using SSL, just plain http connection with basic auth. It might be the cache-control header that causes the head ache. 6.0 response does not have the cache-control header, but 6.1 has.
The interesting thing is that adding a servlet mapping on 6.1 solves the problem.
I will take a further look tomorrow.
Cheers,
Harry
I doubt the problem has to do with the Content-Length
header.
I'd guess that you're using SSL. Are you? If so,
you're almost certainly bumping into a known bug (or,
as Microsoft describes it, a "feature") in Internet
Explorer. Microsoft article KB316431 at
http://support.microsoft.com/default.aspx?scid=316431h
as some information on the problem. As the article
points out, the problem occurs when Internet Explorer
needs to invoke an external application to handle a
file that was served over SSL with Cache-Control:
no-cache and/or Pragma: no-cache headers.
A work around would be force Web Server to send
Cache-Control and Pragma headers that don't include
the no-cache directive. For example, the following
lines could be added to the obj.conf configuration
file:<Object ppath="*.jnlp">
Output fn="set-variable" set-srvhdrs="Cache-Control:
private"
Output fn="set-variable" set-srvhdrs="Pragma:
private"
</Object>Fortunately, it sounds like you've already
found another viable work around. -
Missing Content-Length in HTTP response
Hi All,
I am experimenting with developing websevices using Sun Java Application Server. I have a working webservice using BEA Weblogic and I would like to have it ported to SUN. The application works like this: A client (Tuxedo application program) sends an XML document to the webservice, in response the websevice parse this document and based on certain fields it send back another document.
The problem is that the SUN application does not return the content-length in its response and hence the requesting client rejects the message. Can anyone help?? Below is the response from both SUN and Weblogic:
Weblogic
HTTP/1.1 200 OK
Date: Sat, 22 Oct 2005 11:42:53 GMT
Pragma: no-cache
Server: WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 with CR174524
Content-Length: 2025
Content-Type: text/xml; charset=UTF-8
Expires: Thur, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Connection: Close
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
SUN
HTTP /1.1 200 OK
X-Powered-By: Servlet/2.4
SOAPAction: ""
Content-Type: text/xml;charset=utf-8
Date: Sat, 22 Oct 2005 11:42:53 GMT
Server: Sun-Java-System/Application-Server
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
env:Envalope xmls:env="http://schemas.xmlsoap.org/soap/envelope/"
As can be seen the Content-Length is missing.
Thanks for your help.
RansfordIs there an option in Sun Java Application Server to include Content-Length in response to a client request? If not is it possible to generate this information from the service code?
Thanks. -
Gzip / Content-Length HTTP-Header
Hello,
I'm writing an HTTP-Proxyserver, but I don't know how to get the length of a GZIPOutputStream ... I'm compressing the data, if the server does not send gzipped data:
logger.debug("Encode as GZip data!");
byte[] BinaryBody = new byte[8192];
GZIPOutputStream gzipOut = new GZIPOutputStream(client.getOutputStream());
int length;
while ((length = in.read(BinaryBody)) != -1)
gzipOut.write(BinaryBody, 0, length);
gzipOut.flush();
gzipOut.close();I often get a Nullpointer exception in the line (while ((length = in.read(BinaryBody)) != -1)
I think it's because I don't set the Content-Length Header, but I'm not sure.
greetings,
JohannesDisable the "Use Chunked Streaming Mode" property in HTTP Transport Configuration of your business service. By default it remains enabled.
Regards,
Anuj -
Unable to deserialize HTTP response content - SharePoint Designer Call Web Service Workflow Activity
I am creating a workflow using SharePoint Designer 2013 and I'm using the call HTTP web service action.
The web service call works (it is for a text messaging service, and I get the text message to my phone) however the workflow stops at this point with internal status "suspended" and gives the error message below when clicking on the "i"
icon.
I have tried setting the Accept and Content-Type request headers to "application/json; odata=verbose" (minus the quote marks) as other posts suggested but this doesn't make a difference (e.g. here: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/f0b18411-87d1-466b-aab0-1a0093605ed4/workflow-cannot-read-json-after-latest-sp15-patches?forum=sharepointdevelopment).
I tried adding in the Content-Length header too but that made no difference.
I tested calling another web service (https://sharepointurl/_api/contextinfo) and this works fine.
Is there any way to get the workflow to accept this XML as the response? I don't actually really need anything out of the response content, but I do need the workflow to carry on after this step and carry out other activities after this call.
Error message:
Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.IO.InvalidDataException:
Unable to deserialize HTTP response content. Expected ContentType : 'application/json', 'text/plain' or 'text/html', Received ContentType : 'text/xml'. Content (truncated) : '<?xml version="1.0" ?><outbound-message-delivery messageId="35d60bd2-a829-4382-8189-7a74de2d1cca"
isError="false"><recipient msisdn="6427xxxxxxx" isError="false"></recipient></outbound-message-delivery>'. ResponseStatusCode : 'OK' Request Uri : 'https://www.txtserviceurl.co.nz/api/3/sms/out?to=6427xxxxxxx&body=test+from+workflow'
at Microsoft.Activities.Messaging.SendHttpRequest.OnReceiveResponse(NativeActivityContext context, Bookmark bookmark, Object value) at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) Exception from activity SendHttpRequest HttpPost Switch<String> Sequence Microsoft.SharePoint.WorkflowServices.Activities.CallHTTPWebService
Stage 1 Sequence Flowchart Sequence TestingHi,
Thank you for your post.
I'm trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
Best Regards,
Lisa Chen
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Lisa Chen
TechNet Community Support -
Remove "content-length" item from the header of httpServletResponse
Hi all,
tomcat6.0, JDK5.0.
I use tomcat6.0 as the web container and JDK version is 1.5.
I found tomcat connector will add "content-length" item in all httpServletResponse header.
But now I need generate some chunked http response.according the RFC, there should be no "content-length" item in the http header when response is chunked-encoding.
So how can I remove the 'content-length" item from the httpServletResponse header?
Thanks a lot!
Rareone posting to a question, please:
http://forum.java.sun.com/thread.jspa?threadID=5268921&tstart=0
% -
Many of us, who are starters, starting to wonder when reading any API documentations or starting out with your first program built to make any of the API calls, what do all error codes means, when I get many different types of response from running the program/script. The only reason I thought about sharing this is because I know how motivation plays a key role when dealing with Eloqua platform and building components on top. This extends the functionality beyond what is already out of the box.
I put together a table that explains these in details. I hope you can benefit in resolving issues as you venture in your journeys. This is a very common chart that can be seen across many platform REST APIs. Idea was to have it here because the audience are not always the same.
Response Code
HTTP Operation
Response Body Contents
Description
200
GET, PUT, DELETE
Resource
No error, operation successful.
201 Created
POST
Resource that was created
Successful creation of a resource.
202 Accepted
POST, PUT, DELETE
N/A
The request was received.
204 No Content
GET, PUT, DELETE
N/A
The request was processed successfully, but no response body is needed.
301 Moved Permanently
GET
XHTML with link
Resource has moved.
303 See Other
GET
XHTML with link
Redirection.
304 Not Modified
conditional GET
N/A
Resource has not been modified.
400 Bad Request
GET, POST, PUT, DELETE
Error Message
Malformed syntax or a bad query.
401 Unauthorized
GET, POST, PUT, DELETE
Error Message
Action requires user authentication.
403 Forbidden
GET, POST, PUT, DELETE
Error Message
Authentication failure or invalid Application ID.
404 Not Found
GET, POST, PUT, DELETE
Error Message
Resource not found.
405 Not Allowed
GET, POST, PUT, DELETE
Error Message
Method not allowed on resource.
406 Not Acceptable
GET
Error Message
Requested representation not available for the resource.
408 Request Timeout
GET, POST
Error Message
Request has timed out.
409 Resource Conflict
PUT, PUT, DELETE
Error Message
State of the resource doesn't permit request.
410 Gone
GET, PUT
Error Message
The URI used to refer to a resource.
411 Length Required
POST, PUT
Error Message
The server needs to know the size of the entity body and it should be specified in the Content Length header.
412 Precondition failed
GET
Error Message
Operation not completed because preconditions were not met.
413 Request Entity Too Large
POST, PUT
Error Message
The representation was too large for the server to handle.
414 Request URI too long
POST, PUT
Error Message
The URI has more than 2k characters.
415 Unsupported Type
POST, PUT
Error Message
Representation not supported for the resource.
416 Requested Range Not Satisfiable
GET
Error Message
Requested range not satisfiable.
500 Server Error
GET, POST, PUT
Error Message
Internal server error.
501 Not Implemented
POST, PUT, DELETE
Error Message
Requested HTTP operation not supported.
502 Bad Gateway
GET, POST, PUT, DELETE
Error Message
Backend service failure (data store failure).
505
GET
Error Message
HTTP version not supported.
Hope this helps. Original post: REST API Status Codes and Complete REST API Tutorial with Status Codes.
Thank
AmitHi, I am trying to PUT to update contact info and I get following error:
2015-01-16 11:00:17,970 INFO [main] oracle.eloqua.connector.eloqua.EloquaConnector.putWithBasicAuth(97) | accessHttpsPut.url=https://secure.eloqua.com/API/REST/2.0//data/contact/7606838, text={"id":"7606838","accountName":"openIdStr001","emailAddress":"[email protected]","type":"Contact"}
2015-01-16 11:00:18,931 ERROR [main] oracle.eloqua.connector.eloqua.EloquaConnector.putWithBasicAuth(140) | ClientProtocolException
org.apache.http.client.HttpResponseException: Request is malformed.
Is there any idea?
Thanks so much.
Sincerely. -
Content-Lenght header on html pages
I hope this is a simple one, and I am just lame in my web searching skills, but how would one get the Sun One Web Server 6.1 to include the Content-Length response header on requests for html pages?
If I curl the web server for say an exe file (application\octet-stream mime type) the server sends me a Contetn-Length header in the response. When I curl a html page from the same server there is no Content-Length header in the response.
I have a developer that wants to use this header to determine if we need to delete the object from our CDN network, which by the way does provide the Content-Length response header on html pages.
Thanks in advance for any help on this.If there's no Content-Length header in the response when you request a .html file, server-parsed HTML has likely been enabled. When server-parsed HTML (aka SHTML or SSI) is enabled, the server parses the .html file and dynamically generates a response. When the response is dynamically generated, the server doesn't know how long the response will be until it has been completely generated. As a result, the server may omit the the Content-Length header.
You can disable server-parsed HTML in the administration server GUI. -
JavaMail doesn't send Bcc + Content-Length
Hello Folks,
I recently found a String ignoreList in the class SMTPTransport which contains already "Bcc" and "contentLength":
/* 141 */ private static final String[] ignoreList = { "Bcc", "Content-Length" };
Thus I wanted to know whether sending Emails without the Bcc and Content-Length Header is on purpose or meant to be fixed in the following version.
Thanks in advance!
Greetings,
DanielIt's on purpose.
The whole point of Bcc is that it's not included in the headers of the sent message, despite the message being sent to the Bcc'ed recipients.
Content-Length is not relevant for a message in transit, it's only used in some Unix mailbox formats. -
Dear Java Experts,
I am writing a program which communicates with a servlet. The OutputStream of the URLConnection is get and I write a String to it. However, when I use the getContentLength Method to check, the length is always 4. In turn, the server-side always gets an EOFException.
The display output of my program is:
Invoker: DATA LENGTH = 357
Invoker: CONTENT_LENGTH = 4
The code statement is:
URL servletUrl = null;
URLConnection conn = null;
ObjectInputStream ois = null;
ObjectOutputStream oos = null;
int backcmd = -1;
Object ret = null;
URL servletUrl = new URL(location);
conn = servletUrl.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "application/octet-stream");
BufferedOutputStream connos = new BufferedOutputStream(conn.getOutputStream());
System.out.println("Invoker: DATA LENGTH = "+myString.length());
connos.write(myString.getBytes());
connos.flush();
connos.close();
int length = conn.getContentLength();
System.out.println("Invoker: CONTENT_LENGTH = "+length);
Please help.
RayAccording to the JDK Help - URLConnection.getContentLenght() returns the length of the content-length header field
This does NOT sound like what you are trying to get
perhaps you should try something like
int length = ((String)conn.getContent()).length();
Maybe you are looking for
-
my webcam in my Dell Inspiron 3521 was working fine with Windows 8. After updating to Windows 8.1 the Webcam in my computer is gone and the 'Imaging devices' is missing in the Device Manager. how can I get the Webcam back? thank you very much.
-
Hello Experts Iam encountering a problem when iam executing a simulation in RESCSE. There is a message that option rate is missing for the specified settlement period. I have configured option rate for the commercial objects to be 16.5% according to
-
Hi all... I'm running dreamweaver cs4. I'm having a problem with a div... I inserted a "draw ap div tag" and entered my text and it is exactly where I want it.. However, when I preview it in my browser, the text has moved... why would this happen?? T
-
What is the difference between a migration and upgrade in Oracle? Please explain
-
UPGRADING TO EITHER TIGER OR LEOPARD FROM PANTHER 10.3.9
Dear gentleman i have doubt and i would like to have your experienced point of view>< if i upgrade from my PANTHER 10.3.9 to either Tiger or Leopard>< will i have same background failures i am having >< or the new upgrade os ( tiger / leopard) so