Control client cache for JSP

There are many threads on the web about how to force a reload rather than pulling content from cache. My problem is the opposite. I am trying to get good cache control for a jsp application that has relatively static contents. My goal is to serve up pages with the following characteristics:
For client calls:
If there is no version in cache, the jsp builds a new version and sets the response date header "Expires" to 5 days later.
If within the Expires date, have the client just use the cached version: no validation or roundtripping.
If after the Expires date, roundtrip: have the jsp return 303 (SC_NOT_MODIFIED) if no content changed. Also, ideally, also reset the Exipres date to an additional 5 days.
Otherwise, recreate the response and start over...
I am experiencing different behaviors with different browsers, although none act as I was hoping.
When there is no relevant page in cache, all of the browsers accept a new version (and I think that they all put it in cache). All browsers reload the page using the reload button.
If there is a relevant page in cache and it has not expired:
1. FireFox 3 seems to roundtrip, but then use the version in cache.
2. IE 7 seems to always use the cache version without checking the server
3. Google Chrome seems to always roundtrip and reload.
I tried several variations including setting/not setting the Last-Modified date header and setting/not Cache-Control: no-control header (to force validation).
Neither Last-Modified nor no-contro: NO CHANGE FROM ABOVE;
Last-Modified set, no-control not specified: NO CHANGE
Last-Modified not set, Cache-Control set to no-control to force validation.
The main problem here is that I was unable to get a value for the request header "Last-Modifier" so that my jsp could not set the 303 return, therefore all browsers roundtrip and reload.
SO...
1. What do I need to do to get all browsers to pull from cache and not roundtrip prior to the Expires date?
2. After the Expires date, what do I need to do to get the request to include the Last-Modified date header sent to the server?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%
%><%@ page import="java.net.*"%><%
%><%@ page import="java.util.*"%><%
%><%@ page import="java.util.Date"%><%
%><%@ page import="javax.servlet.*"%><%
%><%@ page import="java.text.SimpleDateFormat" %><%
//  In a real application, the updatedDate would come from a database or file
Calendar thisCal = new GregorianCalendar();
thisCal.set(2009,02,15);
Date     updateDate = thisCal.getTime();
//  This never returns a valid date
long  thisLongDate  = request.getDateHeader("Last-Modified");
Date  cachedDate    = ((thisLongDate<0)?null:new Date(thisLongDate));
Date  todaysDate    = new Date();
//  Show all three dates in the output
String   outString = "";
SimpleDateFormat   showDateFormatter = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
outString += "================================================================<br> \n";
outString += " Start TestSuite25.jsp "+showDateFormatter.format(todaysDate)+"<br> \n";
outString += "Update date is "+showDateFormatter.format(updateDate)+"<br> \n";
outString += "Cached date is "+((cachedDate==null)?null:showDateFormatter.format(cachedDate))+"<br> \n";
response.setContentType("text/html");
if (request.getParameter("lastmodified") != null)
   outString += "Set Last Modified header:  may trigger If-Modified-Since request. <br> \n";
   response.setDateHeader("Last-Modified",updateDate.getTime());
//  force validation .. does this hit my code??
if (request.getParameter("cache") != null)
    outString += "Set cache control to no-cache to force validation on every call<br> \n";
    response.setHeader("Cache-Control", "no-cache");
//  use cache for 5 days, then validate
thisCal.setTime(todaysDate);
thisCal.add(Calendar.DATE,5);
response.setDateHeader("Expires", thisCal.getTime().getTime());
//  Check for still fresh on server
if (!(cachedDate == null) && (!cachedDate.before(updateDate)))
   outString += "Contents are unchanged: send 303 status message<br> \n";
   response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
   System.out.println(outString);
else
   outString += "Rebuild and send the HTML <br>";
   System.out.println(outString);
   // Build and send the HTML ...
%>
<html>
<head>
  <title>Test suite</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body >
<br>
<h2 align="center">Test 25: Controlling Cache</h2>
<h3 align="center">Click <a href="TestSuite21.html">here</a> to continue to Test 26.</h3>
useage: TestSuite25.jsp<br>
optional parameters: <br>
   cache=nocache: include no-cache to force validation each time<br>
   lastmodify=set:  include Last-Modified date hearer<br>
<br>
<%=outString%>
</html>
</body>
<% } %>

let me tell you from BSP side !
within your BSP application set a javascript timer for 2 minutes and upon completion run a javascript to kill the backend session along with the SSO2 cookie.
check the BSP application system/session_single_frame.htm
for a javascript named "exitBSPApplication"
Hope this is helpful.
Regards
Raja

Similar Messages

  • How to implement content caching for jsp page ?

    Hello everyone,
    I am reading an article <Servlets and Jsp Best Practice>,at
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/#author, on one section it is saying :
    "Cache content: You should never dynamically regenerate content that doesn't
    change between requests. You can cache content on the client-side, proxy-
    side,or server-side. "
    Now I am working on a project. For every user, some of the content servlet generated will be the same for at least a week . I am thinking if I implement caching for these jsp pages, that would increase performace a lot.
    But I have no idea how to implement it either client-side or server-side, can someone give me a hint ?
    Thanks,
    Rachel

    You mean actually you are caching the response stream
    and the key to distinguish between different response
    streams are made of user's different request
    parameters. And the filter's function is to intercept
    the request to see if this request parameter's
    combination already exists in the Hashmap,then either
    use the cached response or forward to
    servlet.....really interesting...Do I get it right ?Yes that's it in a nutshell.
    >
    Then how do you build those response streams in
    advance ? You did it manually or have some mechanism
    to build it automatically ?
    The data gets cached the first time somebody visits the page.
    Find some examples on Filters, and take a look at the HttpServletResponseWrapper class. You need to cache response headers as well as the body. Another pitfall that you might run into is handling an If-modified-since header on the request. Don't cache the results of those requests.
    -Jonathan
    >
    Thanks again !
    Rachel

  • Turn off library caching for a Mail client on the Mac?

    Hi..is it possible to turn off library caching for a Mail client on the Mac? At work I have outlook 2007. I setup Mail client to sync Mail,contacts and calendar. The cache is stored in the library hidden folders. Is it possible to permanently turn off caching?

    I am getting more and more bewildered.  I just looked at google mails settings to see if they do something different from the isp I use and there they say the following: if the sent messages aren't stored on the server, then where are they stored? What happens to them if I set my preferences this way?  I want to wail and tear my hair out. I feel so very stupid.
    http://mail.google.com/support/bin/answer.py?answer=78892#
    Recommended imap settings....
    Apple Mail
    From the Mail menu, click Preferences > Accounts > Mailbox Behaviors
    Drafts:
    Store draft messages on the server > do NOT check
    Sent:
    Store sent messages on the server > do NOT check
    Junk:
    Store junk messages on the server > checked
    Delete junk messages when > Never
    Trash:
    Move deleted messages to the Trash mailbox > do NOT check
    Store deleted messages on the server > do NOT check

  • How to disable browser caching for a specific JSP

    Is it possible to keep the browser from caching a JSP? If so how?

    you can put
    response.setHeader("pragma","no-cache");
    response.setHeader("cache-content","no-cache");
    response.setHeader("expires",0);
    in your jsp that will do..

  • Weblogic setting Cache-control: no-cache?

    I have a servlet filter that sets the Cache-control http header to "max-age=30" for static files such as *.css but in the end weblogic sends the value "no-cache".
    When the browser asks for the same static file again weblogic responds with http 304 and Cache-control "max-age=0" thus overriding my filter again.
    Is there any way to change the client side caching in weblogic (10.3.4)?
    (btw the servlet filter works in tomcat)

    Hi,
    1. response.setHeader("Cache-Control","no-cache");
    This is used to prevent the browser from caching your dynamic content generated by a JSP or Servlet.
    You set this attribute in the HTTP header of the response object which would tell the browser not to cache this content. So everytime you request the page again, the browser would make a new request, instead of showing you a cached page.
    2. response.setHeader("Location", "error.html");
    This is called redirecting. "Redirecting" is sending a response from your servlet to the browser telling the browser to go to a new location(make a new request)
    The standard way to do this response.sendRedirect(String);

  • How to disable webview cache for Windows Phone 8.1 Runtime universal app?

    Is it possible to disable cache for the Webview control for a Windows Phone 8.1 runtime universal app? My App seems to be remembering the information it received the first time. My app logs me into a service and when I go back to rerun app in the emulator
    (without completing shutting down the emulator) it logs me in automatically rather than giving me the prompt. This behavior is in the NavigationCompleted handler if that helps explain a bit more on where I am hitting this issue.
    If I were to shut off the emulator completely and then restart it then I am prompted for the login name and password again. I have gotten over this cache issue, when I was using the HttpClient in other part of my app, by sending the no-cache in the header
    as:
    client.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
    Can I do something similar for the webview control?
    thanks
    mujno

    Hi mujno,
    As I know currently there is no programmatically way to clean cache for WebView, see Matt's blog:How to clear the WebView cache
    However if you are developing an enterprise app, you should be able to invoke some scripts to clean for you, see this for more information:Brokered
    Windows Runtime Components for side-loaded Windows Store apps
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • File Caching in JSP

    Hi,
    I view a bunch of PDF's in my JSP file which can then be modified according to the user needs. For example, the user views a PDF file, then he/she can remove some documents within the pdf which will contact a Bean, remove the documents, recreate the PDF and save it with the same path and name. However, when I try to view the file, it still displays the old one although the new file gets created successfully when I check in my directory... any inputs on how I can avoid this problem?
    THanks,
    YAsir

    I am using the following code to disable cache,. is that any different from the one you sent?
    I think its more of a "PDF file opening up in a browser" kinda problem
    thanks though
    <%
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    %>

  • Error Code - client cache is smaller than the size of the requested content

    Even though we have increased the size of the ccmcache via Control Panel > Configuration Manager, we still get the Error Code 0x87D01202 (-2016407038) "the content
    download cannot be performed because the total size of the client cache is smaller than the size of the requested content"  The CCMEXEC Service and computer have both been restarted, after increasing the ccmcache size.  Which local log
    file under C:\Windows\CCM\Logs should we check for more information ?
    Thanks

    so when you re deploying the client go into your settings and set the variable below:
    smscachesize=10240
    note:
    SMSCACHESIZE
    Specifies the size of the client cache folder in megabyte (MB) or as a percentage when used with the PERCENTDISKSPACE or PERCENTFREEDISKSPACE property. If this property is not set, the folder defaults to a maximum size of 5120 MB. The lowest value that you
    can specify is 1 MB.
    Note
    If a new package that must be downloaded would cause the folder to exceed the maximum size, and if the folder cannot be purged to make sufficient space available, the package download fails, and the program or application will not run.
    This setting is ignored when you upgrade an existing client and when the client downloads software updates.
    Example: CCMSetup.exe SMSCACHESIZE=100
    Note
    If you reinstall a client, you cannot use the SMSCACHESIZE or SMSCACHEFLAGS installation properties to set the cache size to be smaller than it was previously. If you try to do this, your value is ignored and the cache size is automatically set to the last
    size it was previously.
    For example, if you install the client with the default cache size of 5120 MB, and then reinstall the client with a cache size of 100 MB, the cache folder size on the reinstalled client is set to 5120 MB.
    Twitter: @dguilloryjr LinkedIn: http://www.linkedin.com/in/dannyjr Facebook: http://www.facebook.com/#!/dguilloryjr

  • Problem installing BEA Workshop for jsp

    Hi,
    I am trying to install the BEA Workshop for JSP. Though when I satisfy min jdk version as shown, I still into installation problems.
    C:\Profiles\sys1mi\Desktop\temp>java -version
    java version "1.4.2_11"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.
    Java HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)
    I had multiple JDK versions which I deleted but still unable to install. Below is the attached log. Please let me know if this helps.
    Thanks,
    Prateek
    looking in C:\Program Files\Java\j2re1.4.2_11\bin
    Found: C:\Program Files\Java\j2re1.4.2_11\bin\java.exe
    Found: C:\Program Files\Java\j2re1.4.2_11\bin\javaw.exe
    looking in C:\Program Files\JavaSoft\JRE\1.3.1_02\bin
    looking in C:\Program Files\JavaSoft\JRE\1.3.1_02\bin
    looking in C:\Program Files\Java\j2re1.4.2_11\bin
    Found: C:\Program Files\Java\j2re1.4.2_11\bin\java.exe
    Found: C:\Program Files\Java\j2re1.4.2_11\bin\javaw.exe
    looking in C:\Program Files\Java\j2re1.4.2_03\bin
    Found: C:\Program Files\Java\j2re1.4.2_03\bin\java.exe
    Found: C:\Program Files\Java\j2re1.4.2_03\bin\javaw.exe
    looking in C:\Program Files\Java\j2re1.4.2_11\bin
    Found: C:\Program Files\Java\j2re1.4.2_11\bin\java.exe
    Found: C:\Program Files\Java\j2re1.4.2_11\bin\javaw.exe
    ...Finished searching through the registry for VMs
    Searching through the path for VMs...
    Looking in C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin
    Found: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\java.exe
    Found: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\javaw.exe
    Looking in C:\PROGRA~1\FileNet\IDM
    Looking in C:\PROGRA~1\FileNet\Shared
    Looking in C:\Program Files\CA\SharedComponents\PEC\bin
    Looking in C:\WINNT\system32
    Ignoring 'C:\WINNT\system32\java.exe' because it is in a Windows System Dire
    ctory.
    Ignoring 'C:\WINNT\system32\javaw.exe' because it is in a Windows System Dir
    ectory.
    Ignoring 'C:\WINNT\system32\jre.exe' because it is in a Windows System Direc
    tory.
    Ignoring 'C:\WINNT\system32\jrew.exe' because it is in a Windows System Dire
    ctory.
    Found: C:\WINNT\system32\jview.exe
    Found: C:\WINNT\system32\wjview.exe
    Looking in C:\WINNT
    Ignoring 'C:\WINNT\java.exe' because it is in a Windows System Directory.
    Ignoring 'C:\WINNT\javaw.exe' because it is in a Windows System Directory.
    Ignoring 'C:\WINNT\jre.exe' because it is in a Windows System Directory.
    Ignoring 'C:\WINNT\jrew.exe' because it is in a Windows System Directory.
    Looking in C:\WINNT\System32\Wbem
    Looking in c:\Fusa\DLL
    Looking in C:\TD
    Looking in C:\Program Files\CA\AllFusion Harvest Change Manager
    Looking in C:\Progra~1\OraNT\9i\bin
    Looking in C:\Program Files\IBM\Trace Facility\
    Looking in C:\Program Files\IBM\Personal Communications\
    Looking in C:\Program Files\F-Secure\Ssh\program
    Looking in C:\PROGRAM FILES\ULTRAEDIT
    Looking in C:\Program Files\FileNet\FNSW\CLIENT\BIN
    Looking in C:\Program Files\FileNet\FNSW\CLIENT\SHOBJ
    Looking in C:\Program Files\IONA\Orbix_2.3c\BIN
    Looking in C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin
    Found: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\java.exe
    Found: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\javaw.exe
    Looking in C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin
    Found: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\java.exe
    Found: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\javaw.exe
    Looking in C:\PROGRA~1\FileNet\IDM
    Looking in C:\PROGRA~1\FileNet\Shared
    Looking in C:\Program Files\CA\SharedComponents\PEC\bin
    Looking in C:\WINNT\system32
    Ignoring 'C:\WINNT\system32\java.exe' because it is in a Windows System Dire
    ctory.
    Ignoring 'C:\WINNT\system32\javaw.exe' because it is in a Windows System Dir
    ectory.
    Ignoring 'C:\WINNT\system32\jre.exe' because it is in a Windows System Direc
    tory.
    Ignoring 'C:\WINNT\system32\jrew.exe' because it is in a Windows System Dire
    ctory.
    Found: C:\WINNT\system32\jview.exe
    Found: C:\WINNT\system32\wjview.exe
    Looking in C:\WINNT
    Ignoring 'C:\WINNT\java.exe' because it is in a Windows System Directory.
    Ignoring 'C:\WINNT\javaw.exe' because it is in a Windows System Directory.
    Ignoring 'C:\WINNT\jre.exe' because it is in a Windows System Directory.
    Ignoring 'C:\WINNT\jrew.exe' because it is in a Windows System Directory.
    Looking in C:\WINNT\System32\Wbem
    Looking in c:\Fusa\DLL
    Looking in C:\TD
    Looking in C:\Program Files\CA\AllFusion Harvest Change Manager
    Looking in C:\Progra~1\OraNT\9i\bin
    Looking in C:\Program Files\IBM\Trace Facility\
    Looking in C:\Program Files\IBM\Personal Communications\
    Looking in C:\Program Files\F-Secure\Ssh\program
    Looking in C:\PROGRAM FILES\ULTRAEDIT
    Looking in C:\Program Files\FileNet\FNSW\CLIENT\BIN
    Looking in C:\Program Files\FileNet\FNSW\CLIENT\SHOBJ
    Looking in C:\Program Files\IONA\Orbix_2.3c\BIN
    Looking in C:\LOGS\user\temp_installs\apache-ant-1.7.0\bin
    Looking in C:\Program Files\GnuWin32\bin
    ...Finished searching through the path for VMs
    ORDERING VMS
    1: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\java.exe (in path)
    2: C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\javaw.exe (in path)
    3: C:\WINNT\system32\jview.exe (in path)
    4: C:\WINNT\system32\wjview.exe (in path)
    5: C:\Program Files\Java\j2re1.4.2_03\bin\java.exe (in registry at HKEY_LOCAL_MA
    CHINE\SOFTWARE\JavaSoft\Java Plug-in\1.4.2_03)
    6: C:\Program Files\Java\j2re1.4.2_03\bin\javaw.exe (in registry at HKEY_LOCAL_M
    ACHINE\SOFTWARE\JavaSoft\Java Plug-in\1.4.2_03)
    7: C:\Program Files\Java\j2re1.4.2_11\bin\java.exe (in registry at HKEY_LOCAL_MA
    CHINE\SOFTWARE\JavaSoft\Java Plug-in\1.4.2_11)
    8: C:\Program Files\Java\j2re1.4.2_11\bin\javaw.exe (in registry at HKEY_LOCAL_M
    ACHINE\SOFTWARE\JavaSoft\Java Plug-in\1.4.2_11)
    9: C:\Program Files\Java\j2re1.4.2_11\bin\java.exe (in registry at HKEY_LOCAL_MA
    CHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.4)
    10: C:\Program Files\Java\j2re1.4.2_11\bin\javaw.exe (in registry at HKEY_LOCAL_
    MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.4)
    11: C:\Program Files\Java\j2re1.4.2_03\bin\java.exe (in registry at HKEY_LOCAL_M
    ACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_03)
    12: C:\Program Files\Java\j2re1.4.2_03\bin\javaw.exe (in registry at HKEY_LOCAL_
    MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_03)
    13: C:\Program Files\Java\j2re1.4.2_11\bin\java.exe (in registry at HKEY_LOCAL_M
    ACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_11)
    14: C:\Program Files\Java\j2re1.4.2_11\bin\javaw.exe (in registry at HKEY_LOCAL_
    MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_11)
    Searching for console vm.
    lax.nl.valid.vm.list=J2 J1 MSJ
    lax.nl.current.vm=.
    was not a valid Win32 executable.
    SUCCESS! C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\java.exe
    Using JNI INVOCATION to simulate the following batch script:
    BATCH SCRIPT
    cd "C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows"
    set CLASSPATH=C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\IAClass
    es.zip;C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows\resource\jdglue.zip;
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\Execute.zip;C:\Profil
    es\sys1mi\LOCALS~1\Temp\I1180638584\Windows\InstallerData\Execute.zip;C:\Profile
    s\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\Resource1.zip;C:\Profiles\sys1m
    i\LOCALS~1\Temp\I1180638584\Windows\InstallerData\Resource1.zip;C:\Profiles\sys1
    mi\LOCALS~1\Temp\I1180638584\InstallerData;C:\Profiles\sys1mi\LOCALS~1\Temp\I118
    0638584\Windows\InstallerData;
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\bin\java.exe -Xms16777216 -Xmx503
    31648 -noverify com.zerog.lax.LAX C:\\Profiles\\sys1mi\\LOCALS~1\\Temp\\I1180638
    584\\Windows\\WorkshopInstaller.lax C:\\Profiles\\sys1mi\\LOCALS~1\\Temp\\env.pr
    op
    executing java...
    LAX Version = 5.5
    IAResourceBundle: create resource bundle: en
    LOADING Resource path: i18nresources\custom_en
    LOADING Resource path: locales\custom_en
    seaFilename = WorkshopInstaller
    Default properties location = C:\Profiles\sys1mi\Desktop\temp\
    Installer PropertiesFile = C:\Profiles\sys1mi\Desktop\temp\installer.properties
    UI Mode set to Default - SWING.
    InstallAnywhere 6.0 Enterprise
    Thu May 31 15:10:23 EDT 2007
    Free memory = 14953 kB
    Total memory = 16320 kB
    No arguments.
    java.class.path:
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\IAClasses.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows\resource\jdglue.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\Execute.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows\InstallerData\Execute.z
    ip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\Resource1.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows\InstallerData\Resource1
    .zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows\InstallerData
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\lib\dt.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\lib\htmlconverter.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\lib\tools.jar
    ZGUtil.CLASS_PATH:
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\IAClasses.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Windows\resource\jdglue.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData\Execute.zip
    C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\InstallerData
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\lib\htmlconverter.jar
    sun.boot.class.path:
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\rt.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\i18n.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\sunrsasign.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\jsse.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\jce.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\charsets.jar
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\classes
    java.ext.dirs:
    C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\jre\lib\ext
    java.version == 1.4.2_11 (Java 2+)
    java.vm.name == Java HotSpot(TM) Client VM
    java.vm.vendor == Sun Microsystems Inc.
    java.vm.version == 1.4.2_11-b06
    java.vm.specification.name == Java Virtual Machine Specification
    java.vm.specification.vendor == Sun Microsystems Inc.
    java.vm.specification.version == 1.0
    java.specification.name == Java Platform API Specification
    java.specification.vendor == Sun Microsystems Inc.
    java.specification.version == 1.4
    java.vendor == Sun Microsystems Inc.
    java.vendor.url == http://java.sun.com/
    java.class.version == 48.0
    java.compiler == null
    java.home == C:\Profiles\sys1mi\temp_installs\j2sdk1.4.2_11\
    jre
    java.io.tmpdir == C:\Profiles\sys1mi\LOCALS~1\Temp\
    os.name == Windows XP
    os.arch == x86
    os.version == 5.1
    path.separator == ;
    file.separator == \
    file.encoding == Cp1252
    user.name == sys1mi
    user.home == C:\Profiles\sys1mi
    user.dir == C:\Profiles\sys1mi\LOCALS~1\Temp\I1180638584\Wi
    ndows
    user.language == en
    user.region == null
    Installer: InstallAnywhere 6.0 Enterprise Build 2262
    System's temporary directory = C:\Profiles\sys1mi\Local Settings\Temp
    Installer: looking for Win32 DLLs in C:\Profiles\sys1mi\LOCALS~1\Temp\I118063858
    4\InstallerData\..\Windows\resource
    allocating more
    allocating more
    allocating more
    allocating more
    RepositoryManager: lock acquired on: C:\Program Files\Zero G Registry\.com.zerog
    .registry.lock
    allocating more
    allocating more
    allocating more
    allocating more
    IAVariables: Converting property: prop, to: 0000-trial
    Searching for Resources - C:\Profiles\sys1mi\Local Settings\Temp\I1180638584\In
    stallerData\Disk1\InstData\Resource1.zip
    launchDir: C:\Profiles\sys1mi\Desktop\temp
    installer.properties exists? true
    version: IS_TRIAL_VERSION
    prod: 0000
    build id=608
    versionInfo: major: 3 minor: 3 micro: 0 buildNumber: 608 release name:
    java.io.IOException: CreateProcess: $USER_INSTALL_DIR$$/$jre\jre\bin\java.exe -v
    ersion error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:66)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)
    at com.m7.installer.InstallerUtil.getVersion(InstallerUtil.java:154)
    at com.m7.installer.InstallerUtil.checkVersion(InstallerUtil.java:101)
    at com.m7.installer.CheckInstallerVM.install(CheckInstallerVM.java:33)
    at com.zerog.ia.installer.actions.CustomAction.installSelf(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.AAMgr.b(DashoA8113)
    at com.zerog.ia.installer.AAMgr.c(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.AAMgr.b(DashoA8113)
    at com.zerog.ia.installer.AAMgr.c(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.AAMgr.b(DashoA8113)
    at com.zerog.ia.installer.AAMgr.c(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.AAMgr.b(DashoA8113)
    at com.zerog.ia.installer.AAMgr.c(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.AAMgr.a(DashoA8113)
    at com.zerog.ia.installer.Main.b(DashoA8113)
    at com.zerog.ia.installer.Main.d(DashoA8113)
    at com.zerog.ia.installer.Main.a(DashoA8113)
    at com.zerog.ia.installer.Main.main(DashoA8113)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.zerog.lax.LAX.launch(DashoA8113)
    at com.zerog.lax.LAX.main(DashoA8113)
    JRE command: $USER_INSTALL_DIR$$/$jre\jre\bin\java.exe -version
    JRE version: null

    Do you have multiple versions of Java installed? I had a weird problem a
    while back with a messed up registry and multiple Java installations.
    br
    Jessica Gaudette wrote:
    Hi,
    I am having the identical problem, but with BEA Workshop Studio. I've followed the instructions provided to resolve it, but I still get the same error, What am I doing wrong? Below is my variable:
    PATH=C:\Program Files\Java\jdk1.5.0\bin
    When I hold down the control button to get the error log it APPEARS to locate the JDK, but at the very end, when it looks for the JRE it is null.

  • Apache caching in jsp

    my first problem :
    is whenever i update/debug or simply add a new code to my .jsp file, i can't immediately see its output what i do get is an old page. for example, sample.jsp contains 2 submit buttons and then i deleted one button but when i run my sample.jsp page it still displays 2 submit.
    my theory:
    so far, i think it has something to do w/ the cache because when i restarted my apache, i can now see one button.
    my next problem:
    if that's the case, then all users of my site have to restart their apache and i think this totally defeats the purpose of my site in the first place. it will only make things more complicated.
    my plea:
    can somebody help me???
    thanks

    it is often necessary... The browser cache should be ignored by shift click/ shift reload, but if you are behind a firewall or proxy server that caches files, then no matter how hard you press the shift key, it won't tell the firewall cache to go to the server. I don't know that there is a caching firewall in this circumstance, but unless it's for a intranet that you really know about, you can't assume that people won't be hitting the site from the other side of a caching firewall. This would be totally transparent to the user (and his/her browser). Which is why if I have a JSP page or servlet (which nearly always has content I won't want cached) I include the no-cache headers to tell any cache to not store the file.
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", 0);
    between the 3 lines, it should take care of browser cache and proxy cache.

  • Unable to compile class for JSP

    Please can anyone help me to solve this.
    Actually,this is the condition.
    In my db,there is a table called UserPassword, which has 4
    fields(empNo,UserName,password,level). Now I want to do these things:
    When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
    1)To check the empNo,if it is already exist in the DB,
         if empNo =exist then display error.(record already exist)
         if empNo =notexist then do task 2).
    2)check the UserName,if it is already exist in the db,
         if UserName=exist then display error.(because it's a primary key)
         if UserName=notexist then do task 3).
    3)Create a new user account and save it to the db.
    To do these tasks,I never create a new objects for the tasks 1) and 2).
    only for task 3)create an object.
    Is it the right way?
    Here is the file CreateAcc.jsp
    <%@ page language="java" %>
    <%@ page import="core.UserAccManager" %>
    <%@ page import="data.UserPassword" %>
    <jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
    <jsp:setProperty name="UserAccManager" property="*"/>
    <jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
    <jsp:setProperty name="UserPassword" property="*"/>
    <%
    String nextPage ="MainForm.jsp";
    if(UserPassword.verifyEmpno()){
         if(UserPassword.verifyUsername()){
              if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
          }else{
               nextPage="UserNameExist.jsp";
          else{
              nextPage="UserAccError.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>The directory structure:
    UserPassword.java- F:/Project/core/data/UserPassword.java
    UserAccManager.java - F:/Project/core/UserAccManager.java
    Now both are compiling.I put the class files into the TOMCAT,as follows.
    UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
    UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
    Here is the full code of the file UserAccManager.java.
    package core;               //Is this right?
    import data.UserPassword;     //Is this right?
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public final class UserAccManager{
       private static final String DRIVER = "com.mysql.jdbc.Driver";
       private static final String URL = "jdbc:mysql://localhost:3306/superfine";
       private static Connection connection;
       private static PreparedStatement pstmt1;
       private static PreparedStatement pstmt2;     
       private static PreparedStatement pstmt3;     
       private UserAccManager(){
       // Initializes the connection and statements
       public static void initConnection() {
          if (connection == null) {
             try {
                String sql;
                // Open the database
                Class.forName(DRIVER).newInstance();
                connection = DriverManager.getConnection(URL);
                // Prepare the statements
               sql = "SELECT * FROM UserPassword where empNo= ?";
               pstmt1 = connection.prepareStatement(sql);
                sql = "SELECT UserName FROM UserPassword where UserName= ?";
                pstmt2 = connection.prepareStatement(sql);
             sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
             pstmt3 = connection.prepareStatement(sql);
             catch (Exception ex) {
                System.err.println(ex.getMessage());
       // Closes the connection and statements
       // Method to be called by main class when finished with DB
       public  void closeConnection() {
          //same as previous
       public static boolean verifyEmpno(int empno) {
          boolean emp_no_select_ok = false;
          int emp = -1;
          initConnection();
         try {
          pstmt1.setInt(1, empno);
             ResultSet rs1 = pstmt1.executeQuery();
         while(rs1.next()){
              emp=rs1.getInt("empNo");
         if(emp>0)
              emp_no_select_ok = false;
         } else{
              emp_no_select_ok = true;     
            rs1.close();
         pstmt1.close();     
          catch (Exception ex) {
             System.err.println(ex.getMessage());
          return emp_no_select_ok;
       public static boolean verifyUsername(String username) {
          boolean user_name_select_ok = false;
          String user = "xxxx";
          initConnection();
          try {
          pstmt2.setString(1, username);
             ResultSet rs2 = pstmt2.executeQuery();
            while(rs2.next()){
              user=rs2.getString("UserName");
               if(!user.equals("xxxx"))
              user_name_select_ok = false;
            } else{
              user_name_select_ok = true;     
           rs2.close();
          catch (Exception ex) {
             System.err.println(ex.getMessage());
          return user_name_select_ok;
         public static boolean createAcc(int empno, String username, String password, int
    level){
              boolean create_acc_ok = false;
              initConnection();
              try{
                      //create a new object,from the UserPassword table.
                   UserPassword useraccount = new UserPassword();
                   useraccount.setEmpno(empno);
                   useraccount.setUsername(username);
                   useraccount.setPassword(password);
                   useraccount.setLevel(level);
                   //assign value for ???
                   pstmt3.setInt(1, useraccount.getEmpno());
                   pstmt3.setString(2, useraccount.getUsername());
                   pstmt3.setString(3, useraccount.getPassword());
                   pstmt3.setInt(4, useraccount.getLevel());          
                   if(pstmt3.executeUpdate()==1) create_acc_ok=true;
                   pstmt3.close();
                           //con.close();
                catch(SQLException e2){
                           System.err.println(e2.getMessage());
              return create_acc_ok;
    }here is the bean (part of it)
    package data;               //is it right?
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class UserPassword
         private int empno;
         private String username;
         private String password;
         private int level;
         // Constructor
         public UserPassword()
              this.empno = empno;
              this.username = username;
              this.password = password;
              this.level = level;
         // setters and getters are here.
    //     public boolean verifyEmpno() {
    //               return UserAccManager.verifyEmpno(empno);
    //       public boolean verifyUsername(String username) {
    //            return UserAccManager.verifyUsername(username);
         // These 2 methods not compile with or without para's.So I leave that job for the      
         //controll class UserAccManager.java.
    Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
    cannot access core.data.UserPassword
    bad class file: C:\Program Files\Apache Group\Tomcat
    4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
    class file contains wrong class: data.UserPassword
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    import core.data.UserPassword;
    ^
    1 error
    Are there any mistakes? If so tell me where is it and how to change them.Please help.

    I try it that way, but it don't compile.
    Error:core\data\UserPassword.java:package javax.servlet does not exist
    import javax.servlet.*;
    core\data\UserPassword.java:package javax.servlet.http does not exist
    import javax.servlet.http.*;
    So,I comment them only in the UserPassword.java file,and compile it again.
    Then it compile well.I goto the directory to get the .class files.
    But there is only UserPassword.class inside the data folder. There is not
    UserAccManager.class in the core folder.
    Then I try this way,I put my 2 java files in to a new folder,
    F:\SystemName\com
    When I try it that way, but it don't compile.
    javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
    import javax.servlet.*;
    com\UserPassword.java:package javax.servlet.http does not exist
    import javax.servlet.http.*;
    So,I comment them only in the UserPassword.java file,and compile it again.
    Now both are compiling well.There was 2 class files.
    I put them in to the WEB-INF/classes/com directory.
    Start the server.But it gave errors:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
    if(UserPassword.verifyEmpno(empno)){
                                ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
         if(UserAccManager.verifyUsername(username)){
                                             ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
    verifyUsername(java.lang.String) cannot be referenced from a static context
         if(UserAccManager.verifyUsername(username)){
                             ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                       ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable password
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable level
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                         ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
    createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
    context
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                     ^
    8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
    things.
    package com;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    //import javax.servlet.*;               //otherwise it tells an error.(package           
                                  //javax.servlet does not exist)
    //import javax.servlet.http.*;
    public  class UserAccManager {
       private static final String DRIVER = "com.mysql.jdbc.Driver";
       private static final String URL = "jdbc:mysql://localhost:3306/superfine";
       private static Connection connection;
       private static PreparedStatement pstmt1;
        private static PreparedStatement pstmt2;
          private static PreparedStatement pstmt3;
       private UserAccManager() {
       // Initializes the connection and statements
       private static void initConnection() {
             //same
       // Closes the connection and statements
       // Method to be called by main class when finished with DB
       public static void closeConnection() {
         //same
       public static boolean verifyEmpno(int empno) {
          // same.
       public static boolean verifyUsername(String username) {
         //same.
         public static boolean createAcc(int empno, String username, String password, int      
    level){
              //same
    package com;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    //import javax.servlet.*;
    //import javax.servlet.http.*;
    public class UserPassword {
         // same
    Again compile those files and put .class filses into the WEB-INF/classes/com directory.
    When i submits the data via the form it generates an error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
        [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
    if(UserAccManager.verifyEmpno(empno)){
                                  ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
         if(UserAccManager.verifyUsername(username)){
                                             ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                       ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable password
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable level
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                         ^
    6 errorshere is the CreateAcc.jsp file
    <%@ page language="java" %>
    <%@ page import="com.UserAccManager" %>
    <%@ page import="com.UserPassword" %>
    <jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
    <jsp:setProperty name="userPassword" property="*" />
    <%
    String nextPage ="MainForm.jsp";
    if(UserAccManager.verifyEmpno(empno)){
         if(UserAccManager.verifyUsername(username)){
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
          }else{
               nextPage="UserNameExist.jsp";
          else{
              nextPage="UserAccError.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
    Thanks.

  • How to download a file from server machine to client machine using jsp

    Hi,
    In my application, I have an excel file stored on my server machine. How can I download that excel file on to my client machine using jsp. Is there any other way I can open that file from my machine and save it in my machine using jsp/java?
    Its an emergency for me to do this.
    Can anyone provide me the full code to download a file from server machine as I don't have
    time to browse through various sites.
    thanks in advance,
    Tiijnar

    Please post your code using code tags (click on CODE above the text area, when posting)
    response.setContentType("application/octet-stream");Why octet-stream? Set the correct mime-type.
    String disHeader = "Attachment; Filename=\"filename\"";The filename should just be the file's name. Not the complete path to the file! This will tell anyone where the file is located on the server. It's also inconvenient because by default,the browser will suggest it as the name for the download.
    Your way of writing to the output stream is just plain wrong. See this snippet (picked from [http://balusc.blogspot.com/2007/07/fileservlet.html])
            BufferedInputStream input = null;
            BufferedOutputStream output = null;
            try {
                // Open streams.
                input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
                output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
                // Write file contents to response.
                byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                int length;
                while ((length = input.read(buffer)) > 0) {
                    output.write(buffer, 0, length);
                // Finalize task.
                output.flush();
            } finally {
                // Gently close streams.
                close(output);
                close(input);
            }

  • Use Redis Cache for Multiple Applications

    Hi,
    I did some searches and could not come up with a straight forward answer so I am hoping someone here can clarify this for me.
    We have two different products that we have built in .NET that we host in Azure as websites. For each of these two products we have multiple clients. Each product and client pair has its own SQL database and its own website setup in Azure.
    We would like to start using Redis Cache for the session of these products. Do I need to:
    1) Create 1 Redis Cache and use it for all clients / products?
    2) Create 2 Redis Caches and use one per product (redis caches needed = # of products)?
    3) Create an individual Redis cache for each client / product pair (redis caches needed = # of products x # of clients)?

    You can do either of the above. It would really depend on how much load are you expecting on the Cache
    For separation and load balancing it might be better to have a Cache per Website
    For a Cache to be useful it should be closer to the Web tier, so ensure that you provision the Cache in the same region as the Website.

  • IM client in a jsp

    Dear all,
    Can anyone suggest a IM client that can be called within a jsp (and then inserted within a
    portlet in the IBM Websphere framework)? All the IMs I have seen seem to standalone
    client/server apps, not intended for use within a jsp.
    Thanks a lot!
    Paul

    Your looking for an IM API/framework that you can embed into a web app. Interesting concept I must admit. On a higher level IM apps are more P2P based where web apps are client/server based. There's no real reason, however, why someone couldn't embed an IM client into a web-app. At least I can't think of any limitation. I can tell you that there is no IM client that you can just drop into a web app out of the box. It's going to require some custom coding against an IM API. The alternative is to use an Applet approach which offloads the IM logic onto the client. For that you can look into Odigo. They have an IM client applet that you could drop into any HTML page.
    Cliff

  • Error while starting the service "oracle client cache"

    hello everyone,
    I keep getting an error message: while i'm starting the service "oracle
    client cache "
    The instruction at 0x7c911e58 referenced memory at 0x00000000. The
    memory
    could not be read.
    please help me in rectifying this error ASAP
    so that i can proceed further in my work
    thanks in advance

    Hi
    i have got the answer for this question, i updated the registry with the correct file path, and then closed the registry, the services.msc file is automatically updated with the correct path
    and then started the CSService, then went to the OEM setup i clicked Retry buton, then it went through.
    Thanks to all the viewers.

Maybe you are looking for

  • Synching problems...

    I recently went to the Genius bar when I was having probs, with several songs on my ipod in terms of freezing or skipping them, was told to restore and fix any songs that might have been typed in funny like for example one of the songs that skipped b

  • SOAP error in synchronous scenario for ABAP Proxy with Oracle D/B

    Dear Experts, I am working in Sender ABAP Proxy <====>SAP PI 7.31 JAVA only <====> Oracle Database. My proxy configuration are working successfully. Apart from that, I have maintained a SOAP sender communication channel under the ECC business system

  • Deleting row in matrix.

    Hello. I have weird problem. If I add some rows to matrix, and then delete rows the method with: m_pMatrix->GetRowCount(); return the number of rows without delete. For example: If i have matrix with 5 rows, and I delete 2 rows, method with GetRowCou

  • File import failure in premiere pro on specific files

    I have installed the latest version of Premiere Pro CC 2014. I am trying to import several video files that i have recorded on a Canon 5D Mark III. The problem is that while some of the files gets successfully imported, many files cant import because

  • Can I use an Image in Shape based Buttons?

    I have a 4 layer .psd file (created in Gimp 2.2 in X11). I have followed every tutorial I have found here, and then tried several other arrangements as well, but I can't get the button to act correctly. I want the multi-colored Shape to be the Select