Include External File

Hi,
I'm using RequestDispatcher include method to include HTML files in my servlet. What I want to do however is include HTML files situated on a separate server in a separate domain. However even though I preface the address with http://xxxx/myfile.html it still searches for the file from the doc root. Does anyone know how I can get it to include a file from an external server. (I am using iPlanet 4.1 btw).
Thanks,
Sean

If you read Javadoc for javax.servlet.RequestDispatcher and the various methods that one can use to get an instance of an object implementing this interface, it will be clear that it can be used only if the target resource is on the sane server as the one in which you are running your code in the first place.
For your purpose, you would have to use the facilities provided by java.net.URL, java.net.URLConnetion and java.net.HttpURLConnection to gather content from the remote resource and then place that contents into your own resource's HTML being generated yourself.

Similar Messages

  • How to include external files in JSP

    hi,
    How to include external files like image or javascript in to jsp pages.
    I am using MVC frame work. So i have to use request dispatcher. While calling the pages trough dispatcher the external files are missing from the output. Also am using tomcat as server,web.xml(deployment descriptor ) is also configured.
    regards
    sree

    When you use the request dispatcher, the relative path for all your ressources becomes the relative path of your calling serlvet and not the JSP/servlet that you call. Make sure to use the full relative path such as:
    /PATH_TO_YOUR_DIRECTORY/myRessource.ext
    NOT
    SOME_DIRECTORY/myRessource.ext
    Jeff

  • How to include external files when building installer for a standalone executable?

    Hi,
    I was trying to build a stand alone executable from my Labview project and I was able to do it successfully.  Now I would like to include a few external .txt files in the installer. Those .txt files have parameters/constants that will be used by the program, and my program needs to load/read them when running.  For now I have to manually copy/paste them into the target machine, but I really hope the installer can do it automatically.  I see there is a "data" folder in the installer, and that's where I hope those .txt files can be added into.
    How can I do it? Can anyone give me some suggestions? Thanks!
    Rgds
    Harry
    Solved!
    Go to Solution.

    Norbert,
    I could not find "Add file" when right clicking the project. See attached image please. Under "Project" I do have a "Add to project" but there is no option for external files. I did not find "Source" location either.
    What did i do wrong? Is there any version requirement here? I have a 2010 base version. Thanks for your help.
    Rgds,
    Harry

  • What is the best way to include external files in an application?

    I am developing a vocabulary-training program (Adobe AIR using Flex Builder 3). Asks you what an equivalent of a czech word is in english and the other way. I am storing the "dictionaries" in external XML files. I would like to include about twenty of them in the installation. So far I just had them in the applicationDirectory, but now, I added an editing feature and I ran across the fact, that I cannot write into the applicationDirectory. So I figured the most intuitive place for the dictionaries would be in the documentsDirectory/name of program. However, how do I tell the AIR installation to make the according folder and include the files?
    How do I do this, or what do you think is a better solution? Thanks!

    If this post answers your question or helps, please mark it as such.
    I'm creating an application that stores data in the "applicationStorageDirectory".      
    Mac storage directory is <appData>/<appId>/Local Store/
      where <appData> is user preferences folder, typically /Users/<user>/Library/Preferences
    Win: storage directory is <appData>\<appId>\Local Store\
      where <appData> is typically C:\Documents and Settings\<userName>\Application Data
      Note: Vista uses "junctions", which behave like shortcuts but look just like regular folders.
        It is not possible to access them, and any attempt to do so will give you an "Access Denied" error.
        Here is the real folder location:
          C:\Users\<userName>\AppData\Roaming\ContactManager\Local Store\contacts.xml
    Linux: <appData>/<appID>/Local Store/    where  <appData>  is  /home/<user>/.appdata
    Here is how to code to read from and write to a file there in an AIR app:
    var contactsFile:File;
    var contactsXML:XML;
    var contactsXLC:XMLListCollection;
    var stream:FileStream;
    contactsFile = File.applicationStorageDirectory;
    contactsFile = contactsFile.resolvePath("contacts.xml");
    stream = new FileStream();
    if (contactsFile.exists) {
        stream.open(contactsFile, FileMode.READ);
        contactsXML = XML(stream.readUTFBytes(stream.bytesAvailable));
        stream.close();
        contactsXLC = new XMLListCollection(contactsXML..contact);
    }else{
        var outputString:String = '<?xml version="1.0" encoding="utf-8"?>\n<contacts>\n';
        for each(var xml:XML in  contactsXLC){
          outputString += xml.toXMLString();       
          outputString += "\n";
        outputString += "</contacts>\n";
        outputString = outputString.replace(/\n/g, File.lineEnding);
        stream = new FileStream();
        stream.open(contactsFile, FileMode.WRITE);
        stream.writeUTFBytes(outputString);
        stream.close();

  • How to include External files

    Am Developing an application using servlet jsp and jakarta tomcat 5. Am using MVC frame work also web.xml(deployment descriptor). I could not include script files and image files in my jsp page as its not getting those file although i specified the path currectly. plz help me.
    regards
    sree

    When you use the request dispatcher, the relative path for all your ressources becomes the relative path of your calling serlvet and not the JSP/servlet that you call. Make sure to use the full relative path such as:
    /PATH_TO_YOUR_DIRECTORY/myRessource.ext
    NOT
    SOME_DIRECTORY/myRessource.ext
    Jeff

  • Open file(including external file) problem on Lion

    I have a problem with AppleScript on Lion (OS 10.7) and cannot know what to do...
    I'd like to open an alias file which has some external files. (For example, adobe illustrator's .ai file with some .png or Logic Pro file with audio files) But I cannot do it, it was working perfectoly on Mac OS 10.6. It seems file system had changed on Lion....??
    Opening normal file on Lion >> it works.
    tell application "Finder"
      activate
              open file "test.rtf" of folder "scriptTest" of folder "Desktop" of home
    end tell
    Opening an alias of normal file on Lion >> it works.
    tell application "Finder"
      activate
      open file "testAlias" of folder "scriptTest" of folder "Desktop" of home
    end tell
    Opening an file with external files on Lion >> it works.
    tell application "Finder"
      activate
      open file "testWithImagefiles.ai" of folder "scriptTest" of folder "Desktop" of home
    end tell
    Opening an alias file with external files >> it works on 10.6 but NOT on Lion, just open the window ...
    tell application "Finder"
      activate
      open file "testWithImagefiles.ai" of folder "scriptTest" of folder "Desktop" of home
    end tell
    Is there any idea? 

    I'm not sure what the problem here is - your statement that it "just opens the window" doesn't mean much.  opens what window?  a FInder window? an new illustrator window? a window in your living room? (the last would be very cool, mind you...)
    at any rate, I think the problem is in some confusion over the word 'alias'.  In applescript, alias just means any file system referent: e.g. alias "HD:Users:yourname" is a path specification for your home folder.  file system objects that point to other file system objects are referred to as alias files.  so try one of these two versions instead:
      -- using alias file directly
              open alias file "testWithImagefilesAlias" of folder "scriptTest" of folder "Desktop" of home
      -- resolving alias file first
              open original item of (alias file "testWithImagefilesAlias" of folder "scriptTest" of folder "Desktop" of home)

  • HT201250 Can I include external drives to be backed up using Time Machine.  Not only do I want to back up my IMac, but I have several extenal drives for one iPhoto, one iTunes and one for other files & documents.

    Can I include external drives to be backed up using Time Machine?  Not only do I want to back up my IMac, but I have several extenal drives for one iPhoto, one iTunes and one for other files & documents.  How do I know if they are included in the backup process?

    Yes, if they are not exclude then TM backs them up.
    Allan

  • How to include external javascript file in an html

    hello
    i've an html file placed in apache/webapps/test folder this html file includes an external javascript file placed at same level
    i'm includind the file as
    <script src="file1.js"></script>but the file does not gets included
    but when the sam folder "test" is paste outside apache the html file including the external file runs properly.
    Thank You

    flounder wrote:
    cotton.m wrote:
    What's really pathetic is that this is your third cross post on this same stupid off topic topic.
    You are really a dumb f&#117;ck you know that?If they knew that they were a dumb f&#117;ck then they wouldn't be a dumb f&#117;ck!That's a logical and reasonable conclusion. Therefore I very much doubt that the OP is capable of it.
    Hmmm this is interesting. It now shows the entity escapes rather than their values when you quote.

  • How to include external .js file into .ear file using NetBean 5.5.1?

    is it possible to include external .js file into .ear file using NetBean 5.5.1? if not, then where should I placed the external .js file and how to write the src="xxx" element? (that is , how to write the path of "xxx"?)
    I am using JBOSS 4.2.2 GA as server
    thx!!

    Even this is also not possible because, the code in that package is developed by DWR and i am just adding it to my lib folder and importing the respective classes. In the same manner i need to include the *.js* file in the JSP.It took me about 3 minutes reading through the [DWR Getting Started|http://getahead.org/dwr/getstarted] page to learn that you don't have to do any of that. Perhaps you should read that page?

  • Including external javascript and css files in servlet

    Hello,
    I am struggling to generate an HTML page from within a servlet using external javascript and css files. I am not sure how to point the servlet to the external files.
    Any code sample to accomplish the above will be much appreciated.
    Thanks inadvance,
    Antana.

    Can't you just include the following in your servlet?
           response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Getting CSS</title>");
            out.println("<link rel='stylesheet' type='text/css' href='yourCSS.css' />");
            out.println("<script language='JavaScript' SRC='yourScript.js'></script>");
            out.println("</head>");
           //...

  • Strange problem displaying external files (css includes)

    Hope somebody can help me with this. First of all, I'm running mac os x 10.4.11 using dreamweaver 8.0.2.
    Just recently i've been unable to display any external files (namingly my css; attached as includes) when I open a local document. Tried to delete my "site cache" as well as re-creating the site prefs and made sure "Display External Files" is checked under COMMANDS. Still nothing. Anyone have a idea it just all of a sudden stopped displaying all external fles???

    Peter,
    I tried testing the RSS feed using a FeedReader, and it works with that. But, when I try feed the same URL ( http://rss.cnn.com/rss/cnn_topstories.rss ) as the XML source in the Omniportlet, I get the following error message:
    Error
    Failed to open specified URL. Check the following: is the URL is active; is there a valid proxy setting or, if HTTP authentication is required, check user name and password. [http://rss.cnn.com/rss/cnn_topstories.rss]
    Here is how the proxy is defined in the Provider.xml file:
    <proxyInfo class="oracle.portal.provider.v2.ProxyInformation">
    <httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>
    <httpProxyPort>80</httpProxyPort>
    <proxyUser>my Oracle Single-SignOn username</proxyUser>
    <proxyPassword>my Oracle Single-signOn pwd</proxyPassword>
    </proxyInfo>
    I am on the Oracle Intranet. So, please let me know how I could reach you offline, if you think that will make things easier to resolve this problem.
    I appreciate your help.
    Thanks,
    Kalyan

  • Including an External File

    I have an external file that contains a declaration of an ActiveX object that I need to include in several JSP's. The external file resides on a separate web server from where our applications reside.
    I can't use the Include directive or the <jsp:include> tag because they only permit relative URL's. I also have read that I can use the <c:import> action tag provided in the JSTL, but we do not use JSTL currently and it would require additional time to add that code to our applications and test it.
    Is there any other way to include this external file in my JSP pages?
    Thanks
    Tony

    Thanks for the help. It hasn't been decided where the external file will reside, but it will probably be on our mainframe running WebSphere so I don't think the second option will work.
    We were hoping that we could just add 1 line of code to our pages to pull in the external file to simply the development process, but that doesn't look like it will work. We might have to create a second file that can be referenced with a relative URL, and have this file use one of the URL Connection classes to get the first file and write out its contents.
    Anyway, thanks for the tips!
    Tony

  • How to include external JavaScript files

    Hello All,
    i'm wondering haow can i include externel JavaScrip files, there is an clip-example with a function in the same JSP file
    but not how to include a file?
    <body>
    <script language='JavaScript' src="menu/menu.js'></script>
    If some one has a clip i would appreciate.
    Thanks
    Gino

    <script src="resources/myscript.js"></script>
    I did this exact thing in my jsp but it did not work, nothing popped up.
    When I tried replacing it with:
    <script language="JavaScript" type="text/javascript"><![CDATA[
    function postMessage(message) {
    alert(message);
    ]]></script>
    It worked. Can someone tell me why? Can't i refer to javascript files this way?

  • Including external Javascript file in JSP- not working on Mozilla Firefox

    I have a JSP page which includes javascript file as below:
    <script type="text/javascript" src="https://siteAddress/scripts/myJsFile.js"></script>
    myJsFile.js has a method testFireFox()
    There is a link on JSP which that calls this method.
    <a href="#" onClick="testFireFox()">Some Text...</a>
    As soon as i click on the link, nothing happens and this error appears on console:
    Refrence Error: testFirefox() is not definedI tried giving the path for JS file in various ways but it did not help.
    Note: This works absolutely fine in Internet Explorer.
    I have not added Javascript to document.ready or onLoad event. It is simply been referred in <Head>
    tag any pointers pls..

    This forum is intended for user support, not for web development issues.
    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The contributors over there are more knowledgeable about web page development issues with Firefox.
    http://forums.mozillazine.org/viewforum.php?f=25
    You'll need to register and login to be able to post in that forum.

  • Flash CS5.5 & Air 3.1.0.4880 don't include huge amount of external files

    My project have included 72 files (36 pngs and 36 swfs) + 2 (main swf and main xml)
    Totally 74 files.
    Building from Flash CS5.5 return strange error with incorrect text codepage (charset).
    When I remove 2 files, so I will have 70 my files and 2 default app file - project builded successful.
    From commandline I can build without any errors any file count. But from Flash CS5.5 not more than 74 included files

    Sounds like this is a Flash Pro issue, but I'm glad the command line is working for you.  Would you mind posting about this on the Flash Pro forums?
    Thanks,
    Chris

Maybe you are looking for

  • Problems and bugs with ios 8.0.2 on iphone 4s

    After updating my 3 year old iphone 4s to ios 8.0.2, the UI became choppy (Same with ios 8 and ios 8.0.1). Few bugs i noticed even after updating to ios 8.0.2 (all done after restoring phone as factory new and loading few music/photos/videos loaded a

  • Sapphire HD 7950 on a 2009 MacPro - Aperture Performance

    Hi, Read a few palces here and in other forums but no definite word on the increase performance of the Sapphire HD 7950 over the ATI Radeon HD 4870 on a MacPro 2009. I wonder if someone that made the upgrade would mind comenting. I made a few upgrade

  • How to use bapi_applicant_create

    hello, can anyone help me use bapi_applicant_create .

  • Creating lines in a form during runtime

    I need to create some lines in a form canvas during runtime. How can i do that? Thanks for attemption.

  • Editor is not opening

    I have Photoshop Element 4, working well untill my problem. From the "Organizor" it refuses to switch to "Editor" with a message (rough translation from the French" : "Impossibility do connect to Editor". I have desintalled and reinstalled : same sit