Java Code - to upload files on https

Hello:
I am really looking for a bean to upload and download flat files to a https server.
Thanks.

Sanju,
If you wann to do transformation, Validation..That is message mappping & if you get a text file then You need to use FCC in Sender File adapter,  If the Target system requires a different format example as text file and different structure then you need to use FCC in SOAP adapter and post to the webserver,  If no message mapping needed then you can go ahead without FCC and drop the file with the help of HTTP / SOAP Adapter
Cheers
Agasthuri

Similar Messages

  • Java code to upload file and place file on server directory

    Hi,
    Am a relatively new Java programmer. I need to add a functionality to a struts web application to allow users UPLOAD a file (using browse button). I need to read the file name,, do some other checks and eventually, upload the file to a server directory.
    When do I start? Any good website for source code examples?
    Thanks

    See this http://jakarta.apache.org/commons/fileupload/

  • Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout).

    Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.

    Hi,
    You didnt mention which version of IWS. follow these steps.
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    Regards
    T.Raghulan
    [email protected]

  • Uploading files through HTTP

    Hi All.
    I am trying to create a moduel for uploading files to a web server using HTTP multipart encripted request.
    Well, generally it works, but it is very very slow, and sometimes, with large files (15 MB and above) it gets stuck !
    I did not write the multipart parser myself, but downloaded it, and I tried several implementations, and they all have the same problems.
    I am using IBM WebSphere (3.5.5) with IBM HTTP Server as app/web server.
    My questions are:
    1.
    ===
    Is the HTTP protocol should be able to upload file with (theoretically) any size (maybe I am trying to do something that is not possible...) ?
    2.
    ===
    Does the servlet engines receive ALL the request object before handling the servlets methods (i.e. wll the file be uploaded to the memory first, and only then can be written to the disk) ?
    Thanks a lot, Udi

    The code for client is :
         fileinputstream = new FileInputStream(s);
                   byte abyte0[] = new byte[fileinputstream.available()];
                   fileinputstream.read(abyte0);
                   URL url = new URL(s2 + "artius.rgm.rater.RaterServlet");
                   URLConnection urlconnection = url.openConnection();
                   urlconnection.setDoOutput(true);
                   urlconnection.setDoInput(true);
                   urlconnection.setUseCaches(false);
                   objectoutputstream = new ObjectOutputStream(urlconnection.getOutputStream());
                   objectoutputstream.writeObject(abyte0);
                   objectoutputstream.close();
                   objectinputstream = new ObjectInputStream(urlconnection.getInputStream());
                   Hashtable hashtable = (Hashtable)objectinputstream.readObject();
    And server is :
              out = new ObjectOutputStream(response.getOutputStream());
              in =new ObjectInputStream(request.getInputStream());
              byte[] b =(byte[])in.readObject(); //hangs here.
    Pradeep

  • Java code to list files in Windows O/S by FIFO sequence

    Hi,
    I am new to java and working on a project which needs to list files from Windows O/S by FIFO sequence.
    Here is the scenario,
    One of the application logs/stores files in Windows System. After that files has to be moved to another files system on AS/400 by FIFO sequence.
    I need to write java program to list files in Windows (by FIFO) and then move to different application running on AS/400.
    I am using java.io.File class and method list() and could able to list all files. But, not able to list files by FIFO sequence.
    I would appreciate to receive any thoughts implementing FIFO for listing files using java.
    Thanks,
    Siva

    Duplicate post, replied to here:
    http://forum.java.sun.com/thread.jspa?threadID=5169767&messageID=9652068#9652068

  • Java code to exe-file

    Hi!
    I hope someone can help me with this.
    I have done a program in Java-code and now I want to convert that code into an executable file that can be run on most computers. I have tried to convert the code to a JAR-file and then, using the program JSmooth, transform it into a exe-file. But, sad to say...it failed. Is JSmooth the way to do it or is there another better way?
    Hope to get an answer.. :)
    / Berenur

    add a Main-Class: yourclass line to a manifest file, and specify your manifest when you create the jar.
    I.e.
    Manifest-Version: 1.4
    Main-Class: myClassSave that to manifest.mf or something like that.
    Then,
    jar -cvfm MyJar.jar manifest.mf [all files to include in jar]
    done.

  • Java Code to Download files

    Dear Sir,
    I would kindly like to know whether any java classes are existent ,avliable for download ,which would provide the facility to
    download a file from the server to the client machine.If not,kindly advise me on how to perform this task and kindly send me sample code if possible.
    With regards
    Santosh.

    www.jscape.com has a great library for FTP as well as HTTP protocols. The library contains support for a host of other protocols as well. A trial version is available, but the licensed version is $95. I tried to find freeware for this type of functionality but none of them were very good. Shelling out the $95 ended up being a wise decision.
    JP

  • Running the Java Code from Batch File

    Hi All,
    I have run a code sucessfully in Eclipse and it uses Logging API from Java
    When i try running the same program from batch file it throws error
    java.io.IOException: Couldn't get lock for log\Properties_Log_16Sep2009_150229
    at java.util.logging.FileHandler.openFiles(Unknown Source)
    at java.util.logging.FileHandler.<init>(Unknown Source)
    at com.adidas.SPM.LogMessage.<init>(LogMessage.java:26)
    at com.adidas.SPM.MainApplication.initialize(MainApplication.java:51)
    at com.adidas.SPM.MainApplication.main(MainApplication.java:102)
    I am working on a windows systems the folder log has all the permission i have provided with all
    Not sure why the code runs like this
    The batch file is like below
    set CURR_DIR=%CD%
    cd %CURR_DIR%\bin
    %CURR_DIR%\jre6\bin\java -classpath .;%CURR_DIR%\lib\FirstProject.jar com.test.MainApplication
    echo %ERRORLEVEL% The Error Level
    echo SUCCESS
    GOTO END
    :END
    pause
    Rgds
    Aditya

    Vikash.SunJava wrote:
    According to me the problem is that there are many instances trying to access the same property file. Nothing wrong with that since they only are reading it.
    The best way to do is that create a schedular in Windows that runs at some predefined interval (say 1 minute).Huh?
    >
    What will happen is if your program runs for more than a minute even then the new process will not start until old process is autaomatically killed. Please do not check this option if you want the program to exit normally.
    If the Task is still running stop at this time
    O_o

  • Java code for Compressing files in UNIX

    Hi ,
    i am trying to compress files in unix but not seeing any change in size of packed file .any code please help.

    Hi ,
    i am trying to compress files in unix but not seeing
    any change in size of packed file .any code please
    help.Does this question have anything to with Java whatsoever? If so how? And what types of files are you attempting to compress? If you are trying to compress a compress format the size difference will be... small if not actually worse then the originial.

  • File upload using java code ....?

    Hi,
    I have used below code to upload files into Tomcat server .
    Every thing is working fine , but when i try to upload file size more then 400kb i am getting the Exception is :::::::::*javax.servlet.ServletException: javax/servlet/jsp/SkipPageException*
    Let me know if any thing require to change on the below code to upload big size files..
    String contentType = request.getContentType();
    //out.println("Content type is :: " +contentType);
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
    DataInputStream in = new DataInputStream(request.getInputStream());
    int formDataLength = request.getContentLength();
    byte dataBytes[] = new byte[formDataLength];
              int byteRead = 0;
              int totalBytesRead = 0;
              while (totalBytesRead < formDataLength) {
              byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
              totalBytesRead += byteRead;
              int lastIndex = contentType.lastIndexOf("=");
              String boundary = contentType.substring(lastIndex + 1,contentType.length());
              //out.println(boundary);
              String file = new String(dataBytes);
    saveFile="C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\StorageFolder\\Files\\UserData\\"+saveFile;
                        int pos;
                        pos = file.indexOf("filename=\"");
                        pos = file.indexOf("\n", pos) + 1;
                        pos = file.indexOf("\n", pos) + 1;
                        pos = file.indexOf("\n", pos) + 1;
                        int boundaryLocation = file.indexOf(boundary, pos) - 4;
                        int startPos = ((file.substring(0, pos)).getBytes()).length;
                        int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
                        FileOutputStream fileOut = new FileOutputStream(saveFile);
                        //fileOut.write(dataBytes);
                        fileOut.write(dataBytes, startPos, (endPos - startPos));
                        fileOut.flush();
                        fileOut.close();
    The above code is working file for small file size only ,if the file size exceeds 400kb then it will through a
    *javax.servlet.ServletException: javax/servlet/jsp/SkipPageException          *

    Hi,
    yeah i have included above code in Try{} catch {} block even though i am getting an exception if file size exceeds 400kb . ..
    when i try to upload a file more than 400kb i am getting the below exception .
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: javax/servlet/jsp/SkipPageException
    *     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)*
    *     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*

  • Java code to convert XML file to ISO XML format

    Hi Experts,
    I need to convert an XML file to ISO Xml format using Java code.I dont have any idea about the ISO XML format.I searched but what i am getting is ISO is an encoding in XML.
    It will be very helpful if any one can give me a sample ISO XML file, and any way around to carry out the required conversion.
    Thanks .
    Anika

    Hi,
    For ISO encoding you need the XML file to be converted with below providing the encoding paramter as ISO. for e.g.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    instead of
    <?xml version="1.0" encoding="UTF-8"?>
    this can be possible with using XML encoders.
    Refer XML encoding--> http://www.w3schools.com/XML/xml_encoding.asp
    Refer Java Code with uasage of XMLEncoder
    http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLEncoder.html
    Thanks
    Swarup

  • Upload file using jsp

    hi all i am trying a code that uploads file to the server using jsp the code goes like this
    <%@ page import = "java.io.*" %>
    <%
    String contentType = request.getContentType();
    String file = "";
    String saveFile = "";
    FileOutputStream fileOut = null;
    if((contentType!=null)&&(contentType.indexOf("multipart/form-data")>=0))
       DataInputStream in = new DataInputStream(request.getInputStream());
       int formDataLength = request.getContentLength();
       byte dataBytes[] = new byte[formDataLength];
       int byteRead = 0;
       int totalBytesRead = 0;
       while(totalBytesRead<formDataLength)
          byteRead = in.read(dataBytes,totalBytesRead,formDataLength);
          totalBytesRead +=byteRead;
       try
          file = new String(dataBytes);
          saveFile= file.substring(file.indexOf("filename=\"")+10);
          saveFile = saveFile.substring(0,saveFile.indexOf("\n"));
          saveFile =
          saveFile.substring(saveFile.lastIndexOf("/")+1,saveFile.indexOf("\""));
          int lastIndex = contentType.lastIndexOf("=");
          String boundary =
          contentType.substring(lastIndex+1,contentType.length());
          int pos;
          pos = file.indexOf("filename=/" +1);
          pos = file.indexOf("\n",pos)+1;
          pos = file.indexOf("\n",pos)+1;
          pos = file.indexOf("\n",pos)+1;
          int boundaryLocation = file.indexOf(boundary,pos) - 4;
          int startPos = ((file.substring(0,pos)).getBytes()).length;
          int endPos =
          ((file.substring(0,boundaryLocation)).getBytes()).length;
          String folder = "07ics01/jsp/"; //is this the folder where i intend to save the file?
          fileOut = new FileOutputStream(folder + saveFile);
          fileOut.write(dataBytes);
          fileOut.write(dataBytes,startPos,(endPos-startPos));
          fileOut.flush();
       catch(Exception e)
          out.println(e);
       finally
          try
             fileOut.close();
          catch(Exception err)
    %> i have been trying to use this code but i can't understand the code. is String folder = "07ics01/jsp" the folder where i intend to save the page on the server? because when i do that i get an exception like
    java.io.FileNotFoundException: 07ics01/jsp/C:\Documents and Settings\s9sharma\Desktop\tt\commons-digester-1.8\commons-digester-1.8.jar (No such file or directory) where C:\Documents and Settings\s9sharma\Desktop\tt\commons-digester-1.8\commons-digester-1.8.jar is the file i am trying to upload to the directory 07ics01/jsp which is a unix directory.
    Can anyone please help..

    So you've copypasted this code from somwhere and are expecting our support on the code, instead of the author's support? That's sad.
    I recommend you to look to the Apache Commons FileUpload API [1]. Then you don't need to write (or copypaste) a multipart parser yourself. Putting business logic in JSP files is also bad practice by the way. Use Java classes for it instead (Servlets, Filters, Beans, Utilityclasses, etc).
    [1] http://commons.apache.org/fileupload/
    To understand the actual code, it might help a lot to first read and understand the HTML spec about multipart request data and read the API documentations of the Java classes involved, e.g. the java.io API.

  • I finding a upload file tutorials

    i finding a upload file tutorials: write a java program can upload file to host (server side script: php)
    anyone show me?
    thanks.

    http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/examples/MultipartFileUploadApp.java?revision=480424&view=markup
    This is sample code for the HttpClient API, found here:
    http://jakarta.apache.org/commons/httpclient/

  • How do i open a source code in zip file

    Hello! i"m having problems running my codes, i'm using windows and i'm having problems running the codes. At first i thought it was my codes, so i tried a friends code in a zip file and it still gives the same error: exception of in thread "main" java.lang.NoclassDef found error: Rewriter.
    Rewriter is the name of the Zip file after opening it, i saved it on my system. Can anyone be kind enough to teach me how to run a java code. i have jdk already installed on my system. Java is my dream and the book i'm reading is useless if i can't run the system in the book.

    I don't see where the zip file comes into it. If you are not familiar with compiling and running java codes, go through
    {color:0000ff}http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html{color}
    Click the link for your OS, and if you still have problems there's a link for "Common Problems (and Their Solutions)"
    Come back if you have a specific question about what you read there.
    db

  • How to get uploaded file details in custom page

    Hi,
    I need to navigate to custom page after multiple file upload and display details of file uploaded in the custom page.
    Is there any variable which indicates the files uploaded that can be used in my custom page?
    Thanks in advance,
    dhijit

    Hi,
    According to your description, you want to get uploaded file details after uploading the files in a custom page.
    I suggest you create an event receiver in the custom page so that you can get file details when the files are added to the document library.
    Here is a code snippet for your reference:
           public override void ItemAdded(SPItemEventProperties properties)
               base.ItemAdded(properties);
               string fileURL = properties.ListItem.Web.Url + "/" + properties.ListItem.File.Url;
    More information about how to create an event receiver:
    http://bramnuyts.be/2011/04/01/add-an-event-receiver-to-a-specific-list-programmatically/
    Here is a similar thread about get uploaded files field:
    http://social.technet.microsoft.com/Forums/en-US/ad447c63-158c-4d92-8354-7d7f5b18e517/how-to-get-the-fileid-of-upload-files?forum=sharepointdevelopmentprevious
    Best regards,
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

Maybe you are looking for

  • Calendar events do not appear in List view

    My events do not show up in List view, but are there in the Day and Month view. What could be causing this problem? (I used to be able to see all my events in List view.)

  • LaserJet Pro MFP M176n ePrint is not working

    I have problem with my printer. I cannot connect it to the ePrint service. The ePrint functions is turning on and off without my knowlegde. After enabling ePrint in web interface of the printer, printer does not printing information sheet. When I ent

  • Can renaming multiple times degrade a photo?

    Is there any chance that I might lose photo quality by renaming photos several different times (JPGs, NEFs or TIFFs) or by adding more keywords (using Bridge or any other browser) with either individual or batch renaming - without making any edits or

  • Performance_parameters_in 11r2

    Hi , We are planning to migrate from 10.2.0.3 to 11.2.0.2 enterprise . For this we have test setup of oracle 11.2.0.2 and we tried to run the reports(selects) on this new server. But reports on 11R2 are taking long time than existing 10.2.0.3 reports

  • Satellite Pro P100-327 (PSPA4E) - No Sound Following Win 7 Clean Install

    Hello, I have just clean installed Win 7 Home Premium (64 bit) on a Satellite Pro P100-327 (PSPA4E) which was purchased in November 2006. It was previously running XP. I never installed Vista though the laptop is badged Vista Capable. I followed the