Two different methods for downloading a file using URL...

I was just wondering if someone could shed some light on whether I should be downloading files using java.net.URL or java.net.URLConnection
Here are two ways that I have found to work (and yes I realize that one is outputting to a stream and the other is getting put into a StringBuffer):
      InputStream in = url.openStream();
      byte[] b = new byte[buffSize];
      fileOutStream = new FileOutputStream(fileToBeCreated);
      while ((bytesRead = in.read(b)) != -1){
        totalFileSize+=bytesRead;
        fileOutStream.write(b, 0, bytesRead);
      }and
      URLConnection _con = url.openConnection();
      in = new BufferedReader(new InputStreamReader(_con.getInputStream()));
      String inputLine;
      while ((inputLine = in.readLine()) != null){
          webPageStringBuff.append(inputLine+"\r\n");
      }In both of the above cases url is just a URL object that has already been instantiated with a valid URL.
So, just to re-iterate, I realize that the output portion of this code is doing something different (i.e. writing to a stream as opposed to appending to a StringBuffer) but I would like to know whether there is any reason to choose using the URLConnection to get the stream as opposed to using the URL to get the stream.
Thanks,
Tim

hi,
try out the following code
// Program: copyURL.java
// Author: Anil Hemrajani ([email protected])
// Purpose: Utility for copying files from the Internet to local disk
// Example: 1. java copyURL http://www.patriot.net/users/anil/resume/resume.gif
// 2. java copyURL http://www.ibm.com/index.html abcd.html
import java.net.*;
import java.io.*;
import java.util.Date;
import java.util.StringTokenizer;
class copyURL
public static void main(String args[])
if (args.length < 1)
System.err.println
("usage: java copyURL URL [LocalFile]");
System.exit(1);
try
URL url = new URL(args[0]);
System.out.println("Opening connection to " + args[0] + "...");
URLConnection urlC = url.openConnection();
// Copy resource to local file, use remote file
// if no local file name specified
InputStream is = url.openStream();
// Print info about resource
System.out.print("Copying resource (type: " +
urlC.getContentType());
Date date=new Date(urlC.getLastModified());
System.out.println(", modified on: " +
date.toLocaleString() + ")...");
System.out.flush();
FileOutputStream fos=null;
if (args.length < 2)
String localFile=null;
// Get only file name
StringTokenizer st=new StringTokenizer(url.getFile(), "/");
while (st.hasMoreTokens())
localFile=st.nextToken();
fos = new FileOutputStream(localFile);
else
fos = new FileOutputStream(args[1]);
int oneChar, count=0;
while ((oneChar=is.read()) != -1)
fos.write(oneChar);
count++;
is.close();
fos.close();
System.out.println(count + " byte(s) copied");
catch (MalformedURLException e)
{ System.err.println(e.toString()); }
catch (IOException e)
{ System.err.println(e.toString()); }
ok

Similar Messages

  • Happy Holidays.  I have Adobe Actobat 7.0 Standard for quite a while, and I'm happy with it. I use it for mainly filings at the federal court.  They require PDF.  I use two computers in two different states for work.  I realize my Adobe 7.1 is a few years

    .  I have Adobe Actobat 7.0 Standard for quite a while, and I'm happy with it. I use it for mainly filings at the federal court.  They require PDF.  I use two computers in two different states for work.  I realize my Adobe 7.1 is a few years old, but sometimes I have difficulty using it with the other days downloading a boarding pass, and e filing at the USDC. .  There's a problem with Adobe Flash, media, etc.  and other Adobe programs, (which I use for downloading boarding passes for airlines, etc.) so basically I have to delete these other Adobe programs, besides the Adobe Acrobat 7.0 Standard if I want to 7.0 Standard to work.  I periodically download the updates, but there's still a problem. My question is:  Can or should I purchase another program to update the present Adobe Acrobat 7.0 standard, or just buy a new program such as the Adobe 11?  Am I mistakenly doing something wrong, such as when I download?  I'm an old valued customer so I don't want to spend a lot of money since I am replacing my Dell XP for a new computer now, and my other computer is a Dell Vista.
    I'd appreciate your valued advice.

    If you are getting a new computer (for a PC it would have Win 7 or 8), then you will need to purchase XI if you wish to continue using Acrobat. Acrobat 7 is not compatible with these systems (and probably the same for MAC systems), though sometimes workarounds are possible, though not easy to use. I guess the answer is to buy the new version. Try http://www.adobe.com/products/catalog/software._sl_id-contentfilter_sl_catalog_sl_software _sl_mostpopular.html, click on the Buy for Acrobat, and then select the version you want.

  • Folder is empty on second computer. I have installed adobe CC on two different computers for same account so I can work at two different places. I uploaded files to it yesterday and I can't find it on the CC folder on second computer. What can I do?

    I have installed adobe CC on two different computers for same account so I can work at two different places. I uploaded files to it yesterday and I can't find it on the CC folder on second computer. What can I do?

    Hi DeafScientist,
    Please try the below mentioned links.
    Creative Cloud Help | Browse, sync, and manage assets
    Error: "Unable to sync files"
    Creative Cloud File Sync | Known issues
    Kindly revert if you are unable to sync files.
    Thanks,
    Atul Saini

  • Is there a way to have two different iTunes for two different iPhones on one Windows User account?

    Using Windows 7, iphone 4.
    I've read as many threads on these forums and as many kb's as I could find, but I sttill can't figure it out. I have 2 iPhones. Let's call them, "wife" and "hubby". I want to have two separate iTunes, one for each of the phones. Hubby is the Windoows User. I don't want to set up a different Windows User for wife.
    Hubby was the original iPhone. When I plug it in, iTunes recognized it has Hubby's iPhone. Then I unplug Hubby and close iTunes. I plug in Wife but iTunes stll comes up with Hubby under Devices and syncs Hubby's iTunes to Wife's iphone.
    I've tried using the shift key when I open iTunes to set up two separate .itl files to no avail.
    Is there a way to have two different iTunes for two different iPhones on one Windows User account?
    Thanks!

    What happens if you rename the iPhone "Wife" when it shows up as "Hubby", then choose a different set of apps/playlists to sync with? iTunes is supposed to be able to manage multiple devices, each with their own selection of content. Perhaps you "restored" "Wife" with a backup from "Hubby" when you first set things up which is now causing confusion.
    To create a new library press and hold down the shift key as you click the icon to start iTunes and keep holding shift until asked to choose or create a library. You need to use the same technique to switch back.
    tt2

  • DME Configuration - Two Payment Methods for One format

    Hi Experts,
    We have a DME formart which we have to use for two payment methods (Direct Debit and Direct Credit).
    The format should contain different values in the header for two different methods.
    How this can be done? I assume that this can be achieved with Condition tab but unable to understand how to maintain the conidtions.
    Ex: for Direct debit one of the value in the header should be 99 and for Direct credit the value should be 88.
    Please let me know if I need to provide further information.
    Regards,
    Surya

    Hi,
    You can create the coditional node (Create Atom) in the DME structure.
    For the first Atom, give the condition as
    Argument 1-1 = FPAYH
    Argument 1-2 = RZAWE
    Type               = 2
    Operator        = "="
    Argument 2-1 = your first payment method
    Argument 2-2 = blank
    Type = 1
    For the second Atom, give the condition as
    Argument 1-1 = FPAYH
    Argument 1-2 = RZAWE
    Type               = 2
    Operator        = "="
    Argument 2-1 = your second payment method
    Argument 2-2 = blank
    Type = 1
    Regards,
    Gaurav

  • Servlet for downloading a file

    i am writing a servlet for downloading a file on a GET action in the form..the web-xml is deployed correctly as far as i can interpret..bt i am encountering an error during the run time..
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    here is the log file..
    Jul 11, 2008 12:07:14 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet DwnFile threw exception
    java.lang.NullPointerException
         at com.example.web.dwnfile.doGet(dwnfile.java:17)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    it has some more content bt it is just the exceptions thrwn...
    and here is my *.java file*
    package com.example.web;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class dwnfile extends HttpServlet
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
    response.setContentType("/image/jpeg");
    ServletContext ctx=getServletContext();
    InputStream is=ctx.getResourceAsStream("/2004.jpeg");
    int read=0;
    byte[] bytes=new byte[1024];
    OutputStream os=response.getOutputStream();
    while ((read=is.read(bytes))!=-1)
    {os.write(bytes,0,read);
    os.flush();
    os.close();
    the bold line is whre the exception is pointing..i think..
    thanks in advance..
    Edited by: Sun_Rockz on Jul 10, 2008 7:13 PM

    response.setContentType("/image/jpeg");
    ServletContext ctx=getServletContext();
    InputStream is=ctx.getResourceAsStream("/2004.jpeg");there was an error in this part of code..the image extension of .jpeg is not allowed it seems..on changing it to jpg worked..and
    in the first line the contenttype mst not be preceded by a forward slash..
    now one more doubt relating to the same servlet..
    response.setContentType("application/x-zip");
    ServletContext ctx=getServletContext();
    InputStream is=ctx.getResourceAsStream("/servlet_spec.zip");
    if i keep this in my servlet the required action is taking place..i.e.i am gettin a download option bt the problem is tht the file is getting downloaded as a download.do file.....
    download.do is the url pattern tht i am using in my html web page..
    i tried replacing different types of allplications and files bt all are downloaded wit the same name. i.e. download.do
    so what do u think is reason behind this..
    thanks for all the replies.
    Edited by: Sun_Rockz on Jul 11, 2008 10:47 AM
    Edited by: Sun_Rockz on Jul 11, 2008 10:51 AM

  • Code for downloading a file

    Can some one provide me wit da code for downloadind a file.

    import com.jscape.inet.ftp.*;
    Establishing a connection
    In order to communicate with an FTP server you must first establish a network connection to the FTP server.
    // create Ftp instance with FTP hostname, username and password as arguments
    Ftp ftp = new Ftp("ftp.myserver.com","jsmith","secret");
    // establish connection
    ftp.connect();
    Perform a directory listing
    Once connected you may wish to perform a directory listing on the FTP server. The directory listing will return a relative listing of files and directories that are on the FTP server.
    // perform directory listing
    String listing = ftp.getDirListingAsString();
    // print directory listing to console
    System.out.println(listing);
    Alternatively you may use the getDirListing method. This method parses the results and returns a java.util.Enumeration of FtpFile. Using this method you may then iterate through the Enumeration and evaluate the contents of each file or directory programmatically. Note: This method is only for use by FTP servers which display directory listing using the UNIX or MS-DOS mode. For more information see the Ftp.getDirListing method in the JavaDoc.
    // Perform directory listing
    Enumeration files = ftp.getDirListing();
    // iterate through listing
    while(files.hasMoreElements()) {
    FtpFile file = (FtpFile)files.nextElement();
    // only print files that are directories;
    if(file.isDirectory()) {
    System.out.println(file.getName());
    Changing your local directory
    Your local directory is the directory that you wish to use when transferring files to / from the FTP server. By default this is the directory that the Java executable was invoked from. To change this setting simply invoke the setLocalDir method.
    // change local directory
    ftp.setLocalDir(new File("C:/tmp");
    Changing your remote directory
    Your remote directory represents your current directory on the FTP server. By default this is the directory that is assigned when first logging into the FTP server. To change this setting simply invoke the setDir method.
    // Change remote directory
    ftp.setDir("temp");
    Setting the transfer mode
    Files transferred to / from an FTP server may be transmitted using binary or ASCII modes. The binary transfer mode transfers files without performing any conversion. Binary transfer is generally used for files that are binary in nature such as images, executables etc. The ASCII transfer mode transfers files converting new line characters to the system dependent new line character used by the operating system performing the transfer request. ASCII transfer mode is generally used when downloading text only files. The default transfer mode is binary.
    // change transfer mode to ASCII
    ftp.setAscii();
    // change transfer mode to binary
    ftp.setBinary();
    Downloading files
    To download a file simple invoke the download method. File will be transferred using the current transfer mode and saved in your local directory. See Setting the transfer mode and Changing your local directory for more information. There are other methods that you may use for downloading files. These include methods for downloading entire directories and downloading files matching a regular expression. For more information see the JavaDoc.
    // download a file named test.txt in remote directory
    ftp.download("test.txt");
    Uploading files
    To upload a file simply invoke the upload method. File will be transferred using the current transfer mode and saved in your remote directory. See Setting the transfer mode and Changing your remote directory for more information. There are other methods that you may use for uploading files. These include methods for uploading entire directories and uploading files matching a regular expression. For more information see the JavaDoc.
    // upload a file named test.txt in c:/tmp directory
    ftp.upload(new File("c:/tmp/test.txt"));
    Releasing the connection
    Once you have finished sending your email message(s) it is important that you disconnect from the FTP server. This is easily accomplished using the code below.
    // release the FTP server connection
    ftp.disconnect();
    With Regards,
    Dipak Sodani.

  • Can I have two different libraries for iTunes?

    I would like to have two different libraries for iTunes. How can I do it?
    Regards.

    To create or access a second (or more) library, hold down the Option key (or Shift key in Windows) when launching iTunes 7. In the resulting dialogue you will get the option to create a new library or navigate to the other Library: Using multiple iTunes libraries -Mac
    Note: You can only have one Library open at a time and iTunes will default to the last library opened if you don't use the keyboard command to choose one.

  • What are the two different rules for organizational data determination

    What are the two different rules for organizational data determination???

    Hi
    1) Rule type Responsibilities
    want to determine organizational data for individual responsibilities
    have not created an organizational model but want to create one
    have a lot of organizational units and must only assign a few attributes
    2) Rule type Organizational Model
    You would use rule resolution using organizational model if you
    have created an organizational model or have distributed a plan to SAP CRM and also want to use this for determining organizational data
    assign a lot of attributes to the organizational units and these are to be evaluated
    Regards
    Manohar

  • How to create a method for reading a file

    i tried to make it as static method for reading a file and
    then to return string
    is this code correct?
              public static String fileMaterial(String fileName)
                   fileReader = new BufferedReader(new FileReader(fileName));
                   info = fileReader.readLine();
                   while(school != null)     {                    
                        return info;
                        info = fileReader.readLine();

    I created a class you might want to look at. I come from a world of C and love fgets() and other FILE stream functions. I created a class that uses the Java I/O buts to the calling application behaves like fgets and such. The block of code where I do the calling in the calling program even looks like C. In my class I capture almost all errors and set error buffers to the errors. The calling program looks at the return to see if it succedded or errored.
    BuffIO new = BuffIO.fopen("fiilename", "r");
    String s;
    if((s = new.fgets()) == null)
    System.err.println("error reading file: " + new.ferror());
    That would be waht the calling program does

  • How do I download PDF files using Safari.  All I get is a black screen.

    How do I download PDF files using Safari.  All I get is a black screen.

    Back up all data.
    Quit Safari. In the Finder, select Go ▹ Go to Folder... from the menu bar, or press the key combination shift-command-G. Copy the line of text below into the box that opens, and press return:
    /Library/Internet Plug-ins
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then launch Safari and test.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • I can not download any files using Safari ? when I choose to download application file the URL include the file name and stop responding. Any help??

    I can not download any files using Safari ? when I choose to download application file the URL include the file name and stop responding. Any help??

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box.
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem(s)?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. The Guest login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, you can’t boot in safe mode.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

  • Can any one help me to download a file using struts2

    can any send me a sample program to download a file using struts2
    regards
    saradhi

    i cannot find it in google please help me by sending a link or a code
    thanking u
    regards saradhi
    while i am executing this code i am getting error
    javax.servlet.ServletException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
         org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
         org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
         org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)
         org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
         com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
         com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
         org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
         com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
         com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
         org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
         org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
         org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17
    and my code is as follows
    download action.java
    package com.mss.mirage;
    import java.io.InputStream;
    import org.apache.struts2.ServletActionContext;
    import com.opensymphony.xwork2.ActionInvocation;
    import com.opensymphony.xwork2.Action;
    * Demonstrates file resource download.
    * Set filePath to the local file resource to download,
    * relative to the application root ("/images/struts.gif").
    public class FileDownloadAction implements Action {
    private String inputPath;
    private String contentType;
    private String inputName;
    private String contentDisposition;
    private String fileId;
    private int bufferSize;
    public void setInputPath(String value) {
    inputPath = value;
    public InputStream getInputStream() throws Exception {
    return ServletActionContext.getServletContext().getResourceAsStream(getInputPath());
    public String execute() throws Exception {
    return SUCCESS;
    public String getInputPath() {
    return inputPath;
    public String getContentType() {
    return contentType;
    public void setContentType(String contentType) {
    this.contentType = contentType;
    public String getInputName() {
    return inputName;
    public void setInputName(String inputName) {
    this.inputName = inputName;
    public String getContentDisposition() {
    return contentDisposition;
    public void setContentDisposition(String contentDisposition) {
    this.contentDisposition = contentDisposition;
    public String getFileId() {
    return fileId;
    public void setFileId(String fileId) {
    this.fileId = fileId;
    public int getBufferSize() {
    return bufferSize;
    public void setBufferSize(int bufferSize) {
    this.bufferSize = bufferSize;
    download.jsp
    <%@ taglib prefix="s" uri="/struts-tags" %>
    <html>
    <head>
    <title>Showcase - Fileupload</title>
    </head>
    <body>
    <h1>File Download Example</h1>
    <ul>
    <li>
    <s:url id="url" action="download2"/><s:a href="%{url}">Download ZIP file.</s:a>
    The browser should prompt for a location to save the ZIP file.
    </li>
    </ul>
    </body>
    </html>
    struts.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
    <package name="download" extends="struts-default" namespace="/download">
    <default-action-ref name="download"/>
    <action name="download2" class="com.mss.mirage.FileDownloadAction">
    <param name="inputPath">"c:\images\struts.zip"</param>
    <result name="success" type="stream">
    <param name="contentType">application/zip</param>
    <param name="inputName">inputStream</param>
    <param name="contentDisposition">filename="c:\images\struts.zip"</param>
    <param name="bufferSize">4096</param>
    </result>
    </action>
    </package>
    </struts>

  • CST% should calculated two different rate for C Form /  Without C Form

    Hi,
    How we can assign to one CST% condition against two different rates for C Form / Without C Form for same Plant/Vendor/Material.
    My scenario is, we have purchased the Material for one plant from Vendor, but Vendor has given the material against C Form or Without C Form not fixed.
    We have used to Plant/Material/Vendor Key combination for updating CST (JVCS) 2% condition through FV11. And created two PO for C Form 2% & second 5% Without C Form but it is showing 2% in both PO as per maintained in condition.
    When we have received the material against without C Form 5%, changed in CST (JVCS) condition 5% and do the MIGO and same think do for against C Form.
    How to resolve this type problem without changing?
    But it is possible in SD their maintaining Price Group; same is it possible in MM.
    Devendra

    Hi,
    1 .How we can assign to one CST% condition against two different rates for C Form / Without C Form for same Plant/Vendor/Material.
    As suggested by the Pankaj you need to create 2 tax code i.e. one with C form & other as Without C form having appropriate Percentage maintained in the condition record ( FV11 )
    My scenario is, we have purchased the Material for one plant from Vendor, but Vendor has given the material against C Form or Without C Form not fixed.
    We have used to Plant/Material/Vendor Key combination for updating CST (JVCS) 2% condition through FV11. And created two PO for C Form 2% & second 5% Without C Form but it is showing 2% in both PO as per maintained in condition.
    As you may have maintained single tax code with the 2% condition record so same % flows in both PO , Use 2 sperate tax code it will resolve the issue.
    Regards
    Mascot.

  • What's the best method for securely erasing files on OS X?

    Hello,
    I'm looking for a method for securely erasing files on OS X.
    I know OS X has the srm command doable in the Terminal, but this command uses the 35-pass Gutmann algorithm which is, to me, obsolete as of now.
    Do you know modern methods for securely erasing files?

    baltwo wrote:
    Thanks. It didn't show up with a [redacted] search.
    There, fixed it for you.

Maybe you are looking for

  • AlarmEvent Browser will not print to a htm report.

    I am running multiple simultaneous batch processes that print a report at the end of each batch.  In addition to the process data I want to include a summary of the alarms that occured during that batch.  I tried usin gthe AlarmEvent Browser object b

  • Exporting iTunes Music to Ext HDD

    Hi all, I just bought a Seagate 300GB Ext HDD with Firewire. My intention is to move all songs from iTunes currently in my iMac HDD to the Seagate Ext HDD. Thereafter, I hope to access my iTunes from this ext HDD. Pse advise on a. Whether there is a

  • What's the best way to send multiple objects with a message?

    I'm considering using an ObjectMessage and storing a Map as the object. Each           of the objects I need to send will be bound in this Map. Is this the correct           approach?           Also, if this is the correct approach, where should I st

  • Consolidating contacts to manage with iPhone

    Help! The facts: I'm a former Palm user, and my primary address book/phone list is on my Palm Desktop (several hundred records) (these can be exported as *.csv, .txt or vCard) I've also been using an Android phone for a while, and have about 150-200

  • Unable to Install BlazeDS on Grails 1.3.7

    Hi, Can someone please help me install BlazeDS plugin on Grails, i am stuck at this point. Please help me resolve this issue. I have posted all the details at StackOverFlow.com http://bit.ly/qMpA1T but have not got any response so far. I am also past