Servlet Response different from IE to Netscape
Using the HttpServletResponse to send either PDF or xls file directly to the user. It is working fine in Netscape. However, in IE, the browser will display error on opening the file (either PDT or xls) when traffic is heavy on the site. Why is that?
The server is Websphere.
The code is:
ServletOutputStream outStream = null;
try {
if (fileType.equals("xls"))
response.setContentType("application/vnd.ms-excel");
else if (fileType.equals("pdf"))
response.setContentType("application/pdf");
response.setContentLength(report.length);
outStream = response.getOutputStream();
outStream.write(report);
} catch (Exception e4) {
System.out.println("Can not output"+e4.getMessage());
finally {
if (outStream != null) {
try {outStream.close();}catch(Exception e5){}
}
Using the HttpServletResponse to send either PDF or
xls file directly to the user. It is working fine in
Netscape. However, in IE, the browser will display
error on opening the fileInternet Explorer has a known bug that will prevent it from displaying a PDF file correctly even when setting the content-type properly.
The only fix I've ever known is to physically append a ".pdf" to the URL requesting a dynamically generated PDF file.
Example:
If this URL gives you a successfully dynamically generated PDF file in Netscape:
http://localhost/somecontext/servletToGeneratePDF?parm=1&parm=2
then this URL should be used with Internet Explorer (which will work for all browsers):
http://localhost/somecontext/servletToGeneratePDF?parm=1&parm=2&.pdf
Similar Messages
-
Response status has number of values different from request
Hi,
I'm getting the following message when I try to refresh a worksheet from a workbook.
"Response status has number of values different from request"
Has anyone encountered this message? what does this mean?
I'm using SmartView 11.1.2.1.103 on HFM 11.1.2.1.103 environment.
Thanks in advance,
RamTry removing external calculations (/$C$1) and see if the error message changes.
-
Hi all,
I encountered the following 2 servlet problems in WLS 6.0/ 6.1:
1. Processing concurrent POST requests
WLS seems to disallow concurrent executions of any servlet's doPost servlet method.
When two clients attempt to send a request to a servlet using POST, the socond
one
is blocked until the first customer is served. In essence, the servlet ends up
operating in
1-user mode. I just learned from Jervis Liu that the problem is solved in WLS6.0
if you disable http-keepalive.
For WLS 6.1 a partial workaround is to make the servlet work in a single-thread
mode (by implementing the javax.servlet.SingleThreadModel interface). In this
case,
WLS dispatches concurrent requests to different instances of the servlet.
This doesn't completely eliminate the problem - still only one customer can be
connected at a time. The improvement is that once the first customer is disconnects,
the second can be served even if the doPost method for the first has not finished
yet.
2. Flushing the response buffer in WLS 6.1
The servlet response buffer is not flushed automatically until doPost ends, unless
you
explicitly call response.flushBuffer(). Closing the output stream doesn't flush
the
buffer as per the documentation.
I see that other people are experiencing the same problems.
Has anyone found any solutions/workarounds or at least an explanation.
Any input would be highly appreciated.
Thanks in advance.
Samuel Kounev
Thanks for replying. Here my answers:
> Did you mark your doPost as synchronized?
No.
> Also, try testing w/ native i/o vs not ... is there a difference?
With native I/O turned off I get a little lower performance, but the
difference is not too big.
Best,
Samuel Kounev
> Peace,
>
> --
> Cameron Purdy
> Tangosol Inc.
> << Tangosol Server: How Weblogic applications are customized >>
> << Download now from http://www.tangosol.com/download.jsp >>
>
> "Samuel Kounev" <[email protected]> wrote in message
> news:[email protected]...
> >
> > Hi all,
> >
> > I encountered the following 2 servlet problems in WLS 6.0/ 6.1:
> >
> > 1. Processing concurrent POST requests
> >
> > WLS seems to disallow concurrent executions of any servlet's doPost
> servlet method.
> >
> > When two clients attempt to send a request to a servlet using POST, the
> socond
> > one
> > is blocked until the first customer is served. In essence, the servlet
> ends up
> > operating in
> > 1-user mode. I just learned from Jervis Liu that the problem is solved in
> WLS6.0
> >
> > if you disable http-keepalive.
> >
> > For WLS 6.1 a partial workaround is to make the servlet work in a
> single-thread
> >
> > mode (by implementing the javax.servlet.SingleThreadModel interface). In
> this
> > case,
> > WLS dispatches concurrent requests to different instances of the servlet.
> > This doesn't completely eliminate the problem - still only one customer
> can be
> >
> > connected at a time. The improvement is that once the first customer is
> disconnects,
> > the second can be served even if the doPost method for the first has not
> finished
> > yet.
> >
> > 2. Flushing the response buffer in WLS 6.1
> > The servlet response buffer is not flushed automatically until doPost
> ends, unless
> > you
> > explicitly call response.flushBuffer(). Closing the output stream doesn't
> flush
> > the
> > buffer as per the documentation.
> >
> > I see that other people are experiencing the same problems.
> >
> > Has anyone found any solutions/workarounds or at least an explanation.
> > Any input would be highly appreciated.
> >
> > Thanks in advance.
> >
> > Samuel Kounev
=====================================================
Samuel D. Kounev
Darmstadt University of Technology
Department of Computer Science
DVS1 - Databases & Distributed Systems Group
Tel: +49 (6151) 16-6231
Fax: +49 (6151) 16-6229
E-mail: mailto:[email protected]
http://www.dvs1.informatik.tu-darmstadt.de
http://skounev.cjb.net
=====================================================
[att1.html]
-
Transfer the response data from response field of a webservice.
Hi Experts,
I am working on Consuming the webservice in the Adobe Form,
My requirement is like i have to populate different set of fields from the responses i get from the webservice, based on the click of different buttons.
Say i have to populate Fields f1 & f2, if Button B1 is pressed, and f3 & f4 if Button B2 is pressed.
Hope i have made my requirement till now.
Now i have written the script to shift the data from the fields generated from WebService to the fields where i actually require the data i.e. f1 & f2 in the above case at teh "validate" event of the response fields from webservice.
but it always gives me some popup stating this field's validate failed, which should not be there.
So, any help from you that give me a solution that shifts the data immediately on the population of response fields wihout a popup, would be helpful and highly appreciated.
Thanks,
AmitaHi,
Consider that you have three fields "f1", "f2", "f3" and want to populate the data in the fields "f2" and "f3" based on the value entered in the field "f1" through webservice.
So write the JavaScript Coding in the "Change" Event of the field "f1" for eg.
var cURL = 'http://webservice';
var service = SOAP.connect(cURL);
xfa.connectionSet.DataConnectionName.execute(0);
and there itself after the above script write the other validations for fields "f2" and "f3" and populate the values to the respective fields.
For Binding to the respective fields: go to the field object pallete and in binding tab define the binding of webservice in the "Import/Export" binding at the Last.
And if you want to do any validations for the fields "f2" and "f3" then define two more fields like "hiddenf2" and "hiddenf3" and do make the presence of these fields to hidden and do specify the binding of webservice and after the JavaScript WebService call populate do the required validations and after that populate the values to the respective fields.
Regards
Pradeep Goli -
Design view different from preview - is muse still in beta testing
I have limited experience with coding html so when Adobe released Muse, I was excited. However, I'm wondering if they released it too soon and/or if it is still in beta testing - which I don't mind but would like to know what I'm dealing with. It seems to have a lot of quirks - mainly that the design view is sometimes different from the preveiw or browser view. I spent over an hour yesterday trying to get text boxes to line up. If there is an hidden element affecting the text boxes, I don't see it. I have moved everything off the page and >selected all
and nothing shows up.
Other issues:
Sometimes paragraph styles do not apply - even though in design view it looks like they do.
Can't find a way to center text vetically in a text box other than adjusting the leading?
Can't find a way to organize assets into folders?
When an object is selected on a page, is there a way to indicate that that is the object in the assests panel?
Sometimes the padding options are not available for no apparent reason.
Thanks to the Adobe staff for being responsive as these issues are discovered. One staff member in particular was very helpful as I was trying to get hyperlinks to work right. But I am STILL having a problem. The text box and the text itself have the hyperlink style applied but as you can see on the Dardanelle and Chad Lawson Trio hyperlinks - the style did not take even though they are both hyperlinks that point to the right URL. -- geezermusicclub is the correct link for Dardanelle - It's difficult to see in the pic, but the Dardanelle and Chad Lawson text color is black but the hyperlink text style is brown.
Persoanlly, I feel Adobe should lower the subcription price while all these kinks are being worked out in Muse. In a way, subscribers are **** a LOT of beta testing for Adobe. Not only are we not being compensated for that, we are having to pay for an application that has too many wrinkles.Murray and David: it worked! It is a rare and joyous experience to have a straightforward solution to the sorts of problems I come up with (including other realms). But I have to say that with HTML and CSS (and hence with Dreamweaver), solutions to difficulties have seemed within easier reach than in other parts of the computer world.
By the way, I wanted to choose "correct answer" for both your posts, but after making the first click it was no longer available for the remaining post--so I typed "helpful" even though that one was correct too.
Thanks again.
--Paul -
Vendor in Invoice different from Vendor in PO....How?
Hi all,
I got a situation where users are entering invoices for Vendors that are different from the PO. The Partner Function IP (Invoicing Party) of the Vendor in the PO is set as the same main vendor.
Example:
PO issues to Vendor 1000 (POrg 1000, CoCd 1000). Part Func IP(Inv Party) is also 1000
Invoice is created for Vendor 9000 (also maintained in CoCd1000 and POrg 1000) by user. Vendor 9000 is not used in any partner functions of Vendor 1000.
How is this possible in SAP ?
Any idea?
The only way I can think of is that the users are chaning partner functions.
Urgent.
Thanks in advance for any quick response.hi
As i belive you can change the vendor account code while doing the trax MIRO in the details tab there Invoicing Patner can be changed as we know that the goods supplier can be diffrent from the party which is raising the invoice against the goods supplied.
Regards
Sujoy -
Weblogic 12c Servlet Response - Special characters show up as question mark
My web app is running on Weblogic 12c (12.1.1) using WebWork + Hibernate. The program streams data (bytes making up a pdf) from a CLOB in an Oracle Database to the AsciiStream of the servlet output response. No exceptions are thrown, but the generated pdf contains blank pages. Comparing the bytes of the generated pdf, special characters are showing up as question marks.
Some of the bytes read in from the database contain 8 bits (correct data), but the bytes that the servlet return contain only 7 (all bytes with 8 bits become "1111111"). The number of bytes returned from the servlet is correct.
Code:
//Response is HttpServletResponse
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=\"test.pdf\"");
out = response.getOutputStream();
byte[] buf = new byte[16 * 1024];
InputStream in = clob.getAsciiStream();
int size = -1;
while ((size = in.read(buf)) != -1){
// buf contains the correct data
out.write(buf, 0, size);
// other exception handling code, etc
out.flush();
out.close();
"Correct" pdf byte example:
10011100
10011101
1010111
1001011
1101111
11011011
Incorrect pdf byte example:
111111
111111
1010111
1001011
1101111
111111
I have verified that the data read from the CLOB in the database IS correct. My guess is that the Weblogic server has some strange servlet settings that causes the bytes to be written to the servlet output stream incorrectly, or a character encoding issue. Any ideas?
Edited by: 944705 on Jul 26, 2012 10:17 AMSolution found, I'll post the work around to those who might encounter the same problem.
Somewhere in the layers of technology (webwork or weblogic I'd guess), the servlet response is encoded into UTF-8 regardless. The encoding in the database was ISO-8859-1. Sending ISO encoded bytes by UTF-8 caused the conflicting character codes (anything above 127) to show up as undefined.
The fix is to decode the input byte array into ISO-8859 string, then encode that string into UTF-8, which can be send by Weblogic.
isoConvert = new String(buf, "ISO-8859-1");
out.write(isoConvert.getBytes("UTF-8"), 0, isoConvert.getBytes("UTF-8").length); -
Adjusting the reason-phrase in servlet response
Hi-
We've recently run into a problem with a service provider that is requiring the response code of one of our servlets to be 'HTTP/1.1 200 OK' - i.e. the Reason-Phrase has to be equal to 'OK'. It appears that the Servlet implementation (we are using Tomcat - I'm not sure if that matters) is leaving off the 'OK' altogether.
Now - the RFC for HTTP makes it perfectly clear that it is legal to leave off the Reason-Phrase altogether (which is what Servlet appears to be doing). I'm banging my head against the provider (which is Verisign) trying to get them to fix their non-standard implementation, but in the meantime, I'm losing sales.
Is there a way to get a specific reason-phrase in the HTTP response header from a servlet?
Is there any way to create the entire response myself? i.e. I can just emit the entire header, including the HTTP/1.1 200 OK line myself instead of relying on the underlying Servlet to handle the implementation.
I'm dying here - any help would be greatly appreciated.
Thanks!
- Kevin
PS - the service in question is Verisign's credit card processing service. They upgraded their application server last night, and our ecommerce has been dead ever since (it's actually worse than that - they are sending me the POST that says that the transaction was succesful, then they are going back and voiding out the transaction - this means that I'm sending out licenses to folks who aren't being charged for them). If you are using any of Verisign's credit card processing facilities, I STRONGLY encourage you to test everything out and make sure you aren't getting messed over.Thanks for your response. Unfortunately, I do not believe that the setHeader() method will do what I need.
The setHeader method sets a header value. What I need to set is not a header value - it is the first line of the response header itself.
For example, the following is the entire response that is sent by my servlet:
HTTP/1.1 200
Server: Microsoft-IIS/5.0
Date: Wed, 16 Mar 2005 20:02:40 GMT
Content-Type: text/plain
Content-Length: 0
In the above, the Server, Date, Content-Type and Content-Length lines refer to header values (which can be set using setHeader).
What I need to change is the very first line - i.e. I need it to read 'HTTP/1.1 200 OK'.
Anyone else have any thoughts?
Maybe I need to deploy a Servlet using GenericServlet as the base class, then generate all of the headers manually?
Thanks!
- K
>>
this is from the api docs
setHeader
public void setHeader(java.lang.String name,
java.lang.String value)Sets a
ng.String value)Sets a response header with the given
name and value. If the header had already been
set, the new value overwrites the previous
one.
thanks,
ram. -
Calling a servlets multiple times from a servlet
Hi All,
Advanced Thanks,
I have a servlet which calls another servlet to display some records. Second servlet will access some data from XML files and forwards to a JSP file. What i want is I need to call the second servlet multiple times from the the first servlet. I used RequestDispatcher to call the servlet but I can call only one time after a an exceptions is occurred like cannot forward after response is committed.
I need this scenario in the saem way because each time second servlet is called I am forwarding response to user each time records are accessed based on the request value.
request.getRequestDispatcher("sample").forward(request, response);
Any one please give me a suggestion?
Thanks in advanceWhat are those servlets supposed to do? Sounds like that they are doing too much, e.g. acting like business classes or utility classes or so. Refactor your code.
-
IOException - WEB8001 - when writing to servlet response outputstream
I am attempting to port a Java servlet application from iws 6.0 to 6.1, sp2, but am encountering IOExceptions during load testing.
The servlet composes its response in a character array, and then calls the following method to write the characters to the servlet response object:
static void writeResponse( HttpServletResponse response, char[] chars, String charset ) throws IOException {
OutputStreamWriter writer =
new OutputStreamWriter( response.getOutputStream(), charset );
char[] buffer = new char[8192];
CharArrayReader reader = new CharArrayReader( chars );
int read = 0;
while(( read = reader.read( buffer, 0, 8192 )) > -1 )
writer.write( buffer, 0, read );
writer.close();
}Under moderate load (2-4 simultaneous connections), an IOException will sometimes be thrown. The stack dump is:
java.io.IOException: WEB8001: Write failed
at com.iplanet.ias.web.connector.nsapi.NSAPIConnector.write(NSAPIConnector.java:750)
at com.iplanet.ias.web.connector.nsapi.NSAPIResponseStream.write(NSAPIResponseStream.java:74)
at org.apache.catalina.connector.ResponseBase.flushBuffer(ResponseBase.java:765)
at org.apache.catalina.connector.HttpResponseBase.flushBuffer(HttpResponseBase.java:779)
at com.iplanet.ias.web.connector.nsapi.NSAPIResponse.flushBuffer(NSAPIResponse.java:127)
at org.apache.catalina.connector.ResponseBase.write(ResponseBase.java:738)
at org.apache.catalina.connector.ResponseStream.write(ResponseStream.java:325)
at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:395)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:191)
at eng.pubs.servlet.DocServlet.writeResponse(DocServlet.java:1034)The exception is not thrown consistently for any given URL, but appears to be random. When run under iws 6.0, the exceptions do not occur at all. Most of the time, the method will have written 32K
of data when the exception is thrown.
Any clues about how I might debug this?What are you using as your test client?The test client is WebStone 1.0. WebStone always downloads the whole response, and reports the size of the response in bytes. From this I can see that when the IO exception occurs, webstone is unable to read the whole response, as it reports a smaller size.
So, I do not think the problem is that the client has prematurely aborted its download. WebStone doesn't work that way. I think something has gone awry on the server side, and this worries me. -
Account assignment for group asset is different from that in asset
Dear experts,
I have creted one main asset . and i have created group asset. and my main asset class and group asset class are both are different.If i continue that error assets are shoud be craeted .but the depreciation key and usefull life and ordinary depreciation will going and it's showing grey.
My question at the time of assighning the group asset for the particular assets the below error is comming.
Account assignment for group asset is different from that in asset
Message no. AA810
Diagnosis
The account allocation 14000 of the group asset 140000001 0 is different from account allocation 1000 of the asset.
System Response
This error needs to be corrected for balance sheet valuation (usually determined in depreciation area 01). For all other depreciation areas, this is only a warning you should check.
Procedure
Check your entry. When an individual asset has a different account assignment than the group asset, it is not possible to reconcile the individual asset to the group asset in reporting by means of accounts.
kindly help on this issue
regards
venkataswamyHi sudhakar
Thanks for your reply
1) for example i have buliding asset class and i have one group asset class.under the building asset account determination i have assighned the gl a/c for both b/s and book deprecitaion
In groups asset class also i have done same things. i have craeted asset under building asset class and created one asset under group assets.
then assighned the group asset to main assets. the error is comming like this Account assignment for group asset is different from that in asset
I have serched in sdn forum and service .sap.com . they are saying you can use same gl a/c for both asset class.for depreciation .i have tried this scenario. still i am getting the same error and same problem.
The most important thing is we are working on ECC 6 versions
sap note 76186.
Kindly help me
Regards
venkataswamy
Edited by: venkataswamy bathini on Jul 6, 2009 9:22 AM -
Delaying server [servlet] response
I'm using AJAX to update my div tag telling me if a username is valid / invalid. I've tried using wait(long) to pause the doGet thread , init thread and start thread but I get the following warning:
"Current thread not owner"
Who's the owner or "main" thread? I've also tried respone.wait and request.wait but the same exception is being thrown. Or is there a different way to delay the servlets response, or is this impossible with XML?
Thanks,
-ls6vit sort of sounds to me like you're used to thick
client gui programming - not sure why - but trying to
control the number of hits to a database in a web
app
by messing with javascript controls smells a bit (it
may be because of the nature of AJAX which I admit I
haven't used). Embedding in depth knowledge of the
back end in the front end is always a bit odd.
Would it not be better to implement this sort of
control (as in programmatic logic) server side ? Is
there a need for an AJAX request to hit a database
each time ? Might create an awful load (maybe this is
what you're addressing). Perhaps some cached server
side data structure might be of better use than
trying to hack the front end in this fashion.Basically I'm going to use AJAX for the its look and feel, even if it isn't necessary. The load was what the other person brought up so I thought I could test it by slowing things down because I can't simulate 1,000 simultaneous connections. I'm not really worried about it because I figured that AJAX might actually help an over loaded server. If the server is too busy to respond I would catch that in my JS and and try to request it again after a few seconds. req.open("GET", url2, true);
req.onreadystatechange = callback;
req.send(null);
function callback()
if (req.readyState == 4)
if (req.status == 200)
else if(){...}
}So if it comes back busy it'll wait before requesting the server again. I'll use DOM to manipulate the original login.html page so the input field will call a different JS function if it fails the first time. There's a bit more but that's what I'm going to try to do and hopefully bypassing this slow down testing won't matter. -
Response.sendRedirect() from doEndTag() method
Hi there,
I am trying to call response.sendRedirect("url") in a custom tag doEndTag() method but for or some reason I cannot get access to the javax.servlet.http.HttpServletResponse object where this method lives. Does anyone know how I can do a response.redirect from a doEndTag() method? I've searched the forum and it appears other people can do it but I'm not sure how?
I can get access to javax.servlet.ServletResponse object by using pageContext.getResponse() but that doesn't give me the response.sendRedirect method. Can anyone help? What am I doing wrong?
Thanks for your help.
Cheers,
Brent.you can pass the response object as argument to your
method..Thanks for your response!
Unfortunately I can't change the doEndTag() method parameters as doEndTag() is defined in the Tag interface. But if you mean pass the response object as an attribute of the tag i suppse that is possible.
However, that's pretty close to the hack I currently have to work around this problem except I'm putting the response object in a request attribute in the page and then retrieving it in the doEndTag() method.
But I am after something a little cleaner than either of these options..... I'm hoping I can just get the response object from another object I have access to. Any more thoughts? -
Staging different from target giving error
Hi Friends.
when i am making staging different from target its giving error not enough privillege to create table.
What changes i should do so that my IKM will work.
Thanks in advance for the help.
LinkanWow
Thank you very much for such quick response.I have privillege to create table,view,..... in my staging area not on target. I had asked DBA but he denided to give create privillege in target.Its only in my staging schema.
I will try to change the schema & will check if its working or not.
Thank you very much again. -
Agent version differs from LMService
Hi ,
I am connecting a NW 7.31 Java system with solman 7.1 SP10 with SMD diagnostic agent for Manage system config set up
I have installed the SMD agent and connected with central SLD & solman.
In the agent connectivity it can be seen that the diagnostic agent is in pending status with the message " 7.10.1.0.2011070611153 Agent version differs from LMService"
what could be the reason and what is LMService here.
The system kernel version is 720_EXT.
Please guide and provide a solution
Thanks in advanceHi Daniel,
Can you check LM-Service SP and Patch level.
Also Refer the guided process as per these 2 KBAs.
1962333 - Responsibility of individual steps in transaction SOLMAN_SETUP
1931100 - "Agent version differs from LMService" Error in Solution Manager 7.1 Agent Administration
Divyanshu
Maybe you are looking for
-
Apple TV on 5508 Guest/BYOD WLAN
Currently our Guest and employee BYOD clients get dropped on to the same vlan. Guest is an open wlan, and BYOD is doing 802.1X with PEAP. We are wanting to allow access to Apple TV devices for both guest and BYOD clients which are on the same vlan/
-
Process to run queries against 0FIGL_V10
Hi, I'm working on New GL Accounting and successfully populated data into 0FIGL_O10 then to 0FIGL_C10 and executed standard queries. My problem is with the virtual cube 0FIGL_V10 and it's standard queries. What is process i have to perform, before ex
-
How to clean tablew rows in ADF 10g (Not 11g)
Hi !. My problem is that I was moved to a project in my company where we are developing with ADF 10.1.3.4.0 and EJB and I can't find the way to empty the rows from my table when the page loads... I know how to do it n 11g but not in this one... I wil
-
Shopping cart having purchase organization problem
Dear Experts, We are working on classic sceanario with SRM 5.0 integrated with ECC 6.0. While creating shopping cart for direct material we are having an error message as "System SRDCLNT110 (SRM system) of purch. organization Central Purchasing (purc
-
After upgrading to iOS5 all the pictures in my camera roll are gone. Please help.
I synced my phone through itunes prior to upgrading to iOS5. Then the upgrade also backed up the phone. Upon the upgrade completing I was browsing through my phone and noticed that all the photos that were in my camera roll are nowhere to be found. C