Java URL inputstream caching

Ads
 

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
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
HTTP URL Address Encoding in Java
HTTP URL Address Encoding in Java  HTTP URL Address Encoding in Java
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
How to Overcome proxy in Java URL connection
How to Overcome proxy in Java URL connection  Hi, I'm just trying to make java url connection. But it shows some errors due to proxy ..... I would like to read a URL (http://google.com) using java url, i made the url
URL Rewriting in Java
URL Rewriting in Java URL rewriting a session management technique and in this tutorial, you will be informed about URL Rewriting in Java. URL writing is a way, which is used to hide the original URL. It is commonly handle by filter, You
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
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 how to get domain name from url
java how to get domain name from url  How to get the domain name from a url string? Example program in java for "how to get domain name from url" Thanks   Hi, You can use the following example code: URL linkURL
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
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.  
Overview of Networking through JAVA,Convert URI to URL
Convert URI to URL      ... Identifier (URI) reference to uniform resource locator (URL). Here we are give... in the example we make a  URI object and a URL object. After that we pass a URI "
URL in term of Java Network Programming
URL in term of Java Network Programming.... In this section we will provide the complete information about the way of using URL in java... are provide a simple name structure of a URL which addresses the Java Web site
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
Overview of Networking through JAVA,How to retrieve URL information
How to retrieve URL information   ... the network information for a given URL. In the given below example we use the URL class and make a object. After creating a object we assign a new URL
Java Servlet : URL Rewriting
Java Servlet : URL Rewriting In this tutorial, we will discuss about URL Rewriting. It is one of session tracking technique. URL Rewriting : You can use another way of session tracking that is URL rewriting where your browser does
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

Ads