Caching MIME types in browser using a servlet (independent of the app-code)

We are using jboss 3.2.6 app server to deploy an ear. To reduce the server round-trips and network latency, we created a servlet that caches various MIME types in the browser.
package foo.bar.nw.cache;
import java.io.IOException;
import javax.naming.directory.DirContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.servlets.DefaultServlet;
public class TomcatDefaultServlet extends DefaultServlet {
     protected void serveResource(HttpServletRequest request,
               HttpServletResponse response, boolean content) throws IOException,
               ServletException {
          super.serveResource(request, response, content);
          DirContext resources = getResources();
          String path = getRelativePath(request);
          ResourceInfo resourceInfo = new ResourceInfo(path, resources);
          String mimeType = getServletContext().getMimeType(resourceInfo.path);
          System.out.println("mime type = " + mimeType);
          if (mimeType != null
                    && (mimeType.equals("image/gif")
                              || mimeType.equals("text/javascript")
                              || mimeType.equals("image/jpeg") || mimeType
                              .equals("text/css"))) {
               response.setHeader("Cache-Control", "max-age=7200");
}The above code set the max-age to 2 hours. We created a jar file for the above class and deployed it C:\sw\jboss-3.2.6\server\<server-config>\deploy\jbossweb-tomcat50.sar
And also made the appropriate entry in the file C:\sw\jboss-3.2.6\server\<server-config>\deploy\jbossweb-tomcat50.sar\conf\web.xml.
The problem is that sometimes the 'expires' attribute of all the files in Temporary Internet Files shows date-time and sometimes it shows 'None'.
We tried using the code below but no luck.
response.setHeader("Expires", "Mon,18 Jan 2038 16:00:00 GMT");
Not sure on how to verify if they are getting cached on the browser (IE 6).
Any help will be appreciated.
- Rahul Mittal
Edited by: Rahul.Mittal on 16 Dec, 2009 4:53 PM

My appologies for posting it into wrong forum. It should have been posted to Web Tier APIs > Java Servlet

Similar Messages

  • I can't use Photobooth - when I open the app, I get the message: "Photo Booth couldn't save your photos - Photo Both encountered an error when trying to save your photos. You photos cannot be saved at this time."

    I can't use Photobooth - when I open the app, I get the message: "Photo Booth couldn't save your photos - Photo Both encountered an error when trying to save your photos. You photos cannot be saved at this time."
    i tried adding user macintosh hd/users/your_user/pictures/"photo booth"  but still photo booth is not working and even images in photo booth cant be deleted they keep coming back

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    I've tested these instructions only with the Safari web browser. If you use another browser, they may not work as described.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box markedAllow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click anywhere in the following line on this page to select it:
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). I've tested these instructions only with the Safari web browser. If you use  another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password. Nothing will be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take a few minutes to run, or perhaps longer if you have literally millions of files in your home folder. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1 or if it doesn't solve the problem.
    Boot into Recovery. When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Hacked Message: Your Apple ID was just used to download Podcasts from the App Store on a computer or device that had not previously been associated with that Apple ID

    So I just got a message from Apple saying
    "Your Apple ID was just used to download Podcasts from the App Store on a computer or device that had not previously been associated with that Apple ID"
    I am new to Apple products and signed up to the app store about an hour before but have not downloaded any apps yet.
    I also turned on iCloud Drive.
    Neither of these are Podcasts and I do not have any Podcasts on my device.
    The message is a really poor warning, it could for instance list the IP address which would immediately tell me if it was me.
    It could list what type of device it was.
    It could list what Podcast was downloaded.
    But no, just some random message, probably generated by the really bad default iPhone settings that put ease of use before security.
    I have a long complex password that I do not want ot have to change just because Apple generates a stupid message.
    On Google you have a log of all logins and devices, is there something similar with Apple, so I can figure this out?

    Kroll17 wrote:
    I don't know, I thought it was pretty clear
    "was just used to download Podcasts from the App Store"
    it said it was used to download a Podcast from the App Store
    I have not down downloaded any podcasts and there are no podcasts in the podcasts app, of course if Apple were to list the podcast that was downloaded, the IP address and the device it might help one dismiss the message.
    I am running the latest v8.1.1 although how the version of my OS related to a message generated by Apple servers is beyond me, unless my device is not authenticating properly so Apple thinks I am someone else but then as I have not downloaded any Podcasts that would not seem to be the issue.
    It does NOT say you downloaded a podcast. First, podcasts are not downloaded from the App Store; they are downloaded from the iTunes store.
    It's very clear to me; the app named  "Podcasts" was downloaded, not a podcast. "Podcasts" is a app provided by Apple for managing and downloading podcasts.

  • Use of half months in the company code configuration after  Go Live

    Hi,
    Our client has a requirement to activate the functionality of u201CUse of
    half months in the company code configuration in Asset accounting after 3 month of Go live.
    For the above purpose, we enabled the same in our Development server
    (DE5) after Go Live and we are getting some Errors at the time of Asset
    posting in F-90 and Asset Explore AW01N and even depreciation Run.
    Already we ran 3 months depreciation without enabling this
    functionality and now the client requires this in our Production server
    before running the 4 period depreciation.
    We are using the same Fiscal year variant (V3) at Depreciation area
    level for all our company codes. All other company codes enabled this
    functionality except one company code (NOPE) .
    So the client requires this Half month depreciation calculation
    Functionality in company code NOPE too.
    Please advice to resolve this issue at the earliest and its quit urgent.We are using the same depreciation key, asset class in all company codes.
    Thanks
    Man
    Error details,
    SYST: You cannot change the depreciation periods
    Message no. AA662
    Asset affected: 000016000025-0000
    Diagnosis
    Processing terminated because the number of depreciation periods in
    company code NOPE has been changed. However, you cannot change the
    number of periods in your live (productive) system.
    Procedure
    Change the depreciation periods back to the original value in company
    code NOPE. The number of depreciation periods is determined by the
    fiscal year version and the use of half-periods. At least one of these
    parameters was changed.
    If you want to change your system so that you can now work with half-
    periods, you have to use depreciation keys with time-dependent period
    control in that company code.
    If you need to make general changes to the number of periods for
    calculating depreciation per fiscal year, you will have to consult your
    system administrator

    hi
    If you refer to SAP Note 2993, it is not possible to change to/from half
    period. This is because the expired useful life are based on 12 periods
    and the system is not able to change this to 24 periods.
    To be able to change this settings under:
    Asset Accounting>Valuation>Fiscal Year>Use of Half Months in the
    Company Code.
    Company code must be in status  2 (Test company code with data transfer)
    Once you have finished your legacy data transfer you should set company
    code as productive to avoid this changes.
    Regarding error AA662,  it occurs if you change the number of period
    in the fiscal year version or the use of half-periods, after you have
    already posted to assets.
    The cause is a different value in field ANLB-PERFY which
    is the number of periods in the fiscal year.  If the number
    entered here does not correspond to the number of posting periods
    of the fiscal year used, the system raises error AA662 (except
    for none posted areas for which ANLB-PERFY = 000 or areas
    with depreciation to the date for which ANLB-PERFY = 365)
    If T093C-MONMIT = 15 (half periods), ANLB-PERYF = 012 is not
    correct. It should be 24.
    Please note that changing the PERFY value will not be sufficient because
    the expired useful life is calculated on base of PERFY. Thus PERFY has
    to be adjusted and the expired useful life also.
    Blaz.

  • How do you use passbook? Finally got the app to connect to App Store. Does not seem to allow me to add anything.

    How do you use passbook? Finally got the app to connect to App Store. Does not seem to allow me to add anything.

    http://support.apple.com/kb/HT5483
    Use this

  • Hello, I bought my iphone in japan. And now I'm in Brazil and I use it here, I need the unlock code for me to use here. please

    Hello, I bought my iphone in japan. And now I'm in Brazil and I use it here, I need the unlock code for me to use here. please

    williamjapa wrote:
    Hello, I bought my iphone in japan. And now I'm in Brazil and I use it here, I need the unlock code for me to use here. please
    Only the carrier to which the phone is locked can authorize an unlock. None of the Japanese carriers will do that. Sell the phone and buy one that works in Brazil.

  • I am using iPhone 4S , iOS 6.0.1. I can sign in using my apple password, but the App Store showing message your password is incorrect. Do any one help me?

    I am using iPhone 4S , iOS 6.0.1. I can sign in using my apple password, but the App Store showing message your password is incorrect. Do any one help me?

    Try This...
    Close All Open Apps... Sign Out of your account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • My IPOD is already synced to iTunes.  My friend just acquired an iPhone and he wants to purchase an app through my iTunes.  Can he use my iTunes to install the app to his iPhone without screwing up my IPOD information already on my iTunes?

    My IPOD is already synced to iTunes.  My friend just acquired an iPhone and he wants to purchase an app through my iTunes.  Can he use my iTunes to install the app to his iPhone without screwing up my IPOD information already on my iTunes?  Also, how does he install ONLY that app on his iPhone without syncing my music also?  I haven't done this before with just an app.  Thanks.

    Since you and your friend aren't married or in the same household (I assume you wouldn't have referred to this person as "my friend" otherwise), what you want to do is not permitted by the terms of use of the iTunes Store.
    Your friend should create his own Apple ID. He can use your computer; just have him log into your computer with a user account you create just for him, not your own user account. Doing it that way is almost like having your friend use a different computer, since both Mac OS X and recent versions of Windows do a pretty good job of segregating the data of multiple user accounts.
    He can then purchase the app using iTunes and sync it to his iPhone. When he's done, he should log out of your computer.
    However, be aware that there is no reason to purchase an app using iTunes on a computer and to then sync it to the iPhone. Your friend can use the App Store app that's installed on the iPhone by default in order to download and install any app he likes from the iTunes App Store.

  • Can the Ipod 4th and 5th generation be used as GPS? With the app Waze and under Wifi?

    Can the Ipod 4th and 5th Generation be used as GPS? With the app Waze and under Wifi?

    Mini-education...
    GPS signals are separate from and completely unrelated to both the Internet and the cellular telephone network.  GPS signals come directly from the GPS satellites.  They provide signals that allow GPS receivers to calculate latitude and longitude information.  Navigation software then takes that latitude/longitude info and converts it to land mass, roads, bridges, highways, buildings, etc.
    Most navigation software stores the maps right in the iPad/iPod/iPhone but a disadvantage is that the maps must be periodically updated (perhaps once every two years).  The Internet is not required to use the system but it is required to update the maps.
    Some navigation software gets the maps from the Internet and requires an Internet connection to function but an advantage is that the maps are always up-to-date.
    The WiFi+3G/4G iPad and the iPhone both have a GPS receiver.  The WiFi-only iPad and the iPod do not and these devices require an accessory.

  • My iPod touch is lock and my brother was trying too use it and he  entered the wrong code  too many times

    IPod touchMy iPod touch is lock and my brother was trying too use it and he  entered the wrong code  too many times

    Ok
    I may be able to help you .
    If you backed up your iPod prior to it being locked you may be in luck.
    1. Hook it up to your Mac or PC
    2.Open iTunes
    3.Click on your iPod (on the left hand side somewhere)
    4.Click on restore (in the centre somewhere)
    5.follow the onscreen instructions
    Once you have restored the device there should be an option that says restore from back up.
    Click on that.
    Hopefully this works. If it doesn't please let me no.

  • I want to buy an app for my daughter using my account but putting the app on hers any suggestions as to how to do this?

    How can I use my appleid account to buy a gift on my daughters iPod touch that has her own appleid account?

    "1) Sign out of the iTunes Store by choosing Sign Out from the Store menu in iTunes.
    2) Visit the My Apple ID website at:
    http://appleid.apple.com
    3) If the site is not displayed in your preferred language, click the Change Language link in the upper-right corner, type the name of your language in the field that appears, then click the Save button.
    4) Click the "Manage your account" link.
    5) Type your iTunes Store account name (which is your Apple ID) in the Apple ID field, type your password in the password field, then click the Sign In button.
    6) Click "Addresses" in the column on the left. Look at your shipping addresses at the bottom. If you have multiple shipping addresses, remove any out-of-date or duplicate addresses by clicking Delete. Also, make sure the state or province field is filled out correctly for each address. To edit an address, click Edit.
    7) Now click "Phone Numbers" on the left. The area codes should be in the area code fields and the phone numbers should be in the phone number fields. If an area code is missing, or if it is in a phone number field, your account information may not save properly.
    8) Make any other necessary corrections, then click the Save Changes button.
    9) Click Log out in the upper-right corner.
    When you make your next iTunes Store purchase, you will be asked to review your billing information. At that point, you can change your information or simply click Done. After that, you should be able to purchase items."
    I had the same problem once although I wasn't in a different country.

  • Why can't I use my Apple ID in the app store?

    I made an Apple ID and every time I try to log in it say your account has not been used in the app store and has me sign in and agree to terms and conditions then after I press continue a shadow appears we're a window should be and if I click on it sometimes it will have me chose where I'm from or Mr.Mrs.or Ms. But if u press out side the shadow it says do u want to cancel it.? I've re done this many times and still I can't download apps if anyone has an answer please let me know as soon as possible.

    do not worry,there are technical issuses,see the other posts:)

  • My iPhoto browser just doesn't load. The app is responsive and I can access the menubar, but no options to click. There is just no iPhoto browser. I don't have a clue what to do.

    Whenever I try to load iPhoto, the icon bounces in the dock, the menubar changes, but the iPhoto photo browser/window never appears. Most of  the menubar drop-down windows are greyed out. I'm not sure what else I can add to this, this is really strange for me. No spinning beachball, just an empty screen.
    I'm running Lion 10.7.3 and I have iPhoto 11 (9.2.1). 
    What can I do?

    Try trash the com.apple.iPhoto.plist file from the HD/Users/ Your Name / library / preferences folder.
    (On 10.7: Hold the option (or alt) key while clicking on the Go menu in Finder to access the User Library)
    (Remember you'll need to reset your User options afterwards. These include minor settings like the window colour and so on. Note: If you've moved your library you'll need to point iPhoto at it again.)
    What's the plist file?
    For new users: Every application on your Mac has an accompanying plist file. It records certain User choices. For instance, in your favourite Word Processor it remembers your choice of Default Font, on your Web Browser is remembers things like your choice of Home Page. It even recalls what windows you had open last if your app allows you to pick up from where you left off last. The iPhoto plist file remembers things like the location of the Library, your choice of background colour, whether you are running a Referenced or Managed Library, what preferences you have for autosplitting events and so on. Trashing the plist file forces the app to generate a new one on the next launch, and this restores things to the Factory Defaults. Hence, if you've changed any of these things you'll need to reset them. If you haven't, then no bother. Trashing the plist file is Mac troubleshooting 101.

  • Can an iTunes/iPod gift card be used to buy games on the App store?

    Hello,
    Can an ITunes/Ipod gift card be used to buy games on the Ipod store? Thank you!
    Regards,
    Kristy.

    With an US iTunes Gift Card, you can purchase whatever you want. It's good toward any purchase on the iTunes Store. http://www.apple.com/itunes/gifts/

  • IWork 2.2 (iOS) disables "Use iCloud" option on opening the app???

    After updating the the latest iWork apps (v2.2) there were no documents that were previously there...
    I checking icloud.com and all the documents were still in existence. I finally discovered that the "Use iCloud" option in the settings for each of the apps had been disabled. I re-enabled it, but every time I re-opened the app it was disabled again!
    Anyone else experiencing this and any workaround?

    You are right, Hulu, that important bit of information is not even mentioned on the GarageBand Help page:  Use iCloud with GarageBand
    The document only mentions, that iCloud for GarageBand will have to be enabled. And it is really not obvious, that the "Sync Documents and Data" needs to be active to, or your iPad will not sync GarageBand projects, because no application data will be synced at all.

Maybe you are looking for

  • Updated itunes to use ipad mini and itunes wont start up now?

    i have a ipad3 + iphone4 + ipod touch and just brought ipad mini pluged it into itunes then itunes says have to update to use with ipad mini so i updated it like normal restarted pc and now doesnt work try reinstalling and repairing files still didnt

  • CUP Custom Role Attributes

    All - My question is about creating custom role attributes in CUP. I read in the "SAPu2122 GRC Access Control 5.3 Document Version 3.10 u2013 December 2009" on page 245 that "You can also define your own attributes to support your needs by adding cus

  • SharePoint 2010 On-Prem and Yammer Integration

    Hello guys, I'm having trouble to integrate SharePoint Server 2010 Enterprise on-premises and Yammer. I installed Yammer App for SharePoint 2010 and did all steps in the instruction guide: Added and Deployed the Yammer solution I have added both cert

  • Adobe CS4 School Installation Woes

    Hi, I'm a student at Brown University. I  downloaded the 5-part installation for CS4 from the school website and  have been plagued by installation problems since. First, the  error message "Session has dependencies that cannot be satisifed"  appered

  • RemoveContexts & SplitBy Value?

    What do these XI functions mean exactly? Is there a place I can find these function's logic explanation anywhere in XI?