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
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
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
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
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 File
Convert
InputStream to
File
Here we are showing how to convert an
InputStream...
InputStream is written into
the desired file.
 
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
Application Level Caching
Application Level Caching How to create application level
caching using mbean,
without using any orm like hibernate
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