Sending a url to the server

hi.. can somehody help me on this..
im currently using the oscache facility to cache my pages.but the caching only happens when the page was first displayed.the loading time for the page is pretty long.
now, im tasked to create a batch job that would send all the url's to be cached into the server.so that when a user views the page it will only be cached pages.
has anyone done this kind of program??
thanks...

DON'T CROSS-POST!

Similar Messages

  • Send Data back to the Server

    Hi.
    how to send data back to the server using J2ME or how to communicate with server using J2ME

    i am using http its work well on emulator but when i install the application on sony ericsssin p910i or k700i or nokia 7710 then its not working and simply hang.
    here is sample code which is run well on emulator but not on mobile.
    what is the problem in that or how can this code run in mobile is there any mobile specific setting or internet setting.
    Pls reply asap.
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * An example MIDlet to invoke a CGI script.
    public class ThirdExample extends MIDlet {
    private Display display;
    // String url = "http://www.javacourses.com/cgi-bin/getgrade.cgi?idnum=182016";
    String url = "http://sampler.infopro.stpn.soft.net/midletdata.asp?name=name";
    public ThirdExample() {
    display = Display.getDisplay(this);
    * Initialization. Invoked when we activate the MIDlet.
    public void startApp() {
         try {
    getGrade(url);
         } catch (IOException e) {
         System.out.println("IOException " + e);
         e.printStackTrace();
    * Pause, discontinue ....
    public void pauseApp() {
    * Destroy must cleanup everything.
    public void destroyApp(boolean unconditional) {
    * Retrieve a grade....
    void getGrade(String url) throws IOException {
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    StringBuffer b = new StringBuffer();
    TextBox t = null;
    int x = 5, y =7;
    try {
    c = (HttpConnection)Connector.open(url);
    c.setRequestMethod(HttpConnection.GET);
    c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
    c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Confirguration/CLDC-1.0");
    c.setRequestProperty("Content-Language", "en-CA");
    os = c.openOutputStream();
    String str = "?idnum=182016";
    byte postmsg[] = str.getBytes();
    for(int i=0;i<postmsg.length;i++) {
    os.writeByte(postmsg);
    os.flush();
    is = c.openDataInputStream();
    int ch;
    while ((ch = is.read()) != -1) {
    b.append((char) ch);
    System.out.println((char)ch);
    t = new TextBox("Final Grades", b.toString(), 1024, 0);
    } finally {
    if(is!= null) {
    is.close();
    if(os != null) {
    os.close();
    if(c != null) {
    c.close();
    display.setCurrent(t);

  • Problem in sending HTTP request to the server.

    Hi,
    i dveloped an ant script for sar deployment.
    i deployed a sar to my local soa server with ant script. it got deployed succesfully..
    but when i try to deploy to a remote server, getting the below error..
    "Problem in sending HTTP request to the server. Please make sure the server is up and/or check standard HTTP response code for 404"
    but the server is up and runnig and i am able to ping it from my machine and also access the console...
    below is my script
    build.properties
    wn.bea.home=C:/Oracle/Middleware
    all.needed.jars.path=D:/SourceCode/neededJAR
    oracle.soa.home=C:/Oracle/Middleware/Oracle_SOA1
    java.passed.home=C:/Oracle/Middleware/jdk160_24
    #Deployment environment
    deployment.plan.environment=DEV
    #Deploy Action
    deployAction =redeploy
    #credentials
    user=weblogic
    password=welcome1
    #For Composite deployment
    serverURL=http://10.177.154.6:7001
    forceDefault=true
    server=10.177.154.6
    port=7001
    sarLocation=D:/SourceCode/JAR
    build.xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <project name="soaDeployAll" default="deployAll">
         <echo>basedir ${basedir}</echo>
         <property environment="env"/>
    <echo>current folder ${basedir}</echo>
         <property file="${basedir}/build.properties"/>
         <taskdef resource="net/sf/antcontrib/antlib.xml">
         <classpath>
              <pathelement location="${all.needed.jars.path}/ant-contrib.jar"/>           
         </classpath>
         </taskdef>
         <target name="init">
              <tstamp>
                   <format property="timestamp" pattern="yyyy-MM-dd_HH-mm-ss"/>
              </tstamp>
              <property name="build.log.dir" location="${basedir}/buildlogs"/>
              <mkdir dir="${build.log.dir}"/> <property name="build.log.filename" value="build_${timestamp}.log"/>
              <record name="${build.log.dir}/${build.log.filename}" loglevel="verbose" append="false"/>
              <echo message="Build logged to ${build.log.filename}"/>
         </target>
         <target name="deployAll" depends="init">
         <echo>Deploy for environment ${deployment.plan.environment}</echo>
         <antcall target="deployAllComposites"/>
    </target>
    <!-- Following Actions are performed for Composite files in Managed Server - Deploy,Redeploy -->
         <target name="deployAllComposites" depends="init">
         <foreach target="deployComposites" param="Files">
              <fileset dir="${sarLocation}" casesensitive="no" includes="*.jar"/>
         </foreach>
         </target>
         <target name="deployComposites" depends="init">
         <basename file="${Files}" property="basename"/>
    <echo>Deploy Project ${basename} for environment ${deployment.plan.environment}</echo>
              <if>
                   <equals arg1="${deployAction}" arg2="deploy" />
                   <then>
                        <echo message="Deploying composites in Managed server........." />
                        <ant antfile="${oracle.soa.home}/bin/ant-sca-deploy.xml" inheritAll="true" target="deploy">
                             <property name="serverURL" value="${serverURL}"/>
                             <property name="user" value="${user}"/>
                             <property name="password" value="${password}"/>
                             <property name="overwrite" value="false"/>
                             <property name="forceDefault" value="${forceDefault}"/>
                             <property name="sarLocation" value="${sarLocation}/${basename}"/>
                        </ant>
                   </then>
                   <else>
                        <echo message="ReDeploying composites in Managed server........." />
                        <ant antfile="${oracle.soa.home}/bin/ant-sca-deploy.xml" inheritAll="true" target="deploy">
                             <property name="serverURL" value="${serverURL}"/>
                             <property name="user" value="${user}"/>
                             <property name="password" value="${password}"/>
                             <property name="overwrite" value="true"/>
                             <property name="forceDefault" value="${forceDefault}"/>
                             <property name="sarLocation" value="${sarLocation}/${basename}"/>                         
                        </ant>
                   </else>
              </if>
    </target>
    </project>
    please help....

    Hi,
    Give the serverURL as http://<host>:<managed.server.port>/soa-infra/deployer and try.
    e.g . http://10.177.154.6:8001/soa-infra/deployer
    Regards,
    Neeraj Sehgal

  • I send a cookie to the server, but it doesn't come back.

    Hey all:
    I'm attemping send a cookie via an application to the servlet, and then pull that cookie back out from the servlet's response. I want to do this whole process repeatedly while retaining the same cookie.
    Pulling the cookie out on the first request to the servlet works fine because I do not send a cookie to the servlet, and the servlet instantiates a new session. Next, the cookie is sent back to the servlet successfully because it is printed out on the server-side exactly as it appeared on the client side. However, after the servlet responds to that second request and on subsequent requests, I can not pull the cookie out again. On the method call, connection.getHeaderField("Set-Cookie"), the result is null. I've even inspected the connection object, and it seems empty of any cookies whatsoever. Why doesn't the cookie come back on requests after the initial request? Is there anything I can do to make it come back?
    Thanks a ton in advance. Have great day!!!

    you must check that cookie's path set by Tomcat is the one expected by your browser. Otherwise the former won't send it back to the server. I had the same problem because Tomcat sets the cookie path to "/webAppName" and the browser expected it to be "/".

  • AOL email cannot send PASSWORD securely to the server???

    Hi, When I set up any aol account in mail, and click create, it always comes up with cannot send password securely to the server. This problem happened right after updating to snow leopard. Any one else have the same problem? Any solutions? Thanks.

    For years and years most email servers accepted connections that were insecure, meaning that passwords were transmitted in plain text, and the email messages came back as plain text as well.
    Now many servers encourage the use of SSL connections, which encrypts the data in both directions. Mail is trying to warn you that the SSL connection cannot be established, and therefore your data could be intercepted in transmission.
    AOL's website (http://about.aol.com/faq/openmailaccess) states that they do not support SSL connections, therefore your only method of accessing your email is to use an unsecure connection.
    Alternatively you could go to AOL.com (not use Mail.app) and read your email here as this will establish a secure HTTPS connection.
    The best solution though is to stop using AOL and get either a MobileMe or a gmail account.
    Regards,
    -Ryan

  • How to send data back to the server

    i create a program to send data back to ther server using j2me.
    its work well on emulator but when i install the application on sony ericsssin p910i or k700i or nokia 7710 then its not working and simply hang.
    here is sample code which is run well on emulator but not on mobile.
    what is the problem in that or how can this code run in mobile is there any mobile specific setting or internet setting.
    Pls reply asap.
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * An example MIDlet to invoke a CGI script.
    public class ThirdExample extends MIDlet {
    private Display display;
    // String url = "http://www.javacourses.com/cgi-bin/getgrade.cgi?idnum=182016";
    String url = "http://sampler.infopro.stpn.soft.net/midletdata.asp?name=name";
    public ThirdExample() {
    display = Display.getDisplay(this);
    * Initialization. Invoked when we activate the MIDlet.
    public void startApp() {
    try {
    getGrade(url);
    } catch (IOException e) {
    System.out.println("IOException " + e);
    e.printStackTrace();
    * Pause, discontinue ....
    public void pauseApp() {
    * Destroy must cleanup everything.
    public void destroyApp(boolean unconditional) {
    * Retrieve a grade....
    void getGrade(String url) throws IOException {
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    StringBuffer b = new StringBuffer();
    TextBox t = null;
    int x = 5, y =7;
    try {
    c = (HttpConnection)Connector.open(url);
    c.setRequestMethod(HttpConnection.GET);
    c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
    c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Confirguration/CLDC-1.0");
    c.setRequestProperty("Content-Language", "en-CA");
    os = c.openOutputStream();
    String str = "?idnum=182016";
    byte postmsg[] = str.getBytes();
    for(int i=0;i<postmsg.length;i++) {
    os.writeByte(postmsg);
    os.flush();
    is = c.openDataInputStream();
    int ch;
    while ((ch = is.read()) != -1) {
    b.append((char) ch);
    System.out.println((char)ch);
    t = new TextBox("Final Grades", b.toString(), 1024, 0);
    } finally {
    if(is!= null) {
    is.close();
    if(os != null) {
    os.close();
    if(c != null) {
    c.close();
    display.setCurrent(t);
    }>

    i create a program to send data back to ther server using j2me.
    its work well on emulator but when i install the application on sony ericsssin p910i or k700i or nokia 7710 then its not working and simply hang.
    here is sample code which is run well on emulator but not on mobile.
    what is the problem in that or how can this code run in mobile is there any mobile specific setting or internet setting.
    Pls reply asap.
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * An example MIDlet to invoke a CGI script.
    public class ThirdExample extends MIDlet {
    private Display display;
    // String url = "http://www.javacourses.com/cgi-bin/getgrade.cgi?idnum=182016";
    String url = "http://sampler.infopro.stpn.soft.net/midletdata.asp?name=name";
    public ThirdExample() {
    display = Display.getDisplay(this);
    * Initialization. Invoked when we activate the MIDlet.
    public void startApp() {
    try {
    getGrade(url);
    } catch (IOException e) {
    System.out.println("IOException " + e);
    e.printStackTrace();
    * Pause, discontinue ....
    public void pauseApp() {
    * Destroy must cleanup everything.
    public void destroyApp(boolean unconditional) {
    * Retrieve a grade....
    void getGrade(String url) throws IOException {
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    StringBuffer b = new StringBuffer();
    TextBox t = null;
    int x = 5, y =7;
    try {
    c = (HttpConnection)Connector.open(url);
    c.setRequestMethod(HttpConnection.GET);
    c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
    c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Confirguration/CLDC-1.0");
    c.setRequestProperty("Content-Language", "en-CA");
    os = c.openOutputStream();
    String str = "?idnum=182016";
    byte postmsg[] = str.getBytes();
    for(int i=0;i<postmsg.length;i++) {
    os.writeByte(postmsg);
    os.flush();
    is = c.openDataInputStream();
    int ch;
    while ((ch = is.read()) != -1) {
    b.append((char) ch);
    System.out.println((char)ch);
    t = new TextBox("Final Grades", b.toString(), 1024, 0);
    } finally {
    if(is!= null) {
    is.close();
    if(os != null) {
    os.close();
    if(c != null) {
    c.close();
    display.setCurrent(t);
    }>

  • "cannot send email message using the server icloud" on 10.6.8

    I use mail from my desktop, not from iCloud on the Internet. I have a MacBook Pro with 10.6.8 Snow Leopard. My mail was working fine until yesterday.
    It says "Cannot send message using the server iCloud. connections to the server smtp.me.com on the default ports timed out. Select a different outgoing mail server from the list below.
    The list has:
       ICloud offline
       and Icloud
    Neither of them work.
    What has Apple changed regarding this in September?
    (I know others have posted similar message, but they were on 10.7)

    Same problem here.
    Recently an @icloud.com version (alias) of my existing @me.com email address appeared on my account. I can still send messages form the OSX build in Mail client as long as I am using the @me.com version of my email, but I do get this message when I try to use the new @icloud.com account.
    My account with iCloud states that both @me.com and @icloud.com versions of my email are active.
    Would be nice to know if this is a temporary problem of if this is a permanent one.
    The settings on the outgoing mail server are default as retrieved from apple when I configured the @me.com email for the first time. I went through the troubleshooting suggestions as provided on Apple website, double checking all the settings, no joy. At the very list I can still use the old @me.com alias with no problem (for now)
    MacBook Pro / Mountain Lion 10.8.2

  • Having problems in sending email..always saved in outbox and cannot send mail bcoz of the server failed

    Having problems in sending email..always saved in outbox and cannot send bcoz of server failed

    The email server you are using to send mail through requires the password, if any is required it needs to be set in the location that I pointed out in the earlier post.
    It is usually the same password you use for receiving emails.
    I don't use either Facebook or Twitter so I am not sure how to help with those.

  • Mail can not send  was rejected by the server because it does not allow relaying i can not send mail i get this error every time

    everytime i try to send email i get an error message saying  was rejected by the server because it does not allow relaying. how can i correct this and get my mail to send from my iPhone 4s

    Hello fightnfire,
    Thanks for using Apple Support Communities.
    I'd like you to please follow the "basic troubleshooting" steps in the article linked to below:
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/TS3899
    Take care,
    Alex H.

  • Sender address rejected by the server

    Stupidly, I tried to send an email to everyone in the address book without splitting them up into smaller groups. I think I have been flagged as a spammer. This is the error message I get:
    This message could not be delivered and will remain in your Outbox until it can be delivered.
    The sender address [email protected] was rejected by the server.
    I am unable to send any emails from Mail. How do I resolve this???

    It looks like you've exceeded the .Mac sending limitations, as described in the following article:
    .Mac: Email Account Specifications
    The problem should fix itself by just letting enough time to pass so that you're within the limits again.

  • Cant send email. rejected by the server

    unable to send email. i can receive and view but get the error message " rejected by the server because it does not allow relaying"

    No, All data and contents will not be lost.
    All settings will be reset to default, so these are a few you may need to reset if you have changed them:
    Enable Location Services
    WIFI - to connect again
    Bluetooth - Re-Pair again
    Sound(Ringtone)
    Wall Paper
    Passcode Lock (Setting, General)
    Brightness
    Battery Percentage (Setting, General, Usage)
    Mail (Default Account, Show Recent Messages, Fetch New Data, Time Zone Support)
    Auto-Lock (Setting, General)
    Messages (Notification, Messages, Show Preview) (Messages, Character Count)
    Contact (Sort Order, Display Order)
    Application Store Itune Account (Use existing account)
    Restriction (if you want it On)
    Call Forwarding, Call Waiting...... if any
    World Clock (Application)

  • TS2621 sending message content to the server failed - on my iPhone and iPad?

    How do I fix this. Thank you very much

    Does the mail account work on other devices?
    Have deleted the account from the devices and recreated it?

  • Object can't be send over to the server.

    Hi to everyone,
    I'm doing a connection between client and server. The client will send image from the platform to the server. The server will then create an folder in the server-side to store the images.
    Thank you for reading. Hope to hear from you soon. Anytime you need clarifation, you could ask. I'll be more willingly to feel you in in more details.
    IMclient.java -- file
    import java.awt.geom.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    // ========================== START OF IMAGECLIENT ===========================
    public class IMclient extends JFrame implements ActionListener,ChangeListener
    private JMenuBar mainMenu;
    private JMenuItem open, save, exit, scale;
    private JMenu fileMenu, editMenu;
    private JPanel mainPane, butPane;
    private JFileChooser imagesFile;
    private JButton butSend;
    private JLabel imageLabel; //A display area for a short text string or an image, or both
    JPanel imagePanel;
    JLabel imgPanel = new JLabel();
    BufferedImage buffImage=null;
    BufferedImage bimage;
    ImageStorage dImage=null;
    // JSlider variable
    final int MIN = 0;
    final int MAX = 255;
    final int INIT = MAX/2;
    JSlider redSlider, greenSlider, blueSlider;
    // BufferedImage bimage;
    int r,g,b;
    int w,h;
    int pixels[];
    Image img;
    String fname= "babymin05.gif";
    // Declare all the Input/Output object variables.
    Socket toHost = null;
    //PrintWriter out = null;
    ObjectInputStream in = null;
    ObjectOutputStream objectOut = null;
    Container cpane;
    // ================================ Constructor ===============================
    public IMclient(String host, int port){
    initGUI();
    initSocket(host, port);
    dImage = new ImageStorage(fname);
    updateImage();
    public void updateImage()
    buffImage = dImage.getImage(); //return buffered image
    // img = (Image)bimage; //cast buffered image as images
    displayImage(buffImage); //display the images
    //added from rgbslider
    //JSlider RedSlider,BlueSlider,GreenSlider;
    public void displayImage(BufferedImage buffImage)
    //to create and display an image
    //BufferedImage bimage = rgb.getColor();
    ImageIcon icon = new ImageIcon(buffImage);
    System.out.println(icon);
    imgPanel.setIcon(icon);//to set image visible
    imgPanel.repaint();
    public void stateChanged(ChangeEvent e)
    //return buffered image from ImageStorage class.
    bimage = getColor();
    // displayImage(bimage);
    public BufferedImage getColor()
    //to get the array of pixels of the buffered image
    pixels = new int[dImage.getWidth()*dImage.getHeight()];
    //return the pixels value of bufferedImage
    pixels = dImage.getPixelsArray();
    int [] rgb = new int[3];
    int pix=0;
    for (int i=0 ; i<pixels.length ; i++)
    //to get the r,g,b value from the array
    rgb = dImage.getRGB(pixels);
    r = redSlider.getValue();
    g = greenSlider.getValue();
    b = blueSlider.getValue();
    //to set the pixels to the final value
    pixels = dImage.setRGB(r,g,b);
    dImage.setPixels(pixels);
    //to set the pixels array value and the RGB value
    dImage.setImage(pixels);
    bimage = dImage.getImage();
    //to return the buffered image
    return bimage;
    public JPanel sliderGUI()
    JPanel slidePanel = new JPanel();
    slidePanel.setLayout(new GridLayout(3,2));
    setSlider();
    JLabel redLabel = new JLabel("Red");
    JLabel blueLabel = new JLabel("Blue");
    JLabel greenLabel = new JLabel("Green");
    slidePanel.add(redLabel);
    slidePanel.add(redSlider);
    slidePanel.add(blueLabel);
    slidePanel.add(blueSlider);
    slidePanel.add(greenLabel);
    slidePanel.add(greenSlider);
    return slidePanel;
    // setSlider() consists of the three silders (r,g and b).
    private void setSlider(){
    blueSlider = new JSlider(JSlider.HORIZONTAL, MIN, MAX, INIT);
    blueSlider.setMajorTickSpacing(MAX);
    blueSlider.setMinorTickSpacing(MIN);
    blueSlider.setPaintLabels(true);
    redSlider = new JSlider(JSlider.HORIZONTAL, MIN, MAX, INIT);
    redSlider.setMajorTickSpacing(MAX);
    redSlider.setMinorTickSpacing(MIN);
    redSlider.setPaintLabels(true);
    greenSlider = new JSlider(JSlider.HORIZONTAL, MIN, MAX, INIT);
    greenSlider.setMajorTickSpacing(MAX);
    greenSlider.setMinorTickSpacing(MIN);
    greenSlider.setPaintLabels(true);
    blueSlider.addChangeListener(this);
    redSlider.addChangeListener(this);
    greenSlider.addChangeListener(this);
    public BufferedImage getBufferedImage()
    return bimage;
    // ================================ initGUI() =================================
    public void initGUI()
    cpane = getContentPane();
    cpane.setBackground(Color.white);
    cpane.setLayout(null);
    //to set the close menu on the menubar
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    //Open the menu in order to img from any folder
    imagesFile = new JFileChooser();
    imagesFile.addActionListener(this);
    //create an intermedia panel to hold panel and button
    mainMenu = new JMenuBar();
    setJMenuBar(mainMenu);
    setContentPane(cpane);
    fileMenu = new JMenu("File");
    mainMenu.add(fileMenu);
    editMenu = new JMenu("Features");
    mainMenu.add(editMenu);
    /* == JMenuItem(open, save, exit) to be added into the JMenu(fileMenu) == */
    open = new JMenuItem("Open...");
    save = new JMenuItem("Save...");
    exit = new JMenuItem("Exit...");
    scale = new JMenuItem("Scale");
    fileMenu.add(open);
    fileMenu.add(save);
    fileMenu.add(exit);
    editMenu.add(scale);
    /* =================== End of adding JMenuItem() ======================== */
    //add events to the JMenuItem(open, save, exit)
    open.addActionListener(this);
    save.addActionListener(this);
    exit.addActionListener(this);
    scale.addActionListener(this);
    /* =============== Create a button =======================*/
    butSend = new JButton("Send");
    butSend.addActionListener(this);
    JPanel butPane = new JPanel();
    butPane.setLayout(new BorderLayout());
    butPane.add(butSend);
    /* =============== End Create button =======================*/
    /* =============== Create a Image Panel =======================*/
    imgPanel = new JLabel();
    imagePanel= new JPanel(new BorderLayout());
    //imgPanel.setBorder(BorderFactory.createRaisedBevelBorder());
    imagePanel.setBorder(BorderFactory.createRaisedBevelBorder());
    //imageLabel = new JLabel();
    imagePanel.add(imgPanel);
    /* =============== End of Image Panel =======================*/
    // creates a new Panel
    JPanel rgb=sliderGUI();
    cpane.add(rgb);
    cpane.add(imagePanel);
    cpane.add(butPane);
    Insets insets = cpane.getInsets();
    imagePanel.setBounds(50 + insets.left, 20 + insets.top, 300, 236);
    butPane.setBounds(400 + insets.left, 220 + insets.top, 90, 40);
    rgb.setBounds(50 + insets.left, 300 + insets.top, 400, 250);
    //to set the size of the frame
    setSize(1024,768);
    //to set the main pane visible to the user
    setVisible(true);
    // =========================== actionPerformed() ==============================
    public void actionPerformed(ActionEvent e)
    if(e.getSource()==(open))
    imagesFile.showOpenDialog(this); //to have the OPEN dialog box
    if(e.getSource() == imagesFile)
    //to get the file from the exact folder that the user clicks on
    fname = imagesFile.getSelectedFile().getAbsolutePath();
    updateImage();
    if(e.getSource() == (exit))
    System.exit(0); //exit the program
    if(e.getSource() == butSend)
    sendImage(img);
    /* ========================== initSocket ================================
    * Set up the socket connection to the server.
    * 1: connect to the server at <host>, <port>.
    * 2: getOutputStream() will return an output stream for our socket (ie
    the stream is FROM the client TO the server. Since we want to send
    Image objects to the server, we need to create a stream which can
    send object, ie. an ObjectInputStream.
    3: getInputStream will return an input stream for our socket (ie. stream
    is FROM the server TO the client. We use this to create a stream that
    can transmit formatted characters.
    protected void initSocket(String host, int port)
    try{
    toHost = new Socket(host, port); //1
    //always do OUT then do IN
    objectOut = new ObjectOutputStream(toHost.getOutputStream()); //2
    in = new ObjectInputStream(toHost.getInputStream()); //3
    sendObject(bimage);//here got problem ba
    Object input = null;
    try{
    while((input = in.readObject()) != null) //test whether object is null
    Image img = (Image)input;
    sendImage(img);
    }catch (Exception e){}
    toHost.close();
    catch (UnknownHostException e)
    System.err.println("Unknown host in initSocket()");
    catch (IOException e)
    System.err.println("IO error in initSocket()");
    /* =========================== sendObject() ==============================
    * objectOut is the ObjectOutputStream. To send an object across the stream,
    * use the writeObject() method of ObjectOutputStream. The flush() method
    * ensures that data is sent.
    protected void sendObject(Object obj)
    try{
    objectOut.writeObject(obj);
    objectOut.flush();
    }catch(IOException e){
    System.out.println("Sending failed");
    System.exit(1);
    /* =========================== sendImage() ==============================
    * sendImage() creates the requested Image Object, then calls sendObject() to
    * send the image's width, height, and raw data to the server. The server uses
    * these to reconstruct the image, we could use the ImageIO class to read the
    * image file.
    * The getImage() method return immediately, even if the image data has been
    * fully loaded. Once the data is locked, the width and height, values using the
    * getWIdth() and getHeight() methods.
    protected void sendImage(Image img)
    int w,h;
    //get the image from the imagePanel and return the buffered image
    img = dImage.getImage();
    while ((w = img.getWidth(null)) == -1){}
    //System.out.println("Width of image: "+ w);
    while ((h = img.getHeight(null)) == -1){}
    int[] buffer = new int[w * h];
    /* The PixelGrabber class implements an ImageConsumer which can be
    * attached to an Image or ImageProducer object to retrieve a subset
    * of the pixels in that image.
    PixelGrabber px = new PixelGrabber (img,0,0,w,h,buffer,0,w);
    try{
    px.grabPixels();
    }catch (InterruptedException ie){
    System.err.println("Pixels grab failed");
    sendObject(new Integer(w));
    sendObject(new Integer(h));
    sendObject(buffer); //buffer contains all the bytes for the image
    public static void main(String [] args)
    if(args.length != 2)
    System.err.println("Requirement Paramenters: <host>,<port number>");
    System.exit(0);
    String host = args[0];
    int port = Integer.parseInt(args[1]);
    IMclient is = new IMclient(host,port);
    IMserver.java-- file
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class IMserver
    Image images;
    public IMserver()
    try
    start();
    }catch (IOException ioe){
    System.err.println("Start Failed:"+ioe);
    private void start() throws IOException
    ServerSocket ss = new ServerSocket(22222);
    while(true)
    new ImageServerConnection(ss.accept(), images).start();
    public static void main(String[] args)
    IMserver im = new IMserver();
    class ImageServerConnection extends Thread
    //Declare the Input/Output object variable
    Socket clientSocket = null;
    ObjectOutputStream objectOut = null;
    ObjectInputStream inObject = null;
    Image img;
    /* ====================== ImageServerConnection ================================
    *ImageSeverConnection is a subclass of Thread. ImageServerConnection handles a
    * connection with a client. It has methods for initialzing a connection and for
    * receieving objects to clients.
    public ImageServerConnection(Socket client, Image img)
    clientSocket = client;
    this.img = img;
    /* ========================= run() ===========================
    * run() is overrriden from Thread. In this case, we call the
    * newSocket method to initialize the socket and perform initial
    * tasks.
    public void run()
    try{
    newSocket();
    }catch(IOException ioe){
    System.err.println("Socket failed: " + ioe);
    /* ========================= newSocket() ===========================
    * This is where we do all the client connection work
    private void newSocket() throws IOException
    inObject = new ObjectInputStream(clientSocket.getInputStream());
    //objectOut = new ObjectOutputStream(clientSocket.getOutputStream());
    getImage();
    clientSocket.close();
    /* =============================== getImage() =================================
    * getImage() assumes that a connection already exists to the server.
    * First, getImage transmits the image we want to get.
    * Then, we wait to read the 3 objects sent by the server's ObjectOutputStream:
    -- an Integer object, representing the width of the image
    -- an Imteger object, representing the height of the image
    -- an Image object
    * The first two are Integer objects, NOT primitive int types. This
    * is because the ObjectOutputStream can only transmit objects, not primitive
    * types (to transmit primitive types, use a DataOutputStream).
    * 1: Read the three objects sent by the server. Note each object must be cast to
    its appropriate type, since readObject() returns an Object. To get the value
    of an Integer object, we use its intValue() method, which returns the primitve
    int value of the Integer.
    * 2: The buffer object is an array of integers, which represents the image
    data. In other words, buffer is an array of integers in memory which is
    the source of the raw image data. Java has a special MemoryImageSource
    class which is used to construct Images from raw data in memory. So, in
    step 3, we create a MemoryImageSource object using the width, height, and
    buffer objects.
    * 3: We want to create an Image object using the MemoryImageSource object we
    created in step 3. To do this, we use the createImage() method of the
    Component class. Since this client class extends Frame, and Frame is a
    subclass of Component, we can call createImage() directly.
    * 4: Once the Image is created, it will be passed into the folder for storage
    private void getImage()
    Component c=null;
    try{
    objectOut.writeObject(img);
    objectOut.flush();
    int w = ((Integer)inObject.readObject()).intValue();
    int h = ((Integer)inObject.readObject()).intValue();//1
    int [] buffer = (int[])inObject.readObject(); //2
    Image img = c.createImage(new MemoryImageSource(w, h, buffer, 0, w)); //3
    //create an new folder to store those sent images
    File f = new File ("C:\\Sweet_Memory");
    //you can also check whether such folder exists or not.
    if (!f.exists ()){
    f.mkdir ();
    //how to store image into the file????
    }catch(Exception e){
    System.out.println("Server-side: "+ img);
    System.err.println("Receiving failed: "+ e);
    }

    The codes below have error message showing "IO error in initSocket() " which is in the initSocket method and "Sending failed" which is in sendObject method. HOwever i can't figure out why this error message is shown. Can anyone kindly help me out? Did i declare the wrong thing?
    Please clarify with me if i'm not clear, thank a lot. Any help will be appreaciated.
    IMclient.java
    public class IMclient extends JFrame implements ActionListener,ChangeListener
         // Declare all the Input/Output object variables.
        Socket toHost = null;
        ObjectInputStream in = null;
        ObjectOutputStream objectOut = null;
        public void actionPerformed(ActionEvent e)
          if(e.getSource() == butSend)
                sendImage(img);
        protected void initSocket(String host, int port)
            try{
         toHost = new Socket(host, port); //1
         //always do OUT then do IN
         objectOut = new ObjectOutputStream(toHost.getOutputStream()); //2
         in = new ObjectInputStream(toHost.getInputStream()); //3
         sendObject(bimage);
          Object input = null;
          try{
          while((input = in.readObject()) != null) //test whether object is null
                    Image img = (Image)input;
                   sendImage(img);
                  }catch (Exception e){}
         toHost.close();
                  catch (UnknownHostException e)
         System.err.println("Unknown host in initSocket()");
                  catch (IOException e)
         System.err.println("IO error in initSocket()");
    protected void sendObject(Object obj)
             try{
         objectOut.writeObject(obj);
         objectOut.flush();
             }catch(IOException e){
         System.out.println("Sending failed");
                         System.exit(1);
    protected void sendImage(Image img)
             int w,h;
             //get the image from the imagePanel and return the buffered image
             img = dImage.getImage();
              while ((w = img.getWidth(null)) == -1){}
              while ((h = img.getHeight(null)) == -1){}
              int[] buffer = new int[w * h];
               PixelGrabber px = new PixelGrabber (img,0,0,w,h,buffer,0,w);
               try{
                     px.grabPixels();
                }catch (InterruptedException ie){
                      System.err.println("Pixels grab failed");
                sendObject(new Integer(w));
                sendObject(new Integer(h));
                sendObject(buffer); //buffer contains all the bytes for the image
    public static void main(String [] args)
                if(args.length != 2)
                   System.err.println("Requirement Paramenters: <host>,<port number>");
                  System.exit(0);
                String host = args[0];
                int port = Integer.parseInt(args[1]);
                IMclient is = new IMclient(host,port);
    IMserver.java
    public class IMserver
         Image images;
         public IMserver()
               try
         start();
               }catch (IOException ioe){
         System.err.println("Start Failed:"+ioe);
          private void start() throws IOException
                  ServerSocket ss = new ServerSocket(22222);
                  while(true)
         new ImageServerConnection(ss.accept(), images).start();
           public static void main(String[] args)
         IMserver im = new IMserver();
    class ImageServerConnection extends Thread
             //Declare the Input/Output object variable
            Socket clientSocket = null;
            ObjectOutputStream objectOut = null;
            ObjectInputStream inObject = null;
             Image img;
             public ImageServerConnection(Socket client, Image img)
         clientSocket = client;
         this.img = img;
             public void run()
         try{
                newSocket();
         }catch(IOException ioe){
             System.err.println("Socket failed: " + ioe);
              private void newSocket() throws IOException
                     inObject = new ObjectInputStream(clientSocket.getInputStream());
                     getImage();
                      clientSocket.close();
               private void getImage()
                        Component c=null;
         try{
                  objectOut.writeObject(img);
                   objectOut.flush();
                     int w = ((Integer)inObject.readObject()).intValue();
                     int h = ((Integer)inObject.readObject()).intValue();//1
                     int [] buffer = (int[])inObject.readObject(); //2
                     Image img = c.createImage(new MemoryImageSource(w, h, buffer, 0, w)); //3
         }catch(Exception e){
                                System.err.println("Receiving failed: "+ e);
    }

  • Detecting the server url dynamically

    I am finding it difficult to get url of the server dynamically
    I am getting it through java script using window.location.host
    is it possible using java

    Hi,
    The solution depends on the specific WL version you are using, but chances are you should be looking at the constructor of the implementation of the service provider for your specific WS. There is usually a default constructor, and a constructor that takes an URI, this second one is the one you should use to set the URI to something different than the default URI.
    Regards,
    LG

  • I can not send messages because the server is wrong. but I also can not get into the server configurations

    Hello there
    I can not send e-mails because the server configurations are wrong, but I can not get into the configurations by the normal way

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try a Reset - iPad How-Tos  http://ipod.about.com/lr/ipad_how-tos/903396/1/
    Or this - Delete the account in Mail and then set it up again.
     Cheers, Tom

Maybe you are looking for

  • How to invoke the apo availablity check delivery proposal screen

    Hi All, I am creating an order in VA01 and require the automatic display of APO delivery proposal screen. At present i need to click on a button in VA01 to invoke this. I am aware that we need to set some parameter in SU3 for this, but i am not aware

  • How to configure "permitted actions" on bpel human task

    Hi, I trying to call suspendTask at human task from bpel. I get this message "Permitted actions are: [VIEW_SUB_TASKS, VIEW_PROCESS_HISTORY, RESUME, VIEW_TASK, WITHDRAW, VIEW_TASK_HISTORY]" Where i configure this "permitted actions" ? Thanks Victor Ja

  • Problem Installing Zen Xtra Software Suite HELP

    I have a Creative Nomad Jukebox Zen Xtra 40GB and I am trying to load my music onto it. I went to creative's site and installed the driver: Creative Zen and Jukebox Driver Upgrade version .30.03 After installtion I connect the device for the driver t

  • Power Pivot & Power Query

    I have very recently purchased yet another copy of Office, I now have every version from 97-2013, all Pro versions. I downloaded powerpivot for 2010 and that works fine. When I purchased (directly from MS) 2013 I thought powerpivot came with it as st

  • The Generic Extractor DataSource's TimeStamp table?

    We known the FI DataSource has the TimeStamp table BWOM2_TIMEST which provide two fields TS_LOW and TS_HIGH to store the Safty Interval information. I think the Generic Extractors DataSource may has the similar TimeStamp table too. If it is right, wh