Follow up to 'can I write from a URL Connection'

Hi,
I think the sender of the original post was trying to do what I am. Sorry but I didn't understand the reponse given so I'm posting my own question.
I have a survey applet that is intended for Intranet use only. The idea is to get the user to respond to a series of questions and then store the response, 1,2 or 3, as a string in a .TXT file.
Here is my code snippet for the connection :-
answURL = new URL(this.getCodeBase(),"answ.txt");
answWeb = answURL.openConnection();
answWeb.setDoOutput(true);
answWeb.connect();
answOutput = answWeb.getOutputStream();
PrintWriter out = new PrintWriter(answOutput);
out.println(allTheAnswers); // a String
out.close();
This compiles and runs without complaint but the output file is not updated.
Ideally I wanted to append to the file.
Reading other postings and Sun's tutorials I guess this is not possible, can I do this? or :-
1) Write a CGI script to take the input?
2) Write a servlet to take the input?
3) Make a socket connection to a server app that will do this?
4) Something else?
I need to keep the solution as simple as possible.
many thanks
Chas

Hi,
I think here you want take some input from the user and write it in a file which resides on the sever.
By opening an URL to a file you can only read the contents of that file, you can write any contents to it or append it.
So as you said either you have to have a
1. CGI script
2. Socket connection or
3. Servlet
on the server.
In the case of CGI script and Servlet you can use URL but in case of Socket Server you need to implement a socket client in your client application.
More details about Reading and Writing from URL and Networking please read Java Online Tutorial.
all the best,
Raj

Similar Messages

  • Can i write from a URLConnection ?

    Can i write from a URLConnection ?
    I can read but can i write on a txt file ?

    You can upload, just as you would upload from an HTML page with a form and a Submit button. That's what you can do.

  • Can't write to External HDD connected to AEBS

    +This is a repost from the SL Discussion...hopefully someone here can help...+
    I am logged in under my account, which is the Administrator Account. I am unable to write to Seagate 1 TB external HDD connected to AEBS base station.
    Under "Get Info"->Sharing and Permissions it reads "You have custom Access" and then shows just one account, "everyone" and this is a "Read Only" account. The format of the External Drive is shown as "Appleshare" (actual drive is formatted as NTFS so my Dell PC can read/write, which is functioning perfectly).
    I tried to change the "everyone" account to Read and Write but Mac 10.6.3 won't let me because "I don't have the necessary permissions".
    So then I tried to add another account (clicking the "+" sign) but it again rejects me because the account "isn't a valid name" although I am using my account name.
    I was able to read/write to this drive under Leopard but lost that function when I upgraded to 10.6.3. I can read the files on the drive and copy them to my iMac but I can't copy back to the drive. Is this a Finder problem?
    How can I get the permissions changed on this external drive so I can read/write from my Admin account?

    Okay, it is formatted as FAT32.
    I checked under Airport Utility and there are (2) accounts that have permitted access, Dad (Read/Write) and Mom (Read Only). The drive is not corrupted as I can read/write from the Dell PC without any issue and I can "Read" from my iMac.
    When I right click on the drive, "Get Info" and then check "Sharing/Permissions", there is only one account shown "everyone" (all small letters) with "Read" access. This account does not show up under "Airport Utility" so it is an account that Finder assigned.
    My other two accounts, that are correctly shown under Airport Utility, are not shown in Finder. It seems like this is a Finder Problem and Finder (under Snow Leopard) won't let me access the drive.
    So how can I change the Permissions in Finder? Even if Finder lets me add another account that can read/write, I'll be happy. But it won't let me add any accounts, it simply says "Invalid Account Name".
    I'll try the direct hookup to the iMac as a last resort but this drive has all of my photos backed up on it so I don't want to mess around too much with it. I have photos on other drives as well but it is a big pain to reload from the other drives...it is around 300 Gb of photos.

  • How can I write from an Include?

    Hi to everybody!!
    I've a problem with my include...inside of this I've to write '2'. for make this I put...
    write: '2'.
    But when I execute the program... the number 2 doesn't appears, somebody told me that I need to put the End-OF-SELECTION, but when I can't see it.
    Does anybody know how can I write something from an include?
    Thanks a lot.
    Regards,
    Rebeca

    Try this way...
    I don't where you placed the include , you place under the event and see.
    REPORT ZTEST.
    END-OF-SELECTION.
    INCLUDE ZINCLUDE.

  • Hello AppleSupport. I recently erased my disk, and i can't find my OS X Install CD. Is there a way i can get a free cd? I have a iMac 27''. Im writing from the recovery menu, since i can't write from anything else ;( Help me please ;(

    Hello!
    I just registerd here from my iMac computer running on? Nope, its not running on any OS, im writing from the recorvery menu ;(
    I erased my whole disk, and i lost my install disc that came with my 27'' iMac...
    I dont know what to do, i do not have any money on my Apple Account..
    Is there a way i can borrow a account from you? Or is there a way i can get a new cd sended to my adress?
    I live in Singapore.
    Thank you for reading, and hopefully we can get some good answers!
    Noztra

    International Technical Support Numbers
    http://www.apple.com/support/contact/phone_contacts.html
    I am unfamiliar with the recovery manager.  Here are two guesses.
    -- Is system profiler around?  It will tell you your serial number.
    Report system info
    Blue apple > about this Mac
    click on more info
    click on hardware
    You serial number will appear after Boot ROM.  Do not copy hear.
    --- The newer machines include a recovery partition.  Perhaps looking around recovery manager would reveal something.
    Robert

  • Can I write from a mac partition to a windows partition made with bootcamp?

    I already tried using chmod in terminal, is there something I'm missing there? or is there a different setting I have to change?

    Real easy you need NTFS driver for OS X from Paragon.
    BootChamp
    http://www.macupdate.com/app/mac/28468/bootchamp
    MacDrive
    http://www.mediafour.com/updates/macdrive
    Paragon HFS
    http://www.paragon-software.com/home/hfs-windows/
    Paragon NTFS
    http://www.paragon-software.com/home/ntfs-mac/

  • How can i airplay from my mac connected through ethernet to an aple tv 2 on wifi

    Hi everyone..
    im having troubles using Airplay on my mac.. i connect my mac to the internet and home network using an ethernet connection to my router (non apple branded router) .. my apple tv 2  is connected to my home wifi network from the same router.. when i first set up my apple tv.. i was able to see the Airplay icon on itunes and it would let me Airplay media from my mac to my apple tv.. however.. it disconnects after a little while.. same thing with viewing my itunes library from apple tv.. i was able to detect my shared library from the apple tv.. i was able to play some media but then it disconnected after some time.. but now.. the Airplay icon doesnt show up in itunes anymore.. and i cant see my shared library from my apple tv neither.. ive looked around for a solution and followed the tip to turn the ipv6 off.. it worked for some time but now the problem is back..
    i know the obvious solution is to connect my mac to the same wireless network as my apple tv.. but i would like to keep it connected through ethernet..
    Mac OS X Lion 10.7.4
    Apple TV 2 software version 4.4.4
    Thanks in advance

    thisguy. wrote:
    ......i know the obvious solution is to connect my mac to the same wireless network as my apple tv.. but i would like to keep it connected through ethernet.........
    I wouldn't say that was the obvious answer at all, my Mac is connected by ethernet and 6 of my 7 Apple TV's are connected by wifi, I haven't had any of your problems. The problem is most likely on your network.
    Intermittent problems
    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. Networks that have inherent issues can be seen to work differently with different versions of the same software. You might also try moving the Apple TV away from other electrical equipment.
    Consistent Problems
    A frequent cause of consistent failure to enable AirPlay or HomeSharing at all, is the service being blocked on the network. Make sure your network isn't hidden, has a unique name, that MAC address authentication is disabled, security is set to use WPA 2 Personal and that there is only one router/device acting as a DHCP server and providing NAT services.
    Make sure your router/computer allows access over the following ports
    Port
    Type
    Protocol
    Used By
    80
    TCP
    HTTP
    AirPlay
    443
    TCP
    HTTPS
    AirPlay
    554
    TCP/UDP
    RTSP
    AirPlay
    3689
    TCP
    DAAP
    iTunes/AirPlay
    5297
    TCP
    Bonjour
    5289
    TCP/UDP
    Bonjour
    5353
    TCP/UDP
    MDNS
    Bonjour/AirPlay
    49159
    UDP
    MDNS (Win)
    Bonjour/AirPlay
    49163
    UDP
    MDNS (Win)
    Bonjour/AirPlay
    Refer to your router manual/manufacturer for any settings that are specific to that model.
    Another frequent cause of consistent failure to enable AirPlay or HomeSharing at all, is security software, in many cases configuring it correctly, disabling it or even uninstalling it can help, but in some cases the security software can cause problems that simply reconfiguring, disabling or uninstalling cannot reverse.
    If you are consistently unable to activate AirPlay, have tried all the steps in this article and have security software installed on your system, you might benefit from contacting its provider or participating in any online forums they run to discuss the matter with them.

  • How can i write my printer URL

    My printer have a URL adress : http://192.168.1.1:1631/printers/printer_name . And i wont to write this URL to may iPad. So i can print my documents

    Deniz343-
    You say your printer is connected to a server.  Therefore the server, which is a computer, is always on.  You should be able to run a program on the server computer, that will share the printer over WiFi connected to the network.
    If AirPrint Activator doesn't meet your needs, look at FingerPrint <http://www.collobos.com/>.  I think you can download a demo version for free, to see if it works for you.
    Fred

  • How can i write a servlet to connect to a fixed url periodically?

    hello
    my company have domain name,but not have ip address,the public website host in a rented space in a public server.wihtin my company also have a internal website,it host in my internal network,the internal server can connect to the public server by ADSL.
    now we want my internal website is published to internet by a http link in my public website page,so that the other division of my company can visit the internal website, the critical is how can i make the public server learn my address.
    i plan to write a servlet in my internal web,it periodically connect to the public server,and in the public server,i write another servlet to get the tempory public ip address( by getRemoteAddr()method),but how can i implement the first servlet that is used to connect to the public server?
    thanks for any helps!

    because we don't have the static public ip address,we use the ADSL to connect to the internet,at every connection,you can get a temporary public ip,at same time,we wamt publish our internal website to internet,you must explose the ip address

  • I followed dirctions about dragging an icon from the URL, but my bank doesn't have a usable icon.

    I would like to create a shortcut to my desktop for my bank. However, the directions say to drag the icon in the address box to the desktop. My bank, for security reasons I guess, does not show an icon that will drag. How can I create a shortcut?

    You should still see the favicon as part of the Site Identity Button on the left end of the location bar if you have a secure https connection with your bank.
    * https://support.mozilla.com/kb/Site+Identity+Button
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • HP Officejet pro 8500A plus can not print from ethernet connect computer

    Setup:
    HP Officjet Pro 8500A Plus connected to a netgear wireless router using wired ethernet.
    Desktop with windows7 connected to the same netgear wireless router using wired ethernet.
    Can print from other computers connected to the the wireless router using wifi but can not print from this desktop connected using the wired ethernet.
    Can not print from the Windows7 PC which is connected to router over wired Ethernet. Printer is connected to the same router using wired Ethernet. Other notebook connected to the router over wireless prints.
    Windows7 device & Printerhows printer is ok.
     Once  a job is sent to printer, show status printing for a while after the status will show error.
    Now the status shows error
    HP Print and Scan doctors shows printer ok.
    But if you try to print the test page, unable to communicate to printer error comes.
    Tool box can read all information about the printer

    Please reload the drivers and software on the Win7 PC.  Reconfigure and try again. 
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • Ubuntu linux machine can not write to connected usb hard drive

    Hi, I bought a WRT610N router.  I connected my USB drive to it, and it is working fine with my Vista Machine.  However, my Ubuntu linux machine can not write to it.  It can read it great, but it can not write. If I connect the drive directly to the Ubuntu device, it reads and writes fine. 
    I've set all the permissiosn and such in the router setup.  I didn't need to do anything in Vista.  Is there something I need to do in Ubuntu?    I'm new to Linux so Imay have missed something.
    Thank you.

    Create a new admin user and give all permissions oj your router and check if you can write to it on your Ubuntu linux machine...

  • I'm unable to write/burn a CD-R (Verbatim) from a playlist after upgrading to iTunes 12.0.1.26. I get error 4000. I can however write/burn a CD from Windows Explorer and CDBurnerXP v4.5.4.5143 – which implies the device is working OK

    I’m unable to write/burn a CD-R (Verbatim) from a playlist after upgrading to iTunes 12.0.1.26. I get error 4000. I can however write/burn a CD from Windows Explorer and CDBurnerXP v4.5.4.5143 – which implies the device is working OK – and only fails when I write from iTunes.  The drivers are up to date
    Microsoft Windows 7 x64 Business Edition Service Pack 1 (Build 7601)
    Dell Inc. Latitude E6420
    iTunes 12.0.1.26
    QuickTime 7.7.6
    FairPlay 2.7.39
    Apple Application Support 3.1
    iPod Updater Library 12.0
    CD Driver 2.2.3.0
    CD Driver DLL 2.1.3.1
    Apple Mobile Device 8.0.5.6
    Apple Mobile Device Driver 1.65.0.0
    Bonjour 3.0.0.10 (333.10)
    Gracenote SDK 3.06.0.2770
    Gracenote MusicID 3.06.0.2770
    Gracenote Submit 3.06.0.2770
    Gracenote DSP 3.06.0.2770
    iTunes Serial Number 756D13C00C3583C8
    Current user is not an administrator.
    The current local date and time is 2015-01-13 14:47:35.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is supported.
    Core Media is supported.
    Video Display Information
    Intel Corporation, Intel(R) HD Graphics Family
    **** External Plug-ins Information ****
    No external plug-ins installed.
    iPodService 12.0.1.26 (x64) is currently running.
    iTunesHelper 12.0.1.26 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.
    **** CD/DVD Drive Tests ****
    LowerFilters: SbCeCd (3.2.6.3),
    UpperFilters: GEARAspiWDM (2.2.3.0),
    F: HL-DT-ST DVD+-RW GU40N, Rev A103
    Drive is empty.
    The last failed audio CD burn had error code 4000(0x00000fa0). It happened on drive F: HL-DT-ST DVD+-RW GU40N on CDR media at speed 24X.
    F: HL-DT-ST DVD+-RW GU40N, Rev A103
    Audio CD in drive.
    Failed Reading table of contents, error 4000.
    Check the website of your computer or drive manufacturer to verify that you have the latest firmware for your CD / DVD drive.
    Audio CD reading failed. Error Code:   87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87.
    iTunes cannot play or import music from a CD in this drive. The drive may need a firmware update. Check with the manufacturer.
    Get drive speed failed. Error Code: 4000.
    The last failed audio CD burn had error code 4000(0x00000fa0). It happened on drive F: HL-DT-ST DVD+-RW GU40N on CDR media at speed 24X.

    Hi iTunes-1,
    Welcome to the Support Communities!  The error message you posted indicates a possible firmware update is needed for iTunes for Windows to work with your CD drive.  
    iTunes for Windows: Updating the firmware on your CD or DVD drive - Apple Support
    http://support.apple.com/en-us/HT201852
    Having outdated firmware can cause issues using CDs and DVDs with iTunes for Windows. Firmware is a type of software stored in a chip in hardware that can sometimes be updated.Identifying drives and firmware versions
    To run CD Diagnostics, follow the steps in this document.
    After following the steps to run CD Diagnostics linked above, look at section three to find out more about your optical drive(s).
    Here is an example of what section three might look like:
    In this example there are two drives. Drive E is a Samsung DVD-ROM drive with a model designation of SD-616 that has firmware version F000. Drive F is an NEC drive with a model designation of NR-7900A that has firmware version 1.08.Updating the firmware
    If the optical drive you are using came with your computer, check with the support site for your computer for a firmware update. Typically you will need to go to the support website for the computer maker and click on a "downloads" or "updates" link, and then enter your computer model designation and operating system version to see what updates are available. Then look through the available updates for a firmware update for your optical drive. Download the updater and run it. If you need assistance applying the update, contact the maker of your computer.
    If the optical drive you are using came as a separate part (was not included with a computer), check the support site for the drive maker for a firmware update. Sometimes the manufacturer is not clear in the CD Diagnostics results. In that case, you may just have to search the Internet for the drive model designation. You can usually find out who made the drive by looking through the results of such a search. Once you have identified who made your drive, go to the support website for that company. Look for a "downloads" or "updates" link, and then enter your optical drive model designation. Download the updater and run it. If you need assistance applying the update, contact the maker of the optical drive.Verifying that the firmware was updated
    Run CD Diagnostics again.
    Examine the CD Diagnostics results. The firmware version for the drive should be the new version.
    Information about products not manufactured by Apple, or independent websites not controlled or tested by Apple, is provided without recommendation or endorsement. Apple assumes no responsibility with regard to the selection, performance, or use of third-party websites or products. Apple makes no representations regarding third-party website accuracy or reliability. Risks are inherent in the use of the Internet. Contact the vendor for additional information.
    Last Modified: Nov 8, 2014
    Also, you mentioned that you have been successful burning a CD with the Windows OS.  Make sure that you have closed all software programs that can access the CD burner so that there isn't a conflict for the drive.   Sometimes chaning the burn speed from "maximum" to 8x can also help in this situation.
    I hope this information helps ...
    - Judy

  • How can I write to a Siemens S7-300 PLC tag from OPC Server.vbai page by using a Knob object ?

    I am using NI OPC Server and I can read Siemens S7-300 PLC tags such as thermocouple values from the PLC. Additonally I can write manually a constant value to that tag by selecting it in the NI Distributed System Manager. And I can read the written value from NI Distributed System Manager or from NI OPC Server. But I can not write any value to the S7300 PLC tags such as by using a knob object at the NI Vision Builder AI Inpection (.vbai) page.
    Any help is welcomed. Thanks in advance.
    Attachments:
    manual_writing_to_plc.png ‏298 KB

    The tutorial at the following location explains how to use Vision Builder AI as a OPC server.
    https://decibel.ni.com/content/docs/DOC-18647
    http://www.ni.com/white-paper/13574/en
    To allow VBAI to connect to an OPC Server (i.e. act as an OPC client), you need to purchase and install the DSC Run-time System.
    Once installed, you can create an OPC I/O client using the Distributed System Manager, create variables bound to OPC tags, then create VBAI network variables that are bound to these variables.
    Another possible technical solution to connect to OPC Servers supporting Data Access 2.0 is to use the datasocket API in a Run LabVIEW step.
    http://forums.ni.com/t5/Machine-Vision/Read-and-Write-with-OPC-through-NI-Vision/m-p/2048278/highlig...
    Hope this helps.
    -Christophe

  • Can u write the following query without using group by clause

    select sp.sid, p.pid, p.name from product p, supp_prod sp
    where sp.pid= p.pid and
    sp.sid = ( select sid from supp_prod group by sid
    having count(*) =(select count(*) from product));
    thru this, we retrieving all the products delivered by the supplier.
    Can you write the following query without using the group by clause

      select sp.sid, p.pid, p.name
        from product p, supp_prod sp
       where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
    maybe if you can post some sample data and output will help us understand what you want to achieve.

Maybe you are looking for