Win a copy of Head First Android this week in the Android forum!

Sandeep Deb

Greenhorn
+ Follow
since Jun 01, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sandeep Deb

Hi,
This genre of problems are easily handled by the Intercepting Filter and Front Controller J2EE design pattern. There are many frameworks which give you the ability to implement either or both. As many of the posts have mentioned earlier, Servlets give you the ability to implement intercepting filters via the Filters mechanism.

If you are using Struts, you can use a custom RequestProcessor or if you have an Action class hierarchy you can implement the check on the top of the hierarchy. Spring MVC also gives you the ability to implement intercepting filters. You can always implement a servlet filter irrespective of whether you are using a MVC framework or not.

I hope this helps.

- Sandeep
14 years ago
Many thanks Ilja. I will check out your suggestions tomorrow and update the post with my findings. I went through the documentation of the options you have suggested and they look quite promising.

Thanks again,
- Sandeep
14 years ago
Hi,
Just google "HTTP Protocol" and you will get lot of useful information. From beginners to advanced. I have pasted some URLs for you:

http://www.w3.org/Protocols/
http://www.w3.org/Protocols/HTTP/HTTP2.html
http://en.wikipedia.org/wiki/HTTP
http://www.jmarshall.com/easy/http/
http://www.freesoft.org/CIE/Topics/102.htm

Hope it helps.

- Sandeep
Hi,
Is there any way to reduce the memory footprint of a full blown JVM. I am trying to launch a Java application and keep it running for a long time and would love to make it lean in terms of footprint. I have tried to do some research, but unfortunately couldn't gather anything useful. It would be great if someone could share some pointers or experiences.

Regards,
Sandeep
14 years ago
Unfortunately, the above solution has some drawbacks. The hosts file can override the name to IP lookup and will also work in a disconnected mode. So for example, if I change my hosts file on c:\windows\system32\drivers\etc (note, there is another hosts file on c:\windows\i386) and and entry mapping www.gooogle.com to 2.3.4.5, the above code would return 2.3.4.5 even if my machine is unplugged.

I suggest using the following code to ascertain if your computer is connected to the network.



Of course you will have to made ammends for a proxy server, if any. Note that this is a blocking call and blocks for approx 5 seconds if no network is present.

Hope this helps.
Jack,
There is very little information to answer in specifics, but if you are looking for search engines which can index your content, try exploring Lucene. Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform.

You can find more information about Lucene on Apache's site here

I hope this helps.

- Sandeep
14 years ago
Swapnil,
As Ilja rightly mentioned, Java provides no standard (predefined) way of doing Inter Process communication - which is what you require. Common methods of achieving inter process communication include, sockets (most preferred), RMI, CORBA, locking files (least preferred).

I am pasting some links which can give your more insight into which method would be the best for your case:

JavaWorld article
Sun's developer forum

I hope this helps.

- Sandeep
[ June 04, 2007: Message edited by: Sandeep Deb ]
14 years ago
HashMap, HashTable are associative arrays where one key can map to one value. There are variances of associative arrays called multi maps which can store multiple values against one key. Java API doesn't provide a default implementation of a multimap, but you can find one in Apache's collection framework

MultiMap

You can find more information about MultiMaps here

- Sandeep
14 years ago


- Sandeep
14 years ago
The home interface is something behind which the container can plug in the barricade of features by creating stubs. When you get a reference to the home interface, in effect you are getting a reference to a container generated stub which in turn delegates your call to the EJBObject implementation.

By calling the EJBObject directly you loose on two major features a)location transparency (although EJB2.0 helps you avoid that) b) Feature overlap, like transaction, security etc that is transparently provided by the container.

Regards,
Sandeep Deb
Hi,
Remember that Portlets are extentions built on the Servlet framework. The Portlet API provides PortletRequestDispatcher interface to help delegate the creation of contents to Servlets and JSPs. Please note that the portlet request dispatcher can be used ONLY during render requests. Also, one of the differences between portlet and servlet request dispatcher is that the portlet request dispatcher doesn't have the forward method.

You can find an extremely lucid description on section PLT16 of the Portlet 1.0 Specifications.

Regards,
Sandeep
14 years ago
Just posted a similar response to another query:

Try the setFetchSize(int rows) on the ResultSet. As far as I know, the JDBC specification talks about giving caching "hints" to the implementation. I have experimented with varying cache size on a performance related problem and have found quite significant benefits. I was using Oracle 9i and the OCI driver.

setFetchSize(int rows) - Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object. If the fetch size specified is zero, the JDBC driver ignores the value and is free to make its own best guess as to what the fetch size should be. The default value is set by the Statement object that created the result set. The fetch size may be changed at any time.

14 years ago
Try the setFetchSize(int rows) on the ResultSet. As far as I know, the JDBC specification talks about giving caching "hints" to the implementation. I have experimented with varying cache size on a performance related problem and have found quite significant benefits. I was using Oracle 9i and the OCI driver.


setFetchSize(int rows) - Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object. If the fetch size specified is zero, the JDBC driver ignores the value and is free to make its own best guess as to what the fetch size should be. The default value is set by the Statement object that created the result set. The fetch size may be changed at any time.

14 years ago
Dear Ramon,
The RequestDispatcher.forward(..) method forces the container to purge the view data before the thread exits from the servlet. This can be ascertained from the specifications (2.4).

Before the forward method of the RequestDispatcher interface returns, the response content must be sent and committed, and closed by the servlet container. [SRV8.4-Servlet Spec 2.4]



Also, please note that as per specifications the the Container Provider must ensure that the dispatch of the request to a target servlet occurs in the same thread of the same VM as the original request and hence the DB processing work won't start till the forwarded view content generation is completed.

I hope this helps.

Regards,
Sandeep.
14 years ago
Agree with Ulf. Although you can hide the URL from the user, it's not a good solution. Instead, the recommended way is to harden your servlet to take care of exception conditions.
14 years ago