ADF - Re - opening download distributes not appropriate content.
I use JDeveloper 11.1.1.4 and have a problem with downloading files. The first time that a user clicks on the link command, the file opens correctly. If the user closes the file open in the application, and clicks the same link to re - open the file (in this case a PDF) they Gets an error from Adobe indicating the uploaded file is not a supported or because file type that the file has been damaged. It seems that he reads every file. I use a similar code to other posts I've found on this discussion forum. I'm adding my java code below and the Weblogic Server log messages and would appreciate all good advice for this problem.import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;
import oracle.jbo.domain.BlobDomain;
public class Download {
public Download() {
super();
}
public void downloadFile(FacesContext facesContext,
OutputStream outputStream) throws IOException {
String mime = null;
ExternalContext extContext = facesContext.getExternalContext();
DCBindingContainer dc =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
System.out.println("Before getting iterator");
DCIteratorBinding iter =
dc.findIteratorBinding("hot_biz_docs_view1Iterator");
ViewObject vo = iter.getViewObject();
Row r = vo.getCurrentRow();
BlobDomain bDomain = (BlobDomain)r.getAttribute("Document");
String file = r.getAttribute("FileName").toString();
String ext = file.toLowerCase();
System.out.println("In MimeTypes:" + ext);
if (ext.endsWith(".pdf")) {
mime = "application/PDF";
} else if (ext.endsWith(".doc")) {
mime = "application/msword";
} else if (ext.endsWith(".docx")) {
mime =
"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
} else if (ext.endsWith(".xls")) {
mime = "application/vnd.ms-excel";
} else if (ext.endsWith(".xls")) {
mime =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
} else if (ext.endsWith(".txt")) {
mime = "text/plain";
} else if (ext.endsWith(".ppt")) {
mime = "application/vnd.ms-powerpoint";
} else if (ext.endsWith(".rar")) {
mime = "application/octet-stream";
} else if (ext.endsWith(".zip")) {
mime = "application/zip";
} else if (ext.endsWith(".jpg")) {
mime = "image/jpeg";
}
Long length = bDomain.getLength();
HttpServletResponse response =
(HttpServletResponse)extContext.getResponse();
response.setHeader("Content-Disposition",
"attachment;filename=\"" + file + "\"");
response.setContentLength((int)length.intValue());
System.out.println(mime);
response.setContentType(mime);
InputStream in = null;
try {
in = bDomain.getBinaryStream();
outputStream = response.getOutputStream();
byte[] buf = new byte[1024];
int count;
while ((count = in.read(buf)) >= 0) {
outputStream.write(buf, 0, count);
if (count <= 0) {
System.out.println("End if while loop");
break;
}
}
} catch (IOException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
in.close();
outputStream.flush();
outputStream.close();
response.flushBuffer();
facesContext.responseComplete();
System.out.println("closed and responseComplete");
}
< 22 August 2011 4:11:11 PM CDT > < error > < HTTP > < BEA-101083 > < connection failure.java.net.ProtocolException: did not said Content-Length, wrote: '0' bytes instead of a stated: '3544' bytes.
at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:446)
at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1432)
at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1511)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1462)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
Truncated. check the log file full stacktrace
>
< 22 August 2011 4:11:11 PM CDT > < HTTP > < BEA-101104 > < error > < execution of the Servlet in the servlet context "[ServletContext@33250642[app:LIB_Test module: root LIB_Test-LibTestVC-context-path: / LIB_Test-LibTestVC-context-root spec-version: 2.5] ' failed, java.net.ProtocolException: did not said Content-Length, wrote: '0' bytes instead of a said: '3544' bytes...
java.net.ProtocolException: did not said Content-Length, wrote: '0' bytes instead of a stated: '3544' bytes.
at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:446)
at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1432)
at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1511)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1462)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
Truncated. check the log file full stacktrace
>
You must close the stream blob, otherwise that you can't read.
Use the method blob.closeInputStream () on your blob.
Timo
Tags: Java
Similar Questions
-
Need help to understand why my downloaded PDF doc displays "Please wait...". If this message is not finally replaced with the appropriate content... "after that I have already downloaded the version update for windows 10
This is because the PDF file is not be open in Acrobat or Reader, but by the browser which is unable to handle the specific PDF content.
If you use Firefox or Chrome, follow these steps: https://helpx.adobe.com/livecycle/kb/xfa-forms-firefox-chrome.html
-
PDF files are downloading and not opening
Firefox on Android has been; When you view a web page with a link to a file PDF would simply be you prompt to open it with, choose Acrobat and opening.
Now, the ALWAYS PDF downloads - is not acceptable.
It was working as expected 2 weeks or if there are; What has changed?
PS - I tried the Add on PDF which kind of works, but the performance is so bad, that it is unusable.
Hello PatL1701, automatic execution of downloaded content has been deleted because of security concerns: www.androidpolice.com/2013/09/11/security-firefox-for-android-can-be-tricked-into-automatically-downloading-and-executing-malicious-code/
-
Hi all
I am facing the error when I open my ADF UI below. I had installed all the required patches on weblogic ADFUI and MLR - 6 patch for COE. It's the same error discussed in this thread -
but I think have everything installed the patched. Y at - it a particular fix that brings FrameworkFolder from 2.0 to 2.1.< 24 April 2015 18:11:26 IST > < error > < oracle.wcc.adf.logger.Exception > < WCC-ADF-10900 > < required feature is not enabled on the content Serv WebCenter
ER instance "Default". Feature: 'FrameworkFolders', at least level: 2.1
oracle.wcc.adf.model.WccException: WCC-ADF-10900: necessary feature is not enabled on the content server instance 'Default' WebCenter Feature: "setting
orkFolders's, at least level: 2.1
Kind regards
-Anand
I assume that you missed this step:
1. after changing properties of connection CRMI - save
Now comes the key:
2. Select the bean Select viz ADFConnections - operations - parent. Here, select Invoke.
The action is logged and persistent changes to the MDS repository on successfully executing step 2, otherwise the changes will not be saved and will be reset to restart the server after original values.
Now restart the servers of the ADF managed, test and report the results.
Thank you
Srinath
-
Print Help does not help me open downloads on my android
Cannot retrieve or open downloads. Printed text does not help because I can't find the button
You are able to use the menu in Firefox for Android? On some devices, a stack of 3 points appears at the right end of the address bar to display the menu, while on other devices, there is a button to (touch capacitive) of 'material' to the camera button at the home to show the menus.
In the menu, you should find under Tools downloads.
In addition, by default, Firefox uses the download system folder, so if you open the download application that comes with your device you should find them there (in general).
A little luck?
-
message "memory insufficient avialiable for install this book" while downloading ePub not purchased icloud iPad 9.3.1. Have lots of storage. Even on iPhone. Opens fine on the MacBook.
Same thing for me with an iPad Pro 9 "128 new and empty GB with storage iCloud 1For, for every ePub not apple. €1000 and can not read books?
What else?
-
I'm unable to open downloads. They appear in the download window, but when I click it, nothing happens. I also tried to open their files saved without success. It is a new problem. I've never had this problem before. The fie I open is a .exe file.
This has happened
Don't know how many times
== I tried to download a file today.
I do not have the option ' save to ' and 'Browse' in the download window. However, I was able to download and open the file today. Do not know why. I worked to solve several problems on my computer and all I did is to have fixed this problem as well. It's a mystery!
Thanks for all the tips. Great forum. Have a great day!
-
Downloads are not open and asking to go in the trash. This is the message I get "is damaged and cannot be opened. You must move it to the trash. "What's happening?
Please set change the Gatekeeper
Allow the applications downloaded from: Mac App Store and identified developers
-
Cannot open pdf files not able to download adobe. I disabled the security and still unable to download adobe
Hi MarciaRicci,
1. what operating system is installed on the computer?
2. What is the exact error message you get when you try to download?
3. what web browser do you use to download adobe?
4. what happens when you try to open pdf files?
5. you are trying to open online pdf files or pdf files on the computer?I suggest you try the steps from the following link:
The problems of download
http://kb2.Adobe.com/CPS/152/tn_15296.htmlInstallation problems | Flash Player | Windows
http://kb2.Adobe.com/CPS/191/tn_19166.htmlChoppy us back with more information.
-
can not open/download pdf file attachment to window live mail
Please repost your question in the Group of Discussion Windows live Mail to: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.windows.live.mail.desktop where this product experts will be more than happy to help you with your problem.
Good luck (and sorry to send yet another forum, but it is one that will help you.
Good luck!
Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.
-
recover a file 'open' enamel, but not "downloaded".
Hello-
I opened internet Explorer, went to an email that had an attached Microsoft word document. I have 'open' the document, but does not "Download", then worked on it for a few hours and press on record several times. I can't find.
Is not in the "recent" topics under the Start button.
This isn't in the "open recent" topics in microsoft word.
This isn't on my desk, not in the folder my documents, not in my downloads folder.
It does not appear when I run a search in the Start button.
Normally, I téléchargerais a documement but I accidentally hit open and do not think it would be a big deal. I guess its hidden somewhere in a temporary folder.
Help, please. Thank you!
Hello
When you had opened the attachment file in Microsoft Word and worked on it instead of click Save, then temporarily open file will be saved in the location of the Temporary Internet Files folder; provided if you had clicked on record, so that you will get an option record under to select the save location of the destination folder and accessing the save location, you can see the Microsoft Word document.
1. which web e-mail or mail client you are referring to? What is Microsoft Outlook or Hotmail?
2. who is the provider of mail service?
3. what exactly happened when you click Save?
Follow the steps in the location of the files below link to view temporary Internet.
View temporary Internet files:
http://Windows.Microsoft.com/en-in/Windows7/view-temporary-Internet-files
I hope this helps.
-
I can not open/download files attached on all sites
IM', unable to open/download attachments from various sites IE extensions of Hotmail and Centrelink. Very frustrating, even if I can do it on my other PC! I'm missing something here?
Hello
1. were you able to open/download the files attached successfully earlier?
2. what happens when you try to open or download attachments?
3. do you get any error code or error message?
4. have you made changes on the computer before this problem?
5 is this problem confined to specific files or all files?
6. what browser you use to download/open the attachments?
If you use Internet Explorer, then I you suggest to disable add-ons, then try to download and extract.
Follow the steps to disable add-ons:
a. open Internet Explorer
b. press the ALT key, and then click Tools.
c. click on Manage Add-ons.
d. disable add-ons by clicking on them one at a time to highlight and then click Disable.
Note: to re-enable the modules one by one and check with what add-on, you get this error message. Disable Add-ons will not cause any problem.
If disabling add0one did not help, then it would be better to post the same question in Windows Live Hotmail forums to get help.
http://answers.Microsoft.com/en-us/windowslive/Forum/Hotmail
Please respond with more information so that we could help you more.
-
I have Win 7 with Service Pack 1. I have "updated my Open Office 3.3 to 3.4 and now Win 7 search and options DO NOT locate my document content indexing more? I contacted the support of Open Office: http://user.services.openoffice.org/en/forum/viewtopic.php?f=15&t=55483
They claim that: "indexing and search in Windows 7 are performed by Windows 7", so there is a problem with Win 7 search and indexing options.
I checked the indexing options in Windows 7 and the "Index Properties and content of the file" is selected for ALL the 'odt' as well as all the files 'o'.
I set up a test document: I put only one word "Wednesday" in the Open Office text document, saved and it called "text". I am looking for Wednesday and the search comes up with two other documents containing the word Wednesday in them, but not the Test document?
I just discovered something. When I did the 'Test' experience above, the file was saved in format 'odt' a:. I changed it to a ".doc" file and it now appears in the search results. As mentioned above, I've changed ALL the files starting with the letter 'o' in Indexing Options > Advanced Options > Types of files to the article: 'properties Index and contents of the file. The description of filter for files 'odt' comes back as: "IFilter shop OpenOffice IFilter" where as 'doc' filter is listed as a: «Filter Microsoft Office» Is it a "Boutique OpenOffice IFilter IFilter: issue" Blocking "the documents appear in the search results? If so, how should I do (I mean in addition to all the documents 'odt' replacing 'doc'?
Just to clarify: document names 'odt' come to a search, but not the content document.
Hello
Method 1: Run the following fix - it:
Difficulty of Windows Desktop Search when it crashes or not display results:
http://support.Microsoft.com/mats/windows_search/en-us
Method 2: Restore the computer to a date when it was working fine before:
Reference:
System Restore: frequently asked questions:
http://Windows.Microsoft.com/en-us/Windows7/system-restore-frequently-asked-questions
-
just downloaded adobe first, but the open choice is not activated so I can start using the application. What should I do?
Hello
Please try to open the application in the menu (Windows) programs / library of the application (Mac) and see if it works.
You can also check the following links
Apps Control Panel does not show installed Adobe Creative Cloud applications
Desktop application Adobe Creative Cloud lists uninstalled Adobe apps as up-to-date
-
My download does not open. It says archive file not avaliabe. How can must have to operate, I solve this
On Mac OS, there is a .dmg file. Under Windows, there is a .exe file and possibly a .7z file.
Download the two files in the same folder and run the Exe file to start the installation
Instructions to start the installer after downloading
(for products purchased on the Adobe.com store)
Guinot
Maybe you are looking for
-
Firefox 26.0
-
Re: Satellite A660-07U - Windows64 cannot connect to Facebook
I have recently upgraded to windows 64-bit. I used the recovery toshiba (from disk) media. the only thing is that I can't connect to facebook with "_keep me connected IN2" checked. _If I uncheck the box that I can log IN2. I am very curoous to find o
-
HP Pavilion dv6-black screen only works with the external monitor
I discovered that my screen was not turn on yesterday when I tried to turn on my laptop. Fortunately I was able to plug it into an external monitor with a VGA cable and I have a monitor in my office, but I can not really be restricted to my living ro
-
How to burn or mount the iso on usb?
Hi, I have a problem with the vista update that made my laptop unusable. I've done everything I can do, but nothing seems to work. my last resort is to use the vista recovery disk, but I don't have a dvd player. so I thought using a bootable USB key.
-
I want to create a backup of my computer which is on a XP on drive C on a disc. How to do that. Other windows which have as one of its system files.