Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java URL inputstream caching
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Madhavi
Java URL inputstream caching
0 Answer(s)      a year and 3 months ago
Posted in : Java Beginners


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 ..


Advertisement
View Answers

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 convert string to InputStream
Java convert string to InputStream In this section, you will learn how to convert string to Inputstream. In one of the previous sections, we have discussed the conversion of InputStream to string. Here we are going to do just reverse
java referer url
java referer url  How to get the referer url in Java? Thanks
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
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
URL Block - Java Beginners
URL Block  Hello sir, How to block one website using java.for example if we want block "www.orkut.com" site,how to block this site using java... to block a URL like this?please help me.. Thanking you
HTTP URL Address Encoding in Java
HTTP URL Address Encoding in Java  HTTP URL Address Encoding in Java
Hibernate Caching
This tutorial contains description about Hibernate Caching
hibernate caching - Hibernate
hibernate caching  what is caching ?how to work with caching in hibernate ?can u give brief explanitation
Hibernate: Session Caching
In this section we will discuss first type of caching in Hibernate that is Session caching
php page caching
php page caching  Page caching in PHP script required
Application Level Caching
Application Level Caching  How to create application level caching using mbean, without using any orm like hibernate
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
Hibernate: Query Caching
In this part you will learn about Hibernate query caching
Caching HttpServletResponse's content.
Caching HttpServletResponse's content.  I am trying to cache the response using Filter. I have extended HttpResponseWrapper. It has issues with flushing the streams. If you hit the service for the first time, it fetches the data
Example caching - MobileApplications
Example caching  Hi everyone!! I am a student in Viet Nam, I am coding a project J2ME. Before, I had some question in RoseIndia and received your userfull anwsers. Now, I code to caching in j2me, I would like to save results
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
Saving URL in local disk - Java Beginners
Saving URL in local disk  Hi Friend, How can i Save URL like "www.jagran.com " on local disk throgh java Statement. Thanks ,in advance
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
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
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
Java file from url
Java file from url In this section, you will learn how to convert url to file. Description of code: We have already told you the conversion of file to url... urlstring = "file:///C:/java/examples/data.txt"; URL u = new URL(urlstring
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
Java file to url
Java file to url In this section, you will learn how to convert file to url... void main(String[] args) throws Exception { File file = new File("C:/Java... easily convert file to url whether there is a simple path or contains special
Advertisements
 

 

 

DMCA.com