Caching URL contents

I have a program that needs to download several large Jar files that contain resources. It would be nice if these could be cached locally so that I don't have to keep hitting my server. My Apache server is setting Expires info on my files to be 2 months after the access time, but no matter how many times I hit my server, I get a 200 OK message returned instead of a 304 Not Modified.
I intend to eventually use this in a WebStart application. Can I have Java cache these files locally and only update them if the timestamp on the server changes? Without violating my sandbox?
Mark McKay
import java.net.*;
import java.util.*;
* @author kitfox
public class URLTestMain
/** Creates a new instance of NewMain */
public URLTestMain()
* @param args the command line arguments
public static void main(String[] args)
try
URL url = new URL("http://www.kitfox.com/text/text.html");
URLConnection conn = url.openConnection();
System.err.println(conn.toString());
System.err.printf("Content Encoding %s, Content length %d, Content type %s, Default use caches %b, Expiration %d, If ModifiedSince %d, Last MOdified %d, Use Caches %b\n\n",
conn.getContentEncoding(), conn.getContentLength(), conn.getContentType(), conn.getDefaultUseCaches(),
conn.getExpiration(), conn.getIfModifiedSince(), conn.getLastModified(), conn.getUseCaches()
Map<String, List<String>> headers;
System.err.println("Header Fields");
headers = conn.getHeaderFields();
for (String key: headers.keySet())
List<String> list = headers.get(key);
System.err.printf("Header '%s'\n", list);
for (String ele: list)
System.err.println("\t" + ele);
//Download file
Object obj = conn.getContent();
catch (Exception e)
e.printStackTrace();
}

Check the http documentation re: request headers. I've got a feeling there's a header or similar which says "only retrieve this document if modified".

Similar Messages

  • Cache server-Content server

    Hi,
        1. What is the procedure to copy originals from local content server to central content servers located at different geographical locations. (There is a report  SAPKROTP, but i am unable to execute it). Even if copy it, will it display in DIR as two different files.
       2. About Cache server : As name implies it is a temp storage and based on reference from SAP help and few other documents, it is very clear that documents cannot be checked in cache server. Also We are not defining cache server in OAC0 and OACT settings. Hence Can we check-in originals in cache server?.
         If any of you have worked with multiple caching and multiple content server distributed environment, please mail me the document. My mail id is [email protected]
    Prasanna
    <b>Points will be awarded for useful answers</b>

    Hi Prasanna,
    A Cache Server is used to store copies of documents when they are accessed for the first time. As a result, the documents can be accessed again more quickly, since the contents are taken directly from the Cache.
    With Cache the Originals documents are stored in one location on content server. The copies in the cache can be replaced with newer content at any time.
    The Original document will still be located on the Content Server
    The Content Server can Retrieve the cache Content at any time
    As earlier i had told you that any number of content servers can be installed in different locations. The contents are transferred directly b/w the client & content server. If the Content server are accessed from different locations that are linked via WAN cache servers should be used.
    You need to install one Cache Server at each location on WAN for enhancing the performance & Reducing the traffic in Network. So Cache server is used only for speeding up accesses of documents stored.
    For Customizing the Multilayer Cache Servers & Content Servers follow this SAP NOTE <b>0216419</b>
    Hope following this Note will help you & solve your problem.
    Regards
    Rehman
    Reward Your Points If Useful

  • Result cache latch contention

    Hi,
    Apologies for double posting!
    I had posted this query to the SQL and PL/SQL forum last week.
    Result cache latch contention: http://forums.oracle.com/forums/thread.jspa?threadID=1553667&tstart=0*
    Posting it here again as I am trying to better understand the RC Latch behavior before using it in our production system.
    Thanks!
    Edited by: kedruwsky on Oct 10, 2010 9:32 PM

    sb92075 wrote:
    Latches exist to manage potential contention.
    What else do you not understand?
    Since latches exist, they will used used regardless if you understand or not.That was profound!
    Did you check the results of the 3 test cases that were executed to check how the RC Latch was used?
    Results of the test cases show how many times the latch was acquired (per invocation and throughout the iterations).
    I want to understand the why behind the results?
    i.e. 2 latch GETS per request and acquire/release of the latch when there is a change in the request signature.
    Also, result of test case 3 does not fit with the observations of test case 1 & 2.
    Concurrent executions of the test cases have shown degraded performance.
    Thus, I am not ready to implement this feature until I understand how it works and if there are any ways to reduce the contention.

  • What does the "Only cache local content" box do under Caching Server?

    Just upgraded to Mavericks server, but I don;t understand what the "Only cache local content option" does? Does that mean it caches content on an on-demand basis, or dowloads all availavle updates?
    Thanks!
    Joel

    https://help.apple.com/advancedserveradmin/mac/3.0/#apd5E1AD52E-012B-4A41-8F21-8 E9EDA56583A
    I suppose it's hidden in the Key 'PeerFilterRanges'
    When PeerFilterRanges is boolean true, the caching server does the same as the above but uses the ListenRanges rather than the PeerFilterRanges value.

  • Url.Content on Azure

    I have an ASP.NET MVC 2 application that has page with a link to a pdf file
    <a href="<%= Url.Content("~/Downloads/test1.pdf") %>">test1</a>
    Downloads directory is at MVCApplication1/Downloads
    This works fine locally and on ISS, but returns a page not found when uploaded to Azure.

    Hi,
    Please check the below link as it has the same issue answered.
    http://stackoverflow.com/questions/5076846/url-content-on-azure
    Regards,
    Mekh.

  • Retrieving an URL content in ABAP

    Hi Experts,
        I have to read the content of http://.......... URL content to ABAP. Is there any method or function module to read??
    Thanks and regards,
    Venkatraman.N.

    Hi!
    Take a look at the folliwing programms and examples:
    RSHTTP*
    They work really good.
    Best regards,
    Esteban

  • Cache Web Content doesn't show how much?

    When in the Network tab, the cache web content doesn't show how much content is used, the line is missing. I tried clicking on the clear button but it doesn't work.

    Make sure that you do not run Firefox in permanent Private Browsing mode.
    *https://support.mozilla.org/kb/Private+Browsing
    To see all History and Cookie settings, choose:
    *Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    *Deselect: [ ] "Always use private browsing mode"

  • Content Engine caching video content?

    I am currently running ACNS version 5.5.11.2 on a CE510 Content Engine. I recently had to replace the unit and when I set up the partitions for the new build, I elected to go with CE510#disk config sysfs 10% cfs 45% mediafs 45%.
    Before the cfs was setup to use the whole box. I was thinking that the mediafs partition would start to cache video content. Does that happen automatically or is there some other setting to make that happen further. How do I determine if it is getting any use?

    A content engine can cache files transfered via ftp but not https [as the content is encrypted].
    It can cache whatever file, including video, audio, ...
    Content routing, content switching are just names.
    They refer to how the traffic will be intercepted and forwarded to the content engine.
    You could simply use a proxy solution and have your users setup their browser to use the content engine as a proxy, or you could transparently intercept http/ftp traffic via a router running wccp, or you could use a Layer7 device like a CSS to intercept the traffic and redirect to the content engine.
    Regards,
    Gilles.

  • When Cached Web Content reaches about 30-50 MB, webpages are loaded incomplete

    Webpages are incomplete: only headlines HTML style, no pictures, etc.
    After emptying the cached web content, page load fine. Until 30-50 MB is reached, etc.

    Reload the webpage while bypassing the cache using '''one''' of the following steps:
    *Hold down the ''Shift'' key and click the ''Reload'' button with a left click.
    OR
    *Press ''Ctrl'' + ''F5'' or ''Ctrl'' + ''Shift'' + ''R'' (Windows and Linux)
    *Press ''Command'' + ''Shift'' + ''R'' (Mac)
    Let us know if this solves the issues you are having.

  • Caching static content in ADF

    Helllo ,
    I'm using Jdeveloper 10g ,
    I hope If any one can help me in caching static content in my page " Images and CSS and JS libraries "
    I use The AFC library and the page cach the static content for the same window , but if I open new window the page will load the static content another time is that " browser caching "
    I want to cache this content in the client PC not in page Scope only .
    and If I have miss understanding for caching concept I will be owe to you if you give me the correct concept
    rgds

    Hi,
    the AFC provides server side caching in that the dynamic parts are not re-build if not required. On the client side its the browser that usually takes care of the content caching
    Frank

  • How to cache a content item like a Static HTML Page from UCM to Coherence/C

    Hi All,
    How to cache a content item like a Static HTML Page from UCM to Coherence/Coherence Web?
    Thanks

    Hi,
    Could you explain your use case in more detail?
    It does not look like proper use of coherence to cache static content - it more suited for dynamic content like user session etc.
    Adam

  • BC.Next Caching With Content Holders and Includes

    I noticed that the BC.Next caching on scripts, css and images doesn't appear to work with content holders and includes. I assume that is just something that still needs to be worked on?
    Thoughts?
    Thank You!

    Hi Liam,
    Static content covers images, styles and scripts from pages and templates. Blogs are not supported at this point. We'll follow-up on that as we will be adding a method to cache some content from modules as well. But for now, pages and templates represent a huge chuck of the BC content and we wanted to start with that first.
    Cristinel

  • Retrieving URL content in ABAP

    Hi Experts,
        How can I retrieve the URL content of a website in ABAP.
        i.e., In a webpage if write click and press "View Source", the HTML source code will come. That source code I have to take with the aid of URL of the webpage. I know how to do this in Java & .NET. but I need in ABAP.
    Thanks and regards,
    Venkat

    Hi,
    check this.
    link:[Re: Generate SAP Portal URL in ABAP;
    hope u'll get some help.
    Regards,
    Sneha.

  • Could not find the cached URL in sys_panama.log

    I'm running 9iAS 90210 on Solaris, and I'm regularly seeing the above message in the sys_panama.log.
    This happens when I've been running a HttpAdapter service, and have left it for 5-10 minutes. If I then come back to my service and try and do something, e.g. click a link or button, I get sent back to the main Wireless service menu, and my user login session is invalidated. I also see the above message in the sys_panama.log.
    I think this is some kind of service timeout that I keep hitting. Is there any way of changing the timeout period for a service?

    Neil,
    URLs are compressed with a key value. If the session has been expired due to inactivity, the runtime will log a "cached url not found" message in sys_panama.log when user clicks on the cached URL on the handset w/ the "expired" key value which will lead to the home page. This is an expected behavior.
    You can extend the timeout by extending the default OC4J session timeout period.
    Regards,
    Peggy

  • Any way to write code to cache the contents of the scripts menu? (or force ScriptsMenu plugin start)

    In the scripting forum I created the thread Adding custom scripts to actions revisited - Partial workaround
    Basically, you can create actions with keyboard shortcuts to execute custom javascript/vbscript, etc. and successfully reload them after restarting Illustrator but only if the user manually navigates to File->Scripts before manually loading an actions (.aia) file
    Any script menu items added to actions will be stripped from the custom actions when Illustrator is restarted because, I believe, the script menu items are not cached and are therefore invalid when the actions are automatically reloaded.
    Obviously, I'd prefer not requiring the user to navigate to the scripts menu and replace the actions every time Illustrator is started.
    Does anyone have any ideas on a way to write code so that Illustrator caches the contents of the scripts menu? Preferably this would be before the actions are loaded so they don't get invalidated and need to be reloaded in the first place. A keyboard macro would likely execute to late to be of much help.
    If anyone knows anything about the actual mechanism of caching the scripts menu or knows of anything else relevent to this please respond.
    Thanks!
    Edit: The menu is created in the Scripts Menu plugin (ScriptsMenu.aip). Perhaps there is no "cache" of the menu and the plugin just doesn't perform the startup until you browse to the File->Scripts menu?
    AIMenuGroups.h has the global definition of the group:
    #define kScriptsMenuGroup         "ScriptsMenuGroup"

    Have you looked at stored outlines ? They are for plan stability.
    Also you may want to look little deep on where your statistics are going wrong.
    I would recommend using below hint and checking where is difference in estimated(E-Rows) and actual number(A-rows) of rows. This may point out some incorrect stats.
    e.g.
    select /*+ gather_plan_statistics */ * from dual;
    D
    X
    select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));
    Plan hash value: 272002086
    | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
    | 1 | TABLE ACCESS FULL| DUAL | 1 | 1 | 1 |00:00:00.01 | 3 |
    ------------------------------------------------------------------------------------

Maybe you are looking for

  • Using LIKE command in SQL

    I am trying to select on a column where the name is something like .. NAME_AP_LAST. I want to find only columns that would have the AP in it .. I tried the following name like upper('%_AP_%') but it brings back more than I need ... it seems to bring

  • PDF - Weder Druckvorschau noch Druck möglich aus IE 10

    Hallo! ich administriere ein Unternehmen und habe folgendes Problem: PDFs lassen sich im Internet Explorer (Vers. 10) öffnen, jedoch nicht drucken. Weder über die PDF-Schaltfläche, noch STRG-P. Es wird keine Druckvorschau angezeigt, es erfolgt keine

  • Itunes wont open more complicated

    Two users One was created as test for pc problems Other one was me In the test itunes is empty And it wants to erase shufle In the was me itunes doesnt open The backup is erased by virus The backup hard drive shows empty and is not recognise by the p

  • Linksys WAG54GS Router - iBook G4 Cannot Connect When Encryption Enabled

    Hi - I have a HP laptop and Apple iBook G4 with a wireless connection transmitted through a Linksys Wireless router. When encryption is disabled, the iBook can pick up a signal and I can browse the internet, when WEP encryption is enabled, it cannot.

  • AppleScript  and QuickTime frame sequences

    Hi all. I've got some movies with foreign subtitles I want to convert to English. However, when I open them with QT Pro and choose the 'Movie Properties' window I see the subtitles are stored as images in a separate VobSub video track (not text). Big