Communication between servlet & rich client - ObjectStream or OutputStream?

Hi,
I need to send a text file from a servlet to a rich client. Is it better to send it over OutpputStream or wrap it up as an Object(eg: StringBuffer) and send it over OutputStream?
Will the performance be significantly be affected if I try to wrap the file into an object at the Servlet's end and send it over ObjectStream? We are planning to wrap all responses from the servlet into a generic response object (containing data, exceptions and error codes if any) and send it to the client
Please advice. Thanks in advance!

Using object streams will create some protocole overhead. But you can minimize the effect by using compression.
Ex:- java.util.zip.GZIPOutputStream & GZIPInputStream
If you have already decided to use a genaric responce object then it will be good to have a generic request object too that will make your communication more flexible.
But remember when you are doing serialization you might get problems when having different java versions in different ends if your object structures use data structures provided by java API (Ex:- Collections). You can work arround this problem (In most cases) by implementing custom serialization using writeReplace and readResolve methods.

Similar Messages

  • ObjectStream communication between servlet and rich client

    Hi,
    I need to send multiple objects from a servlet to a rich client.
    Is it possible to send 2 objects of different types at the same time - ie, a hashtable and a custom object by writing them one after another into the response's ObjectOutputStream?
    Also, if I have two vectors containing different object types, say a Vector of Strings and a Vector of custom objects, how do I read the ObjectStream at the client end to get these two objects? Do I read two Vectors from the ObjectInputStream and then check the contained object using instanceOf?
    In the above scenarios, is it better to wrap the entire set of objects with a serialized wrapper class and send that single object from the server to the client?
    Please advice. Thanks in advance!

    You can send any number of objects in a stream one after other. If they are in different types/classes then you have to be carefull when casting to the specific types at the other end becouse if you try to cast to wrong type you get a runtime exception.
    Normally when you receive the objects you will know in advande (programming time) which vector comes first in the stream so you can treat them acordingly.
    Since both of them are vectors you can cast them to vector references at the read end and can tread the elements of the first vectors as strings and the elements of the other vectors as something else provided that the client always send the string vector first.
    Whether to make it a single object or ot is a design decision that you have to make. It it make sence to put those two vectors together(logically related) then its better to do so.

  • Communication between two jvm (client and server)

    Hi ,
       I want to access the UME service of the SAP J2EE Container using a stanalone client application.
    So the client would be running on remote JVM.
    Here we use the JNDI service to communicate between the client and server.
    p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
                        p.put(Context.PROVIDER_URL, providerURL.trim());
                        p.put(Context.SECURITY_PRINCIPAL, securityPrinciple.trim());
                        p.put(Context.SECURITY_CREDENTIALS, securityCredentials.trim());
                        Context ctx = (Context) new InitialContext(p);
                        Object objRef = ctx.lookup(ejbName.trim());
    I want to know that is the communication between the client and server secured in this scenario
    Best Regards
    Manoj

    Okay, the client and server VMs are different implementations of the Hotspot engine. Hotspot basically takes the Java bytecode from your .class files and turns it into native machine instructions at runtime. (The optimizations are actually much more complex than that, but that's the basic concept.)
    The client VM is so named because it's designed to be used for GUI-type applications interacting with the user. It is designed to have a quicker startup and smaller memory footprint.
    The server VM uses more memory and is typically slower at starting up than the client VM, but can often perform ridiculously fast. This of course depends completely on the particular code being run, and you should probably profile and see which VM works better for your application.
    Some interesting optimizations are performed by the 1.4.1 server VM, such as: removal of array-bounds checks (when it determines that the index can't become out of bounds), inlining of methods, and more.
    Here is a link to more info if you're interested:
    http://java.sun.com/products/hotspot/docs/whitepaper/Java_HotSpot_WP_Final_4_30_01.html

  • Communication between servlet(client behavior) and stand alone java program

    Hello all:
    I need to send a message (ascii characters sequence) from a servlet to a java program, but I'm not sure what is the best way to get it: socket, JMS or other mechanism that I don't know.
    Is the servlet who is operating how client behavior.
    Please, any comment will be appreciated, regards,
    Ulises.

    You can always start a ServerSocket on the client (kinda sounds funny, doesn't it) which will accept connections. You then open a plain old Socket on the server to connect to the client's listener. (Note, this is the reverse of a normal set-up). Once you have the connection established, you will call getOutputStream() to get a stream to write to. Likewise, you will call getInputStream() to read the data sent. You will want to investigate the java.net.* and java.io.* libraries.
    - Saish

  • Communication between servlet & applet

    Hello everybody,
    Well, I have a problem with my applet/servlet system.
    I Would like my applet to send some queries to the servlet.
    However, I don't know how to link the applet with the servlet (the only way I know is to use "openConnection()", but I don't see how to incorporate my query in the URLConnection (in order to have one, I need openCOnnection, and once it's done, well, the doGet method has already be laucnh, without any parameter to read). In my case, the DoGet methods of the servlet is launched, and of course, the HTTPRequest is almost empty, seeing thath I don't see how to specify the differnets parameters.
    Is thereany simple meaning to make the applet communicate this the servlet, sending strings, and receiving objects (I have already solve the problem of the sending of an object from the servlet to the applet, in the doGet method).
    Thank you very much
    C U

    In the applet html include a servlet parameter.
    <param
    name="servlet"
    value="/SqlServlet" />
    In your applet open a connection to servlet.
    InputStream in = null;
    URLConnection conn = null;
    URL url = null;
    String servlet = getParameter("servlet");
    url = new URL(servlet + "?sql=" + URLEncoder.encode(sql));
    conn = url.openConnection();
    in = conn.getInputStream();

  • Communication between servlets with data

    I have a servlet that creates a HTML table (a report) with some data. The data used is a vector of some java objects. Now, I want to add a hyperlink to each row in the table and when clicked, open a new browser window and show the record info in detail. I know how to add a hyperlink and open a new window, but I do not know how to pass the data associated with that (user-clicked) row to a new browser window. The Java object for that row contains 20 items and I do not want to pass them in name-value pair to another servlet. Is there a smarter way to do this ? Can someone please help me?
    This is a rough sketch of how I want to put a hyperlink in a row: The following method creates rows in my table:-
    private void loadTableData(Vector data, PrintWriter out, int col)
            throws IOException {
            MyRecordObject myRec = null;
            if (data != null) {
                Object[] myArray = null;
                myArray = new Object[data.size()];
                for (int k = 0; k < data.size(); k++) {
                    myArray[k] = data.get(k);
                Arrays.sort(myArray, new MySorterClass(col));
                for (int i = 0; i < myArray.length; i++) {
                    myRec = (MyRecordObject) myArray;
    out.println("<TR bgcolor= \"E5E5E5\"> ");
    // When the following hyper link
    //is clicked, pass "myRec" object to some servlet/JSP
    //and create a new HTML page with that data
    out.println("<TD> <a href=\"myDetailInfoServlet_with_data\" target =\"_blank\"> " + myRec.getName() + " </a> </TD>"); // <==
    out.println("<TD>" + myRec.getFathersName() + "</TD>");
    out.println("<TD>" + myRec.getMothersName() + "</TD>");
    out.println("<TD>" + myRec.getPetName() + "</TD>");
    out.println("<TD>" + myRec.getSpouseName() + "</TD>");
    out.println("</TR>");
    out.println("</TBODY>");
    out.println("</TABLE>");
    out.println("</div>");
    out.println("</html>");

    My approach would be to just pass along an id with the hyperlink. Something you use to identify which record you want to display. This can be the recordId, or maybe the index of it in the data vector if that is still available and hasn't changed.
    eg
    out.println("...<a href=\"myDetailInfoServlet_with_data\?id= " + i + " ...
    Also, I would recommend using JSPs for this sort of stuff.
    For sure, retrieve your data in a servlet, but then just put it into request/session variables, and forward to a JSP to display.
    using out.println for table code is a real pain in the butt.
    Cheers,
    evnafets

  • Rich Client advice

    Hi all,
    Been searching the archives.
    I've developed a Swing standalone app and would like to convert it into a "Rick Client" but shifting certain parts over to a backend. My initial work has been a servlet on Tomcat webserver I maintain.
    Can anyone point me to any up-to-date examples or Rich Client development?
    Is the use of http requests/responses the standard way to do this or are there non-servlet examples?
    There seem to be so many frameworks for this (Eclipse RC, Spring RC etc.)
    Many thanks.

    Thanks for the pointer. I will look at the tutorials.
    I guess what I really want to know is what do people use as the most "vanilla"/non-framework communication between a Rich Client and a backend server.
    Do the back ends tend to be servlets/JSPs or WebServices or what?
    Thanks again.
    Chris

  • DifferenceS  BETWEEN Servlet & Portlet

    Hi
    Can anyone tell me the differences b/w portlet and servlet/jsp
    THanks
    belur

    �     Servlets can provide complete web pages, whereas portlets only provide fragments. These fragments are then aggregated to form a complete web page by the portal
    �     Portlets aren?t allowed to generated HTML code that contains tags such as base, body, frame, frameset, head, html, or title. The iframe tag can be used with caution.
    �     The user cannot access a portlet directly using a URL in the way that a servlet is accessed. Instead, the URL points to the page containing all of the portlets on one page
    �     Communication between the web client and the portlets is performed through the portal
    �     Portlets can be provided with buttons or controls to manipulate the portlets? window states or portlet modes
    �     Multiple instances of a single portlet can be placed onto the same page
    �     Portlets support persistent configuration and customization
    �     Portlets also support user profile information
    �     Portlets support two scopes within the session; application scope and portlet scope

  • Webi rich client and Infoview difference

    I am quite new to BO. Plz tell me what is difference between webi Rich client and Webi (i.e infoview?)
    Thanks and regards.

    Ashok Babu
    Muiz: Already shared the thread, Diference Between Web Intelligence and Web Intelligence Rich Client?
    Why you copied it. Without any new info.
    WRC:
    >>Windows based
    >> Work Online Mode
    >> Offline Mode
    >> Universes
    >> Personal Data Providers
    WebI:
    >>Web Based(resides in Infoview Portal)
    >> Online mode only
    >> Universe only data source.
    I'm Back

  • Communication between two clients

    In Java Networking, communication between server-client or bwtween server-multiple clients is general. But How will be the communication between two cients, means two clients can send & receive messages to & from each other(being guided by server).

    Sorry,
    I didn't get your reply clearly.
    I want, if Server is running, and two clients(two instance of a same program) are opened, whatever message(string)client1 send to Server,then the Server needs to send those to client2.Again, the some response should come from client2 to client1 thru Server.
    How can I implement this?
    If you have idea, or some sample code about this, please let me know.
    Regards.

  • Communication between client and server

    I am using sockets for communication between the client and the server. is there any other way that i can use for communication between the client and server???

    Plenty of ways: JMS, SOAP, RMI, a RESTful API, writing-files-to-a-shared-directory-on-the-disk, Sneakernet, ...
    Some of them use sockets (or better TCP/IP) as the underlying protocol.
    But to give you a good answer, you would have to tell us why you want a different way. I hope you're not searching for a different way just for the sake of being different.

  • Inconsistent date formats between Rich Client and HTML client

    Hey All,
    Just wondering if anyone has come across an issue with inconsistent date formats from a universe based on an MS SSAS 2012 database connection in 4.x?
    The value of the date is returned as a string from the query but the object data type has been changed to a Date object meaning BusinessObjects should convert the string into a date if the format is correct.
    The problem in this is that the date being returned in Rich Client is in dd/MM/yyyy format whereas on the Web Client is in MM/dd/yyyy.
    From the Web Client business objects will return a date, however, it is a mix of MDY and DMY format.
    i.e. 15th of March will be displayed as 15/03/2014
    whereas 12th of March will be displayed as 03/12/2014
    All our application servers are configured for English (Australian) regional settings meaning all dates should be in DMY format.
    The date in the database is stored as a non-ambiguous yyyy-mm-dd format so it appears the variation is occurring somewhere between the database and BusinessObjects for the Web Client based reports only.
    I have also checked the sqlsrv.prm file based format and changed this to DMY but this has also not made a difference.
    The same universe in 3.1 and MS SSAS 2008 works correctly but not this one.

    Hi
    The date in the database is stored as yyyy-mm-dd format.
    As per user request.... Set the date format @ the Business layer level. so it will refelct same as in the WebI.
    Please find the below link. how to use custom Display option.
    BI4.1 Business Layer Enhancements - Create Display Format

  • Diference Between Web Intelligence and Web Intelligence Rich Client?

    Hey Guys,
    Do you know the difference between Web Intelligence and Web Intelligence Rich Client?
    I was asked about that but i couldnt help. And i need to make a decision about a Web Intelligence training. I need to decide using one or another.
    Thanks
    Vegas

    Hi Vegas,
    The Webintelligence Rich Client (WRC) has all the features of the thin webintelligence client. But WRC makes use of the client processor and memory to do all post query processing while Infoview Webi sends every request to the server for processing.
    Thus you won't find any difference between the time taken to retrieve data from the database between these two clients. But there would be huge difference in performance while doing further analysis, formatting  with the data. Also you will not need connectivity to the network to do analysis and formatting using the WRC client.
    WRC client will help you to just retrieve the data on the fly and let you play around with it while you are traveling with no network connectivity.
    Thanks
    Mohanraj CP
    http://blog,mohanraj.org

  • Difference Between Oracle ADF and ADF Rich Client

    Hello Gurus,
    I want to know the difference between those two:
    Oracle ADF:
    http://goo.gl/6Q1i2
    and
    ADF Rich Client:
    http://goo.gl/L31ra
    I downloaded Jdeveloper 11g (11.1.2.3.0)
    I did this tutorial which It adf right? http://goo.gl/8Mf7c
    and this other is rich client right? http://goo.gl/7Krew
    Can I please know the advantages of them over the other one? THANKS !!!

    ADF Faces Rich Client Components are a part of Oracle ADF.
    So Oracle ADF uses ADF Faces as the components for the rich web UI, but it also offers things like simplified database access through ADF Business Components, an advanced ADF Controller layer, and simple data binding.
    I would suggest starting with this seminar:
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/Introduction_To_ADF/Introduction_To_ADF.html

  • Diff between Thin client and Rich client

    Hi Everyone,
              Can someone give me a clear picture of the what is the diff between Thin client and Rich client.
    Thanks,
    Krishna

    Hi,
    thick client (rich client) has/stores all the data inside itself
    so it can do application processing without the server with data
    thin client uses resources from host computer (from server)
    and wihtout that you are not able to work with that kind of client
    does that answer your question ?
    Regards,
    michal

Maybe you are looking for

  • Java Applet is not working in IE11 in win8/win 2008 server

    Hi, we have developed web application using PHP. in the start of the page we have link which will kick start the Java Applet application on click.   It is not working in IE 11 browser with all windows machine until we add that page in the compatibili

  • Network storage drive...where can I learn about these?

    I have so many questions, and frankly, the answers I've seen looking (briefly, admittedly) around these threads scare me.  Gee, Wally, what ever happened to Apple as the computer you didn't have to know computer programming to use? Now, before you al

  • Error while installing 2nd exchange 2007 on our domain

    We are installing the 2nd exchange 2007 on our domain - for obvious reasons of not able to upgrage the exisitng version to SP3 RU10 - as the server crashes everytime we do an update. So we thought we will setup a second new exchange 2007 server with

  • Complaints & Sales Returns

    Dear All, Whenever Post goods receipt is done for the return sales order,if the material is activated for returns inspection (Inspection type 06) every time inspection lot gets generated.But what i want is inspection lot shd get generated only when i

  • How to get it back?

    I recently reinstalled Leopard--unfortunately, Final Cut Express did not transfer from my external hard drive (backup) without asking for a key. All I have is my disk, and no key. I just got the program. Am I going to have to purchase it again? Why d