Java URL inputstream caching

Java URL inputstream caching

I have a web application in which the header is displayed by hitting a URL. Since the header content doesnt change always i wanted to cache the results of the URL inputstream and refresh it for every 60 mins. The code of my header.jsp is

<%    
    URL url = new URL(strHeaderURL);
    isProxyEnabled = UCMUtility.getProperty("globalheaderproxyenabled");
     System.out.println("isProxyEnabled "+isProxyEnabled);

     System.out.println("condition "+isProxyEnabled.equals("Y"));
     if(isProxyEnabled.equals("Y")){
         System.out.println("inside proxy Yes");

         proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(UCMUtility.getProperty("globalheaderproxy"), Integer
                    .parseInt(UCMUtility.getProperty("globalheaderport"))));
         connection = url.openConnection(proxy);
     }
     else{
         System.out.println("inside proxy No");

         connection = url.openConnection();
     }
     connection.setDoInput(true);
     //connection.setReadTimeout(1000);
     //connection.setConnectTimeout(1000);
     InputStream inStream = connection.getInputStream();  
     input = new BufferedReader(new InputStreamReader(inStream));
     strContent = new StringWriter();  
     while ((strLine = input.readLine()) != null) {     
         strContent.write( strLine+"\n" );   
     }
              out.println(strContent.toString());
         %>

I include this header.jsp in all other jsp's.... Now I wanted to cahce the result of this jsp and refresh it for every 60 minutes. How can I do this? Can anyone guide me please. I searched a lot in net but could not find anything which I can understand :( Someone pls help me ..

View Answers

Ads









Related Tutorials/Questions & Answers:
Java URL inputstream caching
Java URL inputstream caching  I have a web application in which the header is displayed by hitting a URL. Since the header content doesnt change always i wanted to cache the results of the URL inputstream and refresh it for every
Java IO InputStream Example
Java IO InputStream Example In this section we will discuss about the InputStream in Java. An abstract class InputStream is a base class of all the byte... in the java.io package. There are various of subclasses which extends InputStream
Advertisements
Java Write To InputStream
Java Write To InputStream In this tutorial you will learn how to write to InputStream in java. Write to file from InputStream in java you may use the InputStream class of java.io package. This class reads the streams of bytes
How to write file from inputstream in java
How to write file from inputstream in java  Hi, how to write file from inputstream in java program. Plz suggest an example or suggested link... link to your query "How to Write to inputStream in Java". This is good
Read/Convert an inputStream to a String
Read/Convert an inputStream to a String  Hi, I have an input stream in Java and convert it to a String. what is the best code for for this? How to Read/Convert an inputStream to a String? My object is of java.io.InputStream
Maven dependency for com.sandinh - spray-caching version 1.3.0 is released. Learn to use spray-caching version 1.3.0 in Maven based Java projects
this version ( com.sandinh - spray-caching version 1.3.0 ) in their Java project... and includes  com.sandinh - spray-caching version 1.3.0 java library in your project...Maven dependency for  com.sandinh  - Version 1.3.0 of spray-caching
Caching UIWebView
Caching UIWebView  Is it possible to save the downloaded file in caching? Actually, in my iPhone application i am trying to load a pdf file... to load. Is it possible to caching the loaded file in UIWebView. And if yes
Caching UIWebView
Caching UIWebView  Is it possible to save the downloaded file in caching? Actually, in my iPhone application i am trying to load a pdf file... to load. Is it possible to caching the loaded file in UIWebView. And if yes
java referer url
java referer url  How to get the referer url in Java? Thanks
Creating URL in java
Creating URL in java  Hii to all I m trying to create a url using java. Address is http://www.merchant.com/pg/index.html When i m going to run... Url { /** * @param args */ public static void main(String
Hibernate Caching
This tutorial contains description about Hibernate Caching
Hibernate: Session Caching
In this section we will discuss first type of caching in Hibernate that is Session caching
HTTP URL Address Encoding in Java
HTTP URL Address Encoding in Java  HTTP URL Address Encoding in Java
ModuleNotFoundError: No module named 'caching'
ModuleNotFoundError: No module named 'caching'  Hi, My Python... 'caching' How to remove the ModuleNotFoundError: No module named 'caching... to install padas library. You can install caching python with following command
ModuleNotFoundError: No module named 'caching'
ModuleNotFoundError: No module named 'caching'  Hi, My Python... 'caching' How to remove the ModuleNotFoundError: No module named 'caching... to install padas library. You can install caching python with following command
Convert Inputstream to ByteArrayInputStream
Convert Inputstream to ByteArrayInputStream  ... InputStream to ByteArrayInputStream.  To do so first...;{   InputStream inputStream= new FileInputStream ("
Convert InputStream to File
Convert InputStream to File       Here we are showing how to convert an InputStream... InputStream is written into the desired file.  
Convert InputStream to BufferedReader
Convert InputStream to BufferedReader   ... Inputstream to Bufferedreader. The class ...; into InputStreamReader  and finally we convert the InputStream into BufferedReader
Hibernate: Query Caching
In this part you will learn about Hibernate query caching
Application Level Caching
Application Level Caching  How to create application level caching using mbean, without using any orm like hibernate
Working With File,Java Input,Java Input Output,Java Inputstream,Java io Tutorial,Java io package,Java io example
:\nisha>java CreateFile1 New file "myfile.txt" has been created... CreateFile1.java C:\nisha>java CreateFile1 The specified file
Version of com.sandinh>spray-caching dependency
List of Version of com.sandinh>spray-caching dependency
ModuleNotFoundError: No module named 'directory_caching'
ModuleNotFoundError: No module named 'directory_caching'  Hi, My... named 'directory_caching' How to remove the ModuleNotFoundError: No module named 'directory_caching' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django_caching'
ModuleNotFoundError: No module named 'django_caching'  Hi, My... named 'django_caching' How to remove the ModuleNotFoundError: No module named 'django_caching' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django_caching'
ModuleNotFoundError: No module named 'django_caching'  Hi, My... named 'django_caching' How to remove the ModuleNotFoundError: No module named 'django_caching' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'falcon-caching'
ModuleNotFoundError: No module named 'falcon-caching'  Hi, My... named 'falcon-caching' How to remove the ModuleNotFoundError: No module named 'falcon-caching' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'falcon-caching'
ModuleNotFoundError: No module named 'falcon-caching'  Hi, My... named 'falcon-caching' How to remove the ModuleNotFoundError: No module named 'falcon-caching' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'falcon-caching'
ModuleNotFoundError: No module named 'falcon-caching'  Hi, My... named 'falcon-caching' How to remove the ModuleNotFoundError: No module named 'falcon-caching' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Flask-Caching'
ModuleNotFoundError: No module named 'Flask-Caching'  Hi, My... 'Flask-Caching' How to remove the ModuleNotFoundError: No module named 'Flask-Caching' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'm-caching'
ModuleNotFoundError: No module named 'm-caching'  Hi, My Python...-caching' How to remove the ModuleNotFoundError: No module named 'm-caching' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'm-caching'
ModuleNotFoundError: No module named 'm-caching'  Hi, My Python...-caching' How to remove the ModuleNotFoundError: No module named 'm-caching' error? Thanks   Hi, In your python environment you

Ads