Servlet and other websites

I am planning to create a webpage that will take in user input, pass the user input to a 3rd party website's perl script, and take the data output from it and format it into something more user friendly. I need to do this because the 3rd party website refuses to update their script to accomodate us. Changing the format of the output would save us a lot of time.
Is this something that can all be done inside a servlet? If not, is there a way for a servlet to pass the data to a normal Java application on the server, execute it, and wait for a response? I read some posts about application servers. Would that be necessary for my case?
I am new to Java servlets and I could not find out if a servlet could access 3rd party websites or execute applications on the server. Thank you for any help you can provide.

Connect to the URL of the external website and get its contents using something like the following.
private StringBuffer msg = null;
public boolean connectExternal(String urlString, StringBuffer msg){
    //Get the body footer from an external url
     BufferedReader fromURL = null;                              
     HttpMethod method = null;
     HttpConnection connection = null;
     String line = "";
     boolean serverUp = true;          
     try{                           
         HttpState  state    = new HttpState();
         Protocol   protocol = Protocol.getProtocol("http");
         URI        uri      = new URI(urlString);
         method   = new GetMethod(uri.toString());
         int        port     = uri.getPort();
         String     host     = uri.getHost();
         connection = new HttpConnection(host, port, protocol);                         
         connection.setConnectionTimeout(RTC_global.bPEATimeout); //unit is milliseconds
         connection.setSoTimeout(RTC_global.bPEASoTimeout);         //unit is milliseconds
         method.execute(state, connection);
         fromURL = new BufferedReader(
                          new InputStreamReader(
                                    method.getResponseBodyAsStream()));
          if(connection.isOpen()){
              while ((line = fromURL.readLine()) != null) {
                    msg.append(line);
         //Error returned by Cold Fusion server
         if(msg.toString().indexOf("Error Occurred While Processing Request")!=-1){
              serverUp = false;  //Flag to show file is not found
         fromURL.close(); 
         return serverUp;                     
     catch (org.apache.commons.httpclient.HttpException he) {
          serverUp = false;  //Flag to show server is down
          System.out.println("Remote host timed out at " + urlString +
                               " HttpException (apache): " + he);
          return serverUp;
     catch (org.apache.commons.httpclient.URIException urie) {
          serverUp = false;  //Flag to show server is down
          System.out.println("Remote host timed out at " + urlString +
                               " Bad URL - URIException (apache): " + urie);
          return serverUp;
     catch (InterruptedIOException iioe) {
          serverUp = false;  //Flag to show server is down
          System.out.println("Remote host timed out at " + urlString +
                               " InterruptedIOException: " + iioe);                         
          return serverUp;
     catch (FileNotFoundException fnfe) {
          serverUp = false;  //Flag to show server is down
          System.out.println("No Item Found - FileNotFoundException: " + fnfe);
          return serverUp;
     catch (IOException ioe) {
          serverUp = false;  //Flag to show server is down
          System.out.println("Remote host timed out at " + urlString +
                               " Bad URL - IOException: " + ioe);
          return serverUp;
     finally {          
         method.releaseConnection();
         connection.close();     
}

Similar Messages

  • MacBook Pro issues connecting to Gmail, Facebook, and other websites

    Hi,
    In the past week or so, I have had problems connecting to Gmail, Facebook, and other websites on my MacBook. When I try to open Gmail, I get the following message "Safari can't verify the identity of the website "accounts.google.com". The certificate for this website is invalid..." etc. It asks if I want to connect anyways, and I do, but then once I'm on Gmail, I can't use gchat and all of the buttons (delete, reply, etc) are blank. When I try to connect to Facebook, I just get a mostly blank page. I'll include screenshots in case that's helpful.
    When I try using Firefox, it doesn't allow me to connect to either website at all.
    I hope someone can help me with this issue!

    On your iMac, open System Preferences > Date & Time  then select the Date & Time tab.
    Make sure:  Set date and time automatically is selected.
    Then select the Time Zone tab.
    Make sure:  Set time zone automatically using current location is selected.

  • IOS 8 - pictures not uploading in safari for facebook and other websites?

    IOS 8 - pictures not uploading in safari for facebook and other websites? I just upgraded to IOS 8 on my iPad 3 retina display and when I try to upload pictures in safari for facebook, the picture upload just stalls and never completes. This happens in other sites as well. How can I fix this? Is anyone also experiencing this issue???

    Hi Hindhaughlee, <br />Thanks for the post.
    This may not be the best place to post such a solution but maybe some users will find it. If it turns out to be a major problem with a simple solution maybe we will manage to document it somewhere.
    Are you able to provide more details please:
    * exactly what software and software versions is the problem with ? <br /> You appear to be a Windows 8 user, but presumably the Kaspersky software may be applicable to other Windows versions, which Kaspersky software is this tested with ?
    * What is he exact error message or warning that Kaspersky generates in this situation ?
    * is the problem documented elsewhere, preferably in a public open site, if so maybe you could provide a link
    * can you detail simple but exact detailed Steps To Reproduce that will enable others to test out this problem and solution.
    Cheers
    John <br /> <sub>One of the forum moderators J99<sub>
    P.S. <br />
    Anyone with this problem finding that the solution works may wish to vote for this thread and solution. Or if someone else can produce links to examples of this or you are able to give precise Steps To Reproduce please add a post of your own.

  • Have reset Firefox & completed all of steps in "Flash video won't play full screen on YouTube, Facebook and other websites", but video still won't work. Help!

    I have reset Firefox, completed all the steps in "flash video won't play full screen on YouTube, Facebook and other websites". And the video still won't play in full screen. It will play, but frequently stops or sound continues and picture freezes. I have noticed that if I continually move my mouse, it plays fine. All these videos play fine in IE and Chrome.

    Some problems with Flash video playback can be resolved by disabling hardware acceleration in your Flash Player settings. (See [[Flash Plugin - Keep it up to date and troubleshoot problems|this article]] for more information on using the Flash plugin in Firefox).
    To disable hardware acceleration in Flash Player:
    #Go to this [http://helpx.adobe.com/flash-player/kb/video-playback-issues.html#main_Solve_video_playback_issues Adobe Flash Player Help page].
    #Right-click on the Flash Player logo on that page.
    #Click on '''Settings''' in the context menu. The Adobe Flash Player Settings screen will open.
    # Click on the icon at the bottom-left of the Adobe Flash Player Settings window to open the Display panel. <br/> <br/>[[Image:fpSettings1.PNG]] <br/>
    # Remove the check mark from '''Enable hardware acceleration'''.
    # Click '''Close''' to close the Adobe Flash Player Settings Window.
    # Restart Firefox.
    This [http://www.macromedia.com/support/documentation/en/flashplayer/help/help01.html Flash Player Help - Display Settings page] has more information on Flash Player hardware acceleration, if you're interested.
    Does this solve the problem? Let us know.

  • How do I get rid of 97] in Cookies and other website data

    When I open Preferences/Privacy and select "Details" under "Cookies and other website data" the first entry which pops up is
                 97] plug-ins
    If I highlight this entry and click remove, It is removed for perhaps 10 seconds, and then re-appears in the list.
    1- What is this?
    2- How do I get rid of it?
    This is clearly a prvacy issue, or Apple would not be listing it in this listing with the associated warning.

    Linc Davis wrote:
    Log out, then log back in while holding down the shift key after you enter your login password. Keep holding until the desktop appears. That will prevent third-party add-ons from loading. Try again to delete that item.
    If you still can't delete it, and you still want to, proceed as follows.
    Back up all data if you haven’t already done so. Before proceeding, you must be sure you can restore your system to the state it’s in now. If you skip this step, no one but you will be responsible for the consequences.
    Quit Safari if it’s running.
    Step 1
    Select /Applications/Safari in the Finder and open the Info window. There’s a checkbox in that window labeled “Open in 32-bit mode.” If that box is checked, uncheck it. Close the window.
    Hold down the option key and select Go > Library from the Finder menu bar (Lion) or open the Library subfolder of your home folder (pre-Lion). Delete the following items from the Library folder (some may not exist):
    Caches/com.apple.Safari
    Caches/Metadata/Safari
    Saved Application State/com.apple.Safari.savedState
    Leave the Finder window open. Try Safari again.
    Step 2
    If it still doesn’t work right, quit, go back to the Finder, and move the following file to the Desktop:
    Safari/Bookmarks.plist
    Then delete the following items (some may not exist):
    Cookies/Cookies.binarycookies
    Cookies/Cookies.plist
    Preferences/com.apple.Safari.LSSharedFileList.plist
    Preferences/com.apple.Safari.plist
    Preferences/com.apple.Safari.RSS.plist
    PubSub/Database
    Safari
    Try again. This time Safari should perform normally, but your settings will be lost. Select File > Import Bookmarks from the Safari menu bar. Import from the bookmarks file you moved to the Desktop. Recreate the rest of your Safari settings. You can then delete the old bookmarks file.
    Note: This step will remove your Safari Extensions, if any, and their settings. If you choose to restore them, do so one at a time, testing after each to make sure you haven’t restored the problem.
    If you don’t like the results of step 2, you can undo it completely by quitting Safari and restoring the items you deleted in that step from your backup, overwriting any that were created in their place. You don’t need to restore the files you deleted in step 1.
    Ok... completed step1 with no change.
    went on to "part of "step 2...
    I kept the Bookmarks.plist, but then deleted the assortment of safari related Caches and Cookies
    Cookies/Cookies.binarycookies
    Cookies/Cookies.plist
    (I found several entries in Cache, but forgot to write down which ones I deleted ... sorry.)
    did not delete any of the preferences or the last two entries in your list above.
    Tried again and "the perp" was still there. "Remove all" on the Details tab did not change things...
    However, there were now only 2 entries -- the 97] AND my bank's entry (Chase)!
    Going back to the main privacy tab and clicking "Remove all Website Data" this time DID remove the last two entries.
    =====
    Now when I open the details tab, (I run my own webserver as my home page) Safari showed ONLY the cache entry for my server, no cookies.
    However, I then noticed something quite intersting.
    I left the details tab open and pulled to the side (the joy of having a 27 inch iMac) and naviaged to Apple.com
    and then to support and then logged in to here.
    As I was doing this. the Details window first showed, "Apple.com" .. Cache, Cookies, Local Storage
    but then virtually immediately poped up entries:
    doubleclick.net ... Cache
    edgekey.net ... Cache
    google.com ... Cookies
    Very interesting, both from the point of view that "details" was showing me what was happening in "real time."
    And the fact that, even with zero external ads, the web site, Apple.com, was inserting entries in the cache for doubleclick.net and edgekey.net. I can "almost" understand the "google.com" cookie, ecept for the fact that the search engine selected in the tool bar is "bing."... as I said "interesting."
    With this new "insight" on the Details screen, It may be possible to determine WHERE this 97] actually came from. However, I would still like an explanation of what it actually is.... since the "]" (right square bracket) character is evidently a "special character" for search engines -- google, Yaho and Bing all treat it the same way -- they ignor it.... even when the entire 3 character string is quoted -- "97]" -- the pages returned all are for entries with only 97 in them.

  • My apple 5th gen ipod is connected to wifi but still cannot access safari and other websites..can some1 help me out?

    my apple 5th gen ipod is connected to wifi but still cannot access safari,itunes and other websites. the ip address is not strtng wid 169 and i have reset the network settings also..can some one help me out

    The 169 IP address mans it did not correctly negotiate with the router:
    Does the iOS device connect to other networks? If yes that tend to indicate a problem with your network.
    Does the iOS device see the network?
    Any error messages?
    Do other devices now connect?
    Did the iOS device connect before?
    Try the following to rule out a software problem:                
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on your router
    .- Reset network settings: Settings>General>Reset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - Wi-Fi: Unable to connect to an 802.11n Wi-Fi network      
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    If still problem and it does not connect to any networks make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar

  • Why won't the "block cookies and other website data" setting work on Safari 7.0.2?

    Why doesn't the "block cookies and other website data" setting on Safari 7.0.2 work?  Everytime I try this setting, I still get cookies and other data that needs to be deleted from my computer.

    This has been the case for sometime.
    There is no effective way to block these cookies.
    Try this, may help.
    Safari > Preferences > Security > Cookies and other website data:
    Press "Remove All Other Website Data:'
    Do this twice.
    Select "Reset Safari" from Safari drop down menu.
    Select only "Reset all website data".
    Click "Reset".

  • Can't open Facebook and other websites properly

    I have this problem that whenever I open Facebook.com and some other websites, it doesn't show the logo and the pictures, all I can see is texts in different sizes and different formats, kind of basic HTML website, need some urgent help, Thanks..

    hello mozes22, please go through the steps covered in [[Websites look wrong or appear differently than they should]] - they contain the most common solutions for the issue you've described...

  • Non-printing of maps and other website document printing.

    Since an update of Firefox (I don't know which one) I am unable to print maps and other online website documents. The maps comes up onscreen with no difficulty but when I choose "print map" the "print preview" and the actual print is blank. In the past the system printed everything with no difficulty. If I access the Internet with Explorer I can print with no problems.

    Try the '''''reset''''' described here:
    http://kb.mozillazine.org/Problems_printing_web_pages#Reset_printer

  • SOAP, servlets and others decisions?

    Hi?
    I?m developing a servlet application in an AS400 server which basically does some query in the DB
    In other web server (Apache, Linux), I have the web application which needs to request information in the AS400 DB.
    I was thinking to develop the communication between the AS400 servlet and Linux webserver pages with SOAP.
    My questions are:
    1.     What is the best way to send and request data from AS400 servlet and Linux Webserver? SOAP?
    2.     In this case I don?t know exactly what and how API I should use for it.
    3.     Where could I find documentation and example about it?
    Thanks a lot.
    Araujo

    The AS400 and the Linux server are in the same IP
    Network... and of course, both have a web server.
    Really my questions is about if SOAP is a good wayto
    send and receive data between these PC or if there
    are other better way to do that.
    Even before that you need to figure out ?
    1) Is the communication sych or asynch?
    2) SOAP though adds flexibility but it has its overhead costs, so you need to decide what your priorities are, extensibility, flexibility and decoupling or performance.
    3) SOAP and webservices are not synonyms, though SOAP is one form but there are other light weight options too, have you even considered REST?
    4) How about JMS or MQ, in case you are using app server? Asynch communication and guaranteed delivery has its own advantages and your app is still decoupled and following SOA architecture.
    In short there are tons of ways to integrate, whole books have been written on enterprise integration, you need to first figure out what your requirements are. There is no magic bullet and SOAP by no means is a solution to everything.

  • Problems accessing Microsoft and other websites

    I've just bought and set up a new Toshiba laptop with Vista. When searching the web I can't access any Microsoft sites, MSN Messenger won't load and run properly and can't access other sites, such as the BBC iPlayer TV replay site. I've tried using both IE7 and Firefox but neither work.
    Can anyone suggest a fix?

    Hello
    What Toshiba notebook you have exactly?
    At the moment its really hard to say what the reason is for this...
    Can you access other websites like Google or Toshiba?
    What happens if you start the command line and type ipconfig /all?
    Greets

  • Videos on yahoo and other websites wont play

    Yahoo videos and videos from other websites won't play. I am thinking it's because of adobe flash player but I updated it and I still cant watch videos. Yes youtube works.
    Speed dial isn't working right either. It's an add on. It wont let me add a website to the dial. already tried uninstalling and reinstalling this.

    You can check for problems caused by a recent Flash 11.3 update and possibly downgrade to Flash 11.2 or 10.3.
    *https://support.mozilla.org/kb/flash-113-doesnt-load-video-firefox
    *https://support.mozilla.org/kb/flash-113-crashes
    *http://blogs.adobe.com/asset/2012/06/inside-flash-player-protected-mode-for-firefox.html

  • How can I set Safari 7.0.3 NOT to save logins and other website info

    After using Firefox for a very long time, am trying to use Safari pretty exclusively.  I would like to know how to set it to NOT keep any passwords, logons, etc., and have looked in prefs and don't see a way to do that. Surely Apple has that in Safari???  When I return to a website I logged into the day before, it automatically logs me in, and I do NOT like that.
    Thanks.

    From the Safari menu bar click Safari > Preferences then select the Passwords tab.
    Deselect:  Autofill user names and passwords
    Then hold down the Shift key and select all Websites llisted then click Remove All.
    To avoid autofill on sites, open Keychain Access located in Applications > Utilities
    Select Passwords on the left.
    Type in the name of a website that autofills.
    Then right or control click that keychain then click Delete.
    Ditto for others.

  • Firefox will not load https (and other websites)

    Hello everyone.
    I'm running Firefox 18.0 on Windows 7 (64bit). Out of the blue, it started not loading certain webistes. It just spits out blank pages, or does not react when clicking login buttons. The web console will display a GET-message [for facebook: http/1.1. 302 Found 174ms], but hard reloads (CTRL+F5) do not help either.
    So far, I have encountered problems with :
    - Facebook (blank page)
    - Amazon (will not react upon "login")
    - GMX (will not react upon "login")
    - Mozilla.org (will not let me download Firefox anew OR create a support account)
    - My university's library catalogue (will not react upon "login")
    - Any of my university's https://-pages
    - The Google search in the Firefox task bar.
    - EDIT: The e-mail confirmation link this board has send me will not load either.
    They will load in Internet Explorer, so here's what I did:
    - EVERYTHING from the "Firefox can't load websites, but other browsers can" page, including
    Removing and readding FF to my Firewall exceptions,
    changing proxy settings,
    Dis- and enabling IvP6 settings,
    DNS Prefetching,
    Clearing cookies, history, browser cache and network cache,
    full system scan
    - Deleting and Reinstalling Firefox
    - Dis- and enabled SPDY in about:config
    Please help. I'm at the end of my rope. Thanks.
    EDIT: The websites work if I start FF in safe mode. Hope this leads to something.

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • The 'Add to Basket' button on Amazon is not visible. Occurs with earlier versions of Firefox and other websites.

    On many websites, buttons are not visible but moving the cursor over them it changes to a hand so I know there is a button and the tooltip appears.
    If I look at page info for the button it is shown as a transparent-pixel.

    I have reset to Firefox defaults and problem has been fixed. Options>content>colours>allow pages to choose colours : if deselected, problem occurs, if selected it is fixed.

Maybe you are looking for

  • How can I resolve OSStatus Error 13 on Time Machine when connecting to Time Capsule on Lion?

    This is a semi-rhetorical question: I have now resolved this for my own setup, However, there was very little information on this error in the fora, so I thought I would post my experience with getting a Time Capsule (2TB, 3rd edition) to work on OS

  • Finder changes the file name in Save/Save As dialogue box

    Whenever I save or save as a file, the dialogue box opens, but when I make the file list active when using a mouse, the file name I click to changes the file name I am saving. I simply want to activate the file list window so I can find the right fol

  • Eyedropper Change in Curves Adjustment Layer

    In earlier versions of PS when you opened a curves adjustment layer and hovered over the image the cursor was an eyedropper, and when you held down the mouse key a point appeared on the curve showing the where that spot on the image fell on the curve

  • Data Base editing

    Hi. A client wishes to add a data base to his web site which I designed and do the admin for using Dreamweaver MX. But he wishes, along with another colleague using her own PC to be able to add and delete info to and from the data info on the web sit

  • Error loading template 0BROADCASTING_TEMPLATE

    Hello Everybody, When i go to Business Explorer - Web Application Designer - Publish and click on In BEx Broadcaster ,an error message is displayed when this is loaded saying : Error loading template 0BROADCASTING_TEMPLATE Can somebody plz tell why B