Applet Java communication

I'm passing parameters from an applet to a servlet. This servlet takes these values and create a file and write values to the file.
My applet code:
java.net.URL host = this.getCodeBase();
java.net.HttpURLConnection hConn = null;
java.io.DataInputStream din= null;
java.io.DataOutputStream dout = null;
java.net.URL servURL=null;
try {
servURL=new java.net.URL("http://localhost:8084/marks/createMarks");
} catch (MalformedURLException ex) {
javax.swing.JOptionPane.showMessageDialog(getContentPane(),ex.getMessage(),"URL Error",javax.swing.JOptionPane.ERROR_MESSAGE);
javax.swing.JOptionPane.showMessageDialog(getContentPane(),servURL.toString(),"Mark Listener URL",javax.swing.JOptionPane.INFORMATION_MESSAGE);
try {
hConn = (HttpURLConnection) servURL.openConnection();
hConn.setRequestMethod("POST");
} catch (IOException ex) {
javax.swing.JOptionPane.showMessageDialog(getContentPane(),ex.getLocalizedMessage(),"URL Connection",javax.swing.JOptionPane.ERROR_MESSAGE);
hConn.setDoInput(true);
hConn.setDoOutput(true);
hConn.setUseCaches(false);
hConn.setRequestProperty("Content-Type", "text/plain");
try {
dout = new java.io.DataOutputStream(hConn.getOutputStream());
} catch (IOException ex) {
javax.swing.JOptionPane.showMessageDialog(getContentPane(),ex.getLocalizedMessage(),"URL Outputstream",javax.swing.JOptionPane.ERROR_MESSAGE);
String content = null;
try {
content = "addr=" + java.net.URLEncoder.encode(address,"UTF-8") +
"pno=" + java.net.URLEncoder.encode(String.valueOf(CURR_PAGE),"UTF-8") +
"x1=" + java.net.URLEncoder.encode(String.valueOf(finalX),"UTF-8") +
"y1=" + java.net.URLEncoder.encode(String.valueOf(finalY),"UTF-8") +
"x2=" + java.net.URLEncoder.encode(String.valueOf(width),"UTF-8") +
"y2=" + java.net.URLEncoder.encode(String.valueOf(height),"UTF-8")+
"text=" + java.net.URLEncoder.encode(String.valueOf(text),"UTF-8") ;
} catch (UnsupportedEncodingException ex) {
javax.swing.JOptionPane.showMessageDialog(getContentPane(),ex.getLocalizedMessage(),"Unsupported Encoding",javax.swing.JOptionPane.ERROR_MESSAGE);
try {
dout.writeBytes(content);
dout.flush();
dout.close();
} catch (IOException ex) {
javax.swing.JOptionPane.showMessageDialog(getContentPane(),ex.getLocalizedMessage(),"Writing Content to Server",javax.swing.JOptionPane.ERROR_MESSAGE);
My servlet code:
String dirname = System.getProperty("user.home")+java.io.File.separator+"rahul1";
     File dir = new File(dirname);
     String content = null;
     String xs = "<start>";
     String ys = "<end>";
     if(!dir.exists() )
                    dir.mkdirs();
File f1 = new File(dir,fname);
     try {
                    String addr=request.getParameter("addr");
String pno=request.getParameter("pno");
String x1=request.getParameter("x1");
String y1=request.getParameter("y1");
String x2=request.getParameter("x2");
String y2=request.getParameter("y2");
String text=request.getParameter("text");
String content1=request.getParameter("content");
                    //BufferedWriter out = new BufferedWriter(new FileWriter(f1));
                    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f1)));
                    out.println(xs);
                    out.println(addr);
out.println(pno);
out.println(x1);
out.println(y1);
out.println(x2);
out.println(y2);
out.println(text);
out.println(content1);
                    out.println(ys);
out.flush();
                    out.close();
          catch (IOException e) {System.out.println("Error Writing File -> " + e.toString());     }
But my servlet is neither taking the values nor is it writing to files How can i get the values to servlet

yaa this solved my problem a little bit(now its
writing to the file, but null values its not taking
the values passed by applet. Is my approach right in
retrieving values?Retrieving looks fine, but look again at how you're sending them. You're not sending any delimiters, just a long string like this:
pno=ax1=by1=c
How would it know when pno ends and x1 starts? As far as it's concerned, you sent this as the "pno" parameter:
pno="ax1=by1=c"
You need to send linefeed delimeters between the parameters. Please go research the web on how to properly POST data.

Similar Messages

  • Asynchronous applet-servlet communication

    Hi all,
    I am trying to implement asynchronous applet-servlet communication and need your help. Anything would help(I tried with synchronous applet-servlet communication but doesn't solve my problem).
    Thanks,

    http://java.sun.com/docs/books/tutorial/networking/index.html
    You can open a socket connection. Bother the client and the server
    can have separate threads for reading and writing and that you gives you
    asynchronous communication. Later, if you think the server is generating
    too many threads and not scaling, you can use features of .java.nio to
    make it more scalable:
    java.nio.channels

  • Is there a good advanced review on applet-servlet communication

    I am working on a web application and unfortunately experiencing a lot of trouble trying to use an applet as front end which interacts with a couple of servlets running on Tomcat. I need to get data from one servlet and send data to another.
    There is a lot of messages posted in this and other forums about how to do this, but none of them got a response pointing to a useful advanced reference on this subject. I have reviewed some of the references given, but couldn't find a thorough detailed advanced reference on applet-servlet communication. For this I mean an exhaustive explanation of the mechanism of communication and when and when is neccesary to use each of the multiple configuration possibilities regarding content-type, message-length, request-method, connection settings, and so on.
    Would anybody be so kind to show me the right direction? As I read the (literally) hundreds of messages posted on this topic, I see this info as widely useful. Most of the topic tracks ends on void or with painful no-way sentences, and maybe many people is avoiding Java technology on web application because of this problem (development delays can abort a project).

    This sample chapter in Java developers' guide to Servlets and Jsp focuses on Applet-Servlet communication, is a pretty good one, and is free :
    http://www.javaranch.com/bunkhouse/samps/2809ch12.pdf
    As to an exhaustive & complete guide that covers absolutely everything, I may be wrong but I doubt you'll find anything like that...unless there is a book somewhere dedicated to the subject.

  • Applet-servlet communication, object serialization, problem

    hi,
    I encountered a problem with tomcat 5.5. Grazing the whole web i didn't find any solution (some guys are having the same problem but they also got no useful hint up to now). The problem is as follows:
    I try to build an applet-servlet communication using serialized objects. In my test scenario i write a serialized standard java object (e.g. a String object) onto the ObjectOutputStream of the applet/test-application (it doesn't matters wheter to use the first or the latter one for test cases) and the doPost method of the servlet reads the object from the ObjectInputStream. That works fine. But if i use customized objects (which should also work fine) the same code produces an classnotfound exception. When i try to read and cast the object:
    TestMessage e = (TestMessage)objin.readObject();
    java.lang.ClassNotFoundException: TestMessage
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ...That seems strange to me, because if i instantiate an object of the same customized class (TestMessage) in the servlet code, the webappclassloader doesn't have any problems loading and handling the class and the code works fine!
    The class is located in the web-inf/classes directory of the application. I've already tried to put the class (with and without the package structure) into the common/classes and server/classes directory, but the exception stays the same (I've also tried to build a jar and put it in the appropriate lib directories).
    I've also tried to catch a Throwable object in order to get information on the cause. But i get a "null" value (the docu says, that this will may be caused by an unknown error).
    I've also inspected the log files intensively. But they gave me no hint. Until now I've spend a lot of time on searching and messing around but i always get this classnotfound exception.
    I hope this is the right place to post this problem and i hope that there is anyone out there who can give me some hint on solving this problem.
    Kindly regards,
    Daniel

    hi, thanks for the reply,
    all my classes are in the web-inf/classes of the web-app and have an appropriate package structure. thus the TestMessage class is inside a package.
    i tried some names for the testclass but it didn't matter. the exception stays the same. I also tried to put the jar in the common/lib but the problem stays.
    Well the problem with loaded classes: As i mentioned in the post above i can instantiate an object of TestMessage in the code without any problems (so the classloader of my webapp should know the class!!)
    only when reading from the objectinputstream the classloader doesn't seem to know the class?? maybe theres a parent classloader resposible for that and doesn't know the class?
    strange behaviour...
    p.s. sending the same object from the servlet to the client works well
    regards
    daniel
    Message was edited by:
    theazazel

  • Applet/Servlet communication - StreamCorruptedException

    Hi, I'm having a problem when I try to connect to a servlet. I am using applet/servlet communication. The problem only occurs when I have lauched a crystal report via http in a new window.
    After the report is launched if I try to hit my servlet I get the following error:
    java.io.CorruptedStreamException: invalid stream header
    Not all crystal reports I launch cause this behavior but I can see nothing in the url I use to launch the report that is out of place or different than other reports.
    APPLET-SERVLET CONNECTION
    try {
    StringBuffer path = new StringBuffer();
    path.append(ip);
    path.append("servlet/DatabaseServlet?");
    path.append("option=getRecords&query=").append(URLEncoder.encode(query,"UTF-8"));
    URL url = new URL(path.toString());
    URLConnection servletConnection = url.openConnection();
    servletConnection.setUseCaches(false);
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setRequestProperty("Content-Type", "application/x-java-serialized-object");
    ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
    rc = (RecordCollection) inputFromServlet.readObject();
    inputFromServlet.close();
    } catch (Exception e) {
    e.printStackTrace();
    SERVLET CODE
    Forwards to doPost
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    System.out.println("session id: " + request.getSession().getId());
    this.doPost(request, response);
    LAUNCHING REPORT FROM APPLET
    try {
    String launchURL = host + directory + report + "?promptOnRefresh=0"+ "&" +
    authentication + "&" + key + "&" + startPeriods + "&" + reportYears + "&" + reportTitle + "&" endPeriods "&" + locations + "&" + reportPeriod + "&" + fiscalWeek + "&" + fiscalYear + "&" +time;
    context.showDocument(new URL(launchURL), "_blank");
    } catch (Exception ex) {
    ex.printStackTrace();
    SAMPLE URL THAT CAUSES PROBLEM
    http://localhost:113/Reports/OpenToBuy_3.class?promptOnRefresh=0&user0=rpuser&password0=er34sw1&[email protected]=rpuser&[email protected]=er34sw1&user0@sub2=rpuser&[email protected]=er34sw1&promptex-key="L","L1","ALL"&promptex-start="1"&promptex-years="2004","2004"&promptex-title="Report Title"&promptex-end="1"&promptex-locs="01","03","04","05"&promptex-period="Feb 2004 [04-01]"&promptex-cw="1"&promptex-cy="2004"&promptex-time=-2-52728"
    Everything works fine until I launch this report then I can no longer get data from my servlet. I thought the URL lenght for the report might be the problem but I lauch a report with a URL longer than the problem one and there I don't get the errors after. When I try to connect to the servlet the println statement in the doGet method of my servlet doesn't get printed so it's not even making it inside that method in the servlet.
    Anyone have any idea what could be causing this? Anyone have any ideas what would be causing this? I'm really stumped.

    I've seen this problem before. Because your accessing a complete URL (ie http://<host>:<port>/xxx), you are actually creating a new session. Whenever the applet opens a connection to a servlet it is running on it's own session not the same as the JSP. This is rather obvious since the Page and Applet are separate entities.
    Try sending authentication with the url. I think the syntax is:
    username:password@http://localhost/xxx
    However I'm not sure how well this might work for Tomcat. As for Java it may try and throw a MalformedURLException I would have to test it first - it's been a long time since I used this technique!
    Wish I could be more help,
    Anthony

  • Error running applet, java.lang.UnsatisfiedLinkError: enableModeless

    hi guys
    I write an applet with JDevloper 3.1 using Oracle's B4J to connect to oracle 8.1.5. In Jdev all works fine. After deploying with the wizard to a webserver und running the applet using JRE 1.2.2 i got the following exception:
    Opening http://test.woow.at/awork/oracle/dacf/control/ResTable_de_DE.class no proxy
    Opening http://test.woow.at/awork/oracle/dacf/control/ResTable_de_DE.properties no proxy
    Opening http://test.woow.at/awork/oracle/dacf/control/ResTable_de.class no proxy
    Opening http://test.woow.at/awork/oracle/dacf/control/ResTable_de.properties.class no proxy
    Opening http://test.woow.at/awork/borland/jbuilder/addin/VersionedAddin.class no proxy
    java.lang.UnsatisfiedLinkError: enableModeless
    at sun.beans.ole.OleEmbeddedFrame.modalityPushed(Unknown Source)
    at sun.beans.ole.ModalityListenerImpl.modalityPushed(Unknown Source)
    at sun.awt.windows.WToolkit$ModalityListenerList.modalityPushed(Unkown Source)
    at sun.awt.windows.ModalityEvent.dispatch(Unkown Source)
    at sun.awt.windows.WToolkit.notifyModalityChange(Unkown Source)
    at sun.awt.windows.WDialogPeer.show(Unkown Source)
    at sun.awt.Dialog.conditionalShow(Unkown Source)
    at sun.awt.Dialog.show(Unkown Source)
    at oracle.dacf.control.swing.LoginDlg.show(LoginDlg.java:503)
    at oracle.dacf.control.swing.LoginDlg.showDialog(LoginDlg.java:488)
    at package6.Applet1.init(Applet.java:290)
    at sun.applet.AppletPanel.run(Unkown Source)
    at java,lang.Thread.run(Unkown Source)
    any idea, thanx a lot
    Armin

    Armin,
    I haven't seen this one before.
    Is your browser set to run with German locale?
    Here is my standard reply for problems with applet deployment in 3.1. It is probably the case that some classes available in the JDeveloper environment were not deployed to your web server environment.
    Applet Deployment for JDev 3.1
    Deployment issues for client and server:
    1. Make sure you have the JDK 1.2 plugin installed on the client.
    2. If your webserver and database are not on the same machine, you will have to configure your applet
    differently, or install the Net8 Connection Manager. See the Oracle JDBC Developer's Guide for more
    information (exact location of applet info depends on which version of the DB).
    Creating your Applet within JDeveloper:
    1. Create a new workspace.
    2. Create a new Business Components project. You will define your data model and business logic in this
    project. This is effectively your middle tier, but can be deployed to any tier you choose. In this
    project you will use the Business Components wizard to create:
    a. entity objects for each of the tables/views you want to develop against
    b. view objects (and optionally view links, associations) for each of the entity objects or
    combination of entity objects
    c. application module(s) to represent your data model(s)
    3. Save and build your business components project.
    4. Create a new empty project to contain your applet code.
    5. Launch the Infobus DataForm wizard to create your DAC applet. Choose the app module you created in
    step 2 as a data source. (Alternately, you can create the applet from scratch using the controls and
    binding your sessioninfo object to your app module).
    Deployment Steps within JDeveloper:
    1. Deploy your business components project.
    a. decide how you will deploy your app module (local, visibroker, etc.)
    b. if you decide to deploy in local mode, use the Deployment Profile Wizard and choose 'Simple
    Archive', including all of the business components project's XML and .JAVA files in the archive.
    c. if you will deploy to visibroker, see the online help for deploying your business components,
    and see the Release Notes for additional changes you need to make to your applet project.
    2. (if deploying BC4J project in local mode) Create a library using the archive you generated in Step
    1. Add this library to your applet project from the Project Properties Libraries tab.
    3. Clear out a directory on your local machine where the deployment wizard can copy everything you
    need to deploy.
    4. Deploy your applet project.
    a. Run the JDeveloper Deployment Profile Wizard and choose the Web Application to Web Server option
    on Page 1.
    b. On page 2, select all of the .class files in your project that make up the applet.
    c. Select all the libraries listed and shuttle them to the selected list. The contents of these
    libraries will automatically be added to your applet's HTML file during deployment
    d. Give the .jar file a name, and run the deployment to generate that jar file.
    e. select the location of the 'clean' directory you created in step 3.
    Deploying to your WebServer:
    1. Copy everything that the deployment process placed in your 'clean' directory to your WebServer.
    If you deployed your BC4J project locally, you will need to deploy the archive file containing your
    business components to the webserver along with all of the other archives.
    2. If you want to put the dependency archives in a different location from the applet's HTML file
    under the webserver root, then you need to set the CODEBASE tag in the HTML file to the (relative)
    location of the archives.
    Troubleshooting:
    1. Try both Netscape and IE. Different Browsers sometimes give different errors and one might be more
    helpful/indicative of the problem's source.
    2. Use the Java Console to get a more detailed stack trace. For Netscape, choose
    Communicator->Tools->Java Console.
    References w/in Oracle -
    JDBC Developer's Guide
    Net8 Admin Guide
    Referenc es outside Oracle -
    Borland JBuilder doc: http://www.borland.com/techpubs/jbuilder/jbuilder3-s/pg/applets.html
    JavaSoft Plugin Download: http://java.sun.com/products/plugin/
    JavaSoft Applets Resources Page: http://www.javasoft.com/applets/index.html
    null

  • Java Communication error:Error while opening an RFC connection

    Hi,
    I am getting Java Communication error:Error while opening an RFC connection when i try to run a query from Bex analyser.
    please let me know how to resolve this
    Thanks
    Bala Duvvuri

    This error usually comes when the java stack is not upgraded.
    when you upgrade yourABAP stack, simultaneously you have to upgrade the java stack also.
    Please co-ordinate with your basis team to inform EP team to upgrade the java stack when basis team do ABAP stack upgrade.
    Hope this would help you.

  • Need API for Java communicating with RS232

    Dear All,
    I am a newbie to Java. I have a sensor connected to a microcontroller, and this microcontroller is also connected to a PC through the RS232 (COM 1). I have installed the Java Communications API "Javax.comm" on my PC and was able to run the "BlackBox" sample program. What I require is a simple Java program that will read and show the bytes comming through the COM1 port. If anyone has done anything similar or has an idea of how to go about it, could they please send me some example code, I would be very grateful. Or if anyone knows about any website with such similar examples i would be very grateful.
    Thank you very much.
    FREDERIC

    Cross posted numerous times...
    http://forum.java.sun.com/thread.jspa?threadID=634826

  • Some general questions about Sun Java Communications Suite

    Hello Everybody,
    We are a small group of individuals (2 Java developers and 1 Linux expert and Web Application developer), located in Germany.
    We are fully new to �Solaris� and Sun Java Communications Suite and know, that it�s a highly professional software system for large scale deployment. However we plan to install (64 Bit version) and manage it in a small network environment, consisting of a Server (4 GB RAM, RAID 5, AMD Dual CPU) based on Solaris 10 (X86) and *20* clients based on Win XP, Solaris and Linux.
    It�s a network of a non-profit organization, providing social services to local society.
    At clients we will use the Communications Express and the needed services are: Calander, Mail and Address book. (no need of Outlook Connector, Instant Messaging, Document Management, etc.)
    Our long-term aim is - after learning of professional architecting, deployment and management of Communications Suite - to provide integration and development services to organizations (schools and small / medium sized Business) and public in cooperation with ISP or infrastructure-providers like Sun Microsystems.
    Now, our main questions are:
    *1.-* Is the Server phy. recourse enough to deliver the mentioned services of Communication Suite to 20 clients without problems?
    *2.-* Isn�t Communications Suite oversized for such small network mentioned above or better, if we use another collaboration software system like Opengroupeware (http://opengroupware.org/) ? Opengroupeware is developed using non-java lang and therefore doesn�t match our strategy.
    *3.-* Does the Communications Suite download-pack includes all necessary components of Sun Java ES (Directory Server, Access Manager, etc.) or these components are to be downloaded separately?
    *4.-* What is the difference between the Sun Java System Messaging Server and the Sun Java System Message Queue?
    We appropriate very much your answers and any further useful information regarding our project.
    Thanks
    Asghar

    1> I believe your hardware can support 20 users (you might need to tune the Web Server heap size) - I had a Sparc 2x450mhz w/ 2GB of ram supporting 50+ users quite comfortably - with roughly half using POP and the other half IMAP/webmail. Ideally though, for best performance you would want to break up the main servers (LDAP, WEB, and MS) between hosts) - probably not necessary for 20 users. Having all on one machine simplifies things too (but also makes it a single-point-of-failure). Your disk obviously is important, the faster the better - that it's redundant is also nice - larger deployments might use much fancier storage systems to provide speed and redundancy, and use an the App Server instead of the Web Server as a container for Comms Express.
    2> I don't think it's "oversized" - might you mean overkill? In this case I don't think overkill is a bad thing. Why not have very capable software, even if you don't really need it -is how I see things.
    3> I believe you get all you need in the download. Though I've never tried the 64bit version (which I am guessing is only really necessary for larger deployments where you want to obtain maximized performance for heavier loads). I recommend following the single host evaluation document to get the hang of the install.
    4> I'm not sure - though the Messaging install I believe requires the MQueue stuff, I think it's sort of an API for messaging, also available separately, but used by JES Messaging system?
    Good Luck,
    s7

  • About Java Communication API for Windows

    hi
    I'm studying Serial Communication in university.
    I'd like to know the reason why we can't downlaod Java Communication API for Windows.
    I confirmed Comm for Linux and Soralis, but I can't find Comm for Win.
    Please tell me the reason if someone know.

    For no particular reason Sun stopped supporting the windows version
    of that package. I use rxtx which happens to allow for much faster
    communication too.
    The interface is identical to Sun's version, just the package differs: "gnu.io".
    kind regards,
    Jos

  • Problem with Java Communication API

    hi
    I installed the Java Communication API on win32 platform (as per the guidelines)
    Now when I try to run the sample program 'Blackbox' for the serial port, I get an error (in fact an exception is generated inside main function in BlackBox.class file)
    I tried the SimpleRead.java example but that too generated the same exception
    Can anybody help me out.... I am a novice with Java Comm API

    I tried running the sample BlackBox program provided for serial port and now it says
    No Serial Ports Found!
    I verified that both comm.jar and javax.comm.properties are in the <JDK>\lib directory.
    Actually, I am using netBeans IDE 1.4 and I used the C:\J2SDK folder installed with netBeans for the Java Communicaion API
    plz help.

  • Sun Java Communications Sync Problem

    hello,
    I have windows VISTA and i installed "Sun Java Communications Sync" on it.
    When i click in Outlook the "synchronize" tab then "Configure menu" to configure my calendar an Address Bokk settings, it gives me the error "Unable to login to synch engine".
    If i open the program after installation from the program menu, it gives me "Invalid user name" error.
    Any ideas?
    Thanks,
    stamford

    lock123 wrote:
    1) Contacts with birthday less then 1970 are stored in calendar server with birthday 1970 after synchronization from device.You cannot store contacts in the calendar server. The calendar server only stores events and tasks. Contacts are stored in the LDAP directory server.
    Is there any workaround to resolve the problem? If you meant to say that events with a start-date of less then 1970 don't get synchronised, then no, there is no workaround. This is a fundamental limitation of Unix timestamps as used by the calendar server to represents event dates.
    2)
    To clarify, the problem with Cyrillic characters becoming corrupted occurs when you sync contacts which exists only on the windows mobile device to the server-side addressbook? --- Yes it is
    Does this corruption occur if you synchronise a contact created on the server to the windows mobile client? ---- only birthday is wrong on pocket after syncThe birthday being incorrect is likely to be a different issues.
    A quick search didn't reveal any existing reports of the behaviour you are seeing and I have no way to reproduce the problem myself to investigate further so I suggest once again logging a Sun support case for these two issues (birthday & Cyrillic character corruption).
    Regards,
    Shane.

  • Applet/servlet communication for byte transmission

    Hello all !
    I wrote an applet to transfer binary file from web servlet (running under Tomcat 5.5) to a client (it's a signed applet) but I have a problem of interpretation of byte during transmission.
    the code of the servlet is :
            response.setContentType("application/octet-stream");
            ServletOutputStream sos = response.getOutputStream();
            FileInputStream fis = new FileInputStream(new File(
                    "C:\\WINDOWS\\system32\\setup.bmp"));
            byte[] b = new byte[1024];
            int nbRead = 1;
            while (nbRead > 0) {
                nbRead = fis.read(b);
                System.out.println("octets lus = " + nbRead);
                sos.write(b, 0, nbRead-1);
            fis.close();
            sos.close();et le code de l'applet qui appelle cette servlet est :
            URL selicPortal = null;
            try {
                selicPortal = new URL(
                        "http://localhost:8080/AppletTest/servlet/FileManipulation");
            } catch (MalformedURLException e) {
                e.printStackTrace();
            URLConnection selicConnection = null;
            try {
                selicConnection = selicPortal.openConnection();
            } catch (IOException e) {
                e.printStackTrace();
            selicConnection.setDoInput(true);
            selicConnection.setDoOutput(true);
            selicConnection.setUseCaches(false);
            selicConnection.setRequestProperty("Content-Type",
                    "application/octet-stream");
            try {
                InputStream in = selicConnection.getInputStream();
                FileOutputStream fos = new FileOutputStream(new File(tempDir
                        + "\\toto.bmp"));
                byte[] b = new byte[1024];
                int nbRead = in.read(b);
                while (nbRead > 0) {
                    fos.write(b);
                in.close();
                fos.close();
             } catch (IOException ioe) {
                ioe.printStackTrace();
            }the file dowloaded is broken. it seems that bytes 01 00 or 00 01 are not correctly process.
    Some ideas to help me please ?

    hi,
    have you solved this issue.. please post me the code since i m also doing the applet/servlet communication and can use your code as reference.
    how to read the content placed in the urlConnection stream in the servlet
    Below is my code in applet
    public void upload(byte[] imageByte)
              URL uploadURL=null;
              try
                   uploadURL=new URL("<url>");
                   URLConnection urlConnection=uploadURL.openConnection();
                   urlConnection.setDoInput(true);
                   urlConnection.setDoOutput(true);
                   urlConnection.setUseCaches(false);
                   urlConnection.setRequestProperty("Content-type","application/octet-stream");
                   urlConnection.setRequestProperty("Content-length",""+imageByte.length);
                   OutputStream outStream=urlConnection.getOutputStream();
                   outStream.write(imageByte);
                   outStream.close();
              catch(MalformedURLException ex)
              catch(IOException ex)
    How can i read the byte sent on the outstream (in above code) in the servlet.
    Thanks,
    Mclaren

  • Sun Java Communications Suite questions

    Hi all! This is my first post to these boards so please excuse any board fobars.
    Anyway, I have been charge with replacing our existing mail system based on POSTFIX, IMAP and SMTP with a better solution and have come to Sun Java Communications Suite as an option.
    I notice the software can be downloaded for free, but there isn't any obvious mention of end-user costs. Are there any?
    Second, what is the best way to back up the system each night and weekend. I have tried doing a search in Yahoo! and Google but haven't really come up with an answer. Can I back up individial mailboxes and objects with them or must I backup only the system as a whole?
    Thanks for any help!
    Mark

    Yes it has shared folders and you can set up email lists. For instance I have our hylafax fax server just convert the incoming fax and put it in a public company folder that everyone has read access to. Also I have a mailing list that when you send to the address it goes to all employees and you can add the ability for an outside email address like [email protected] rights to send mail to it. The graphical interface works well but you'll want to make your own service packages which isn't hard to do. I really like using commadmin to create my users over the delegated admin but that&#8217;s just me.
    Oh yea I also have a public mail folder I use for corp documents. I just email the docs into that folder.
    Calendar server is great. The outlook connector works great.
    Plus if you&#8217;re going to run it on Solaris 10 you get all the great functionality of that operating system for instance I have my whole mail server running on a solaris zone which resides on a zfs filesystem.
    Which makes it extremely easy to back up or clone and run experiments or updates something goes wrong just rollback. ZFS is truly the best file system out. Solaris is so awesome it was able to keep running even when one of my cheap xeon processors was running in a degraded state. Solaris Fault manager is a god send and they don&#8217;t even market it really. fmadm faulty has saved my butt many times.
    Solaris 10 + commsuite = Little downtime and tons of power.
    Edited by: mark42324 on Dec 4, 2008 5:45 PM

  • Performance in Sun Java Communication Suite 5 between Solaris 9 and 10

    Somebody knows which is the best Operation System to deploy the Sun Java Communication Suite? in performance terms?
    I have and old Sun Fire 280R with two 750 Mhz Processors, 3 GB Ram, and an A1000 Storage.
    Thanks a lot,
    Andres.

    AYacopino wrote:
    Somebody knows which is the best Operation System to deploy the Sun Java Communication Suite? in performance terms?Solaris 10 by far for several reasons:
    -> improved overall performance (kernel/networking level)
    -> ZFS for storage
    -> dtrace for debugging
    -> zones for the various components of the communication suite (http://www.sun.com/blueprints/0806/819-7663.html)
    I have and old Sun Fire 280R with two 750 Mhz Processors, 3 GB Ram, and an A1000 Storage.I'm not sure how many users you are planning to provide access to but your RAM is going to be the bottleneck.
    Regards,
    Shane.

Maybe you are looking for

  • Can't Post an article

    Hi, Can't Post an article. When I click on Post an article the TechNet Wiki immediately close my session (Windows Live Id -> @outlook.com). Try with a old account (Windows Live Id -> @hotmail.com) work very well. Please, help me with this issue. Than

  • Title and image at the beginning of video pixelated

    Am a bit puzzelled about a sudden pixelation of titles and still images at the beginning of a video. I'm working on a small video and would like to start it with a company logo (PSD file) and some simple text (made in FCP with the 'Text' effect). Bef

  • Which pieces of the repository?

    The WebLogic install identifies the Repository Creation Utility (RCU) as a required additional download. And the RCU wants to create and populate a large number of database schemas. Our DBA's are understandably skeptical. So I'm trying to find out wh

  • Windows To Go with Windows 8.1 Update

    Please read this Springboard Series blog post which describes the enhancements to Windows to Go in Windows 8.1, along with a list of free resources that help you understand how prepare for Windows to Go, test, deploy, and best practices too. Enjoy! -

  • Flash crash when i export my animation as a video and get stuck at 64%

    When i export my animation for a video it makes a swf file but it renders till 64% and get stuck and flash freeze and close, how can i fix this?