Subhadip Chatterjee

Ranch Hand
+ Follow
since Dec 12, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Subhadip Chatterjee

Hi folks,
I am using Stripes to control the view and user-requests, in my project. Recently I have changed the server from Tomcat to WAS 6.1. Previously I was using DynamicMappingFilter to map the action-beans with the pattern like /*. Now in WAS the same isn't working anyway, so I am using DispatcherServlet. The main problem is I need to use /* url-pattern for action-beans. Kindly suggest if it's a known problem.
Hi Fred,
that's right. Even I had the same info from Stripesframework site [http://www.stripesframework.org/display/stripes/Lifecycles+Etc.]. But I guess masking the URL is allowed in Stripes. e.g.
----------------
abstract BaseXYZActionBean implements ActionBean(@UrlBinding - "/search")

SubClassOfXYZ extends BaseXYZActionBean (@UrlBinding - "/search/{$event}")

The events are defined in BaseXYZActionBean class including @DefaultHandler.
----------------
Now if I try the URL "/search" from the browser, it's mapping SubClassOfXYZ, and invokes the inherited @DefaultHandler in it. So, from the browser it seems as if Base class is getting invoked.

The only problem is if there are more than one sub-class, then to invoke the URL of base (though an abstract), I've to keep one of subclass's @UrlBinding as the above example. Let me know what do you feel about this approach (though not much logical in my opinion).
Hi Nathan,
It makes sense what you are saying. I also checked the "HTTP URL specification". It has "=", ":" etc as reserved characters. Now the http url allows "=" in it in the "/url?serach=term" structure, as we know. Hence isn't there any possibility that ":" also would be taken someway!!!
Just a thought. Thanks for your reply.
Hi folks,
I have quite interesting task in hand. While designing for a project, I kept certain base ActionBean classes as abstract with atleast one abstract method, which would be implemented in the sub-classes. Now, the base classes are bound to some URL as per my design, to suit the requirement. If any subclass URL is invoked it's working properly, taking the inherited handler impl. from base, but i'm not able to invoke the base class handler by it's own URL. Kindly confirm with your ideas.

e.g.
abstract BaseXYZActionBean implements ActionBean(@UrlBinding - "/{$event}/{field}")

SubClassOfXYZ extends BaseXYZActionBean (@UrlBinding - "/title/{$event}/{field}")

The events are defined in BaseXYZActionBean class.

Now from the browser, the url "/title/{$event}/{field}" is working, but not the "/{$event}/{field}". Kindly suggest.
Hi Ulf,
Yes ofcourse...but the project requirement was specified with that URL type. If there's no way at all, the I have go back to the team & propose the new URL. Let me the feasibility of having the colon in URL.
Hi folks,
I'm back again with an issue in Stripes. I need to support a different URL structure where users can pass parameters, to query, in the URL itself.The structure is as next:
[http://mydomain.com/find: term1+term2+...]. My bean class was previously having @UrlBinding ("/find"); How do I get the mapping of this new URL "/find:term1+term2+..."? Kindly suggest.
Hi folks,
I am encounteruing a strange problem, which seems silly, but yet doesn't run in my Eclipse IDE (JRE 1.5); I have a source package, called "trial", inside which I have a factory class. the factory class reads a property file, which is under the same pacakge, "trial", and instantiates two classes;

the Factory class code is, as below,
---------------------
props = new Properties();
props.load(new FileInputStream("storage.txt"));

String rendererClass = props.getProperty("renderer.src");
String providerClass = props.getProperty("provider.src");

renderer = (MessageRenderer) Class.forName(rendererClass).newInstance();
provider = (MessageProvider) Class.forName(providerClass).newInstance();
---------------------
Properties file contains:
---------------------
renderer.src = StandardOutMessageRenderer
provider.src = HelloWorldMessageProvider
---------------------

Now if i use the factory class in a java class's main method, and execute, it first throws "FileNotFoundException" for file <storage.txt>; secondly if I give absolute path of the file, then it says "StandardOutMessageRenderer" class isn't found, though all the files are inside same pacakage. My output folder is also linked in the {.classpath} file.

Kindly suggest
16 years ago
Thanks Stevie for the reply...you know what, I'm using struts framework for display & user request Controllers (Action servlet & Action classes). So, I can't possibly have single instance for Controllers.

From the Action class, I'm making call to the singleton POJO class, that uses one DAO class (sometime a DAOFactory to map proper DAO) to perform a DB operation. This DAO is also singleton.

My concern is in load testing, when say a load of 50 concurrent users will be tested, would this singleton-design may slow down the application? (50 user threads are trying to use same instance of POJO class & same instance of DAO to perform one DB job)would there be any locking on POJO may happen?
Thanks Eric, I appreciate that. When you said "commercial API", it certainly needs a license to run on a machine. But I have no option for buying a license at this stage of project. anyway, thanks for the response.
Hi Folks,
I have a requirement in my application, to generate DAO source-codes & queries-xml file for basic CRUD operation on each table in DB. More explicitly, if I have a table in DB, called TBL_COMPANY, i want to write a java-code which will read the database-metadata info, and generate a XML file (say, tblCompanyAccess.xml) that contains SQL queries for basic CRUD operation in TBL_COMPANY. Plus, the same code has to generate a DAO source-file, which will have select(), insert(), update(), delete() methods implemented to use the queries from "tblCompanyAccess.xml" & perform the job.
Can I use XDoclet api to achieve this task? If yes, then can anybody atleat guide me how to start with?
17 years ago
Hi Folks,
I have designed my project with basic singleton-pattern, i.e. singleton java beans calling DAO to perform DB operation. These beans are then referred by a WEB project's controller classes to invoke data operations. My intention to create a Service-layer & DAO with singleton-pattern is to reduce number of objects in the heap. But would this be a problem, when application's user base is large, i.e. would it really slow down the performance if I run load-testing on the application?

This is really urgent for my project. Do help me out.
Hi folks,
Does anybody have any answer to the question I posted before. I hope someone might have faced this before, and can feed me with a solution!!!
Hi folks,
I have requirement for my current project, which needs user to print the page in LANDSCAPE mode. User o/s is Windows, browser is IE 6. I have tried using {WScript.Shell} but of no use, as that leads me to Printer-model specific setting. I want to get an ENUM of windows default-printer properties, and then pass a printer-property which will set the page orientation as "landscape". Please pass me suggestions.

I have tried this options:
<style type="text/css" media="print">
page {
size:landscape;
}
</style>
------------------------------------
<script>
var shell = null;
function SetPrintProperties() {
try {
shell = new ActiveXObject("WScript.Shell");
shell.sendKeys("^p");
setTimeout("shell.sendKeys('%R')",1000);
setTimeout("shell.sendKeys('%L')",1100);
//setTimeout("shell.sendKeys('{ENTER}')",1200);
//setTimeout("shell.sendKeys('{ENTER}')",1300);
}
catch (e) {
alert ("An exception occured: " + e + "\nCode is: " + e.number + "\nDescription is: " + e.description);
}
}
</script>
Hi Folks,
I am using java print service API, for printing generated PDF files, thorugh system's default printer (WinXP OS-system). Now, every time I run the app.,the printer only prints "PDF file not printed.128 MB of memory is reqd. to enable direct PDF printing". If any of you have come across this problem, and has any solution, please pass it onto me.

here is my code snippet
-------------------------------------------
/** "out" refers to ByteOutputStreamArray object,
* which is popolated during PDF generation through XSLT
*/

DocFlavor psFlavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
System.out.println("Step 6 is done");
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new Copies(2));
System.out.println("Step 7 is done");
PrintService pservice = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("Step 8 is done");
if (pservice != null) {
System.out.println("Printer name=>"+pservice.getName());
DocPrintJob pj = pservice.createPrintJob();
System.out.println("Step 9 is done");
try {
if(out != null){
Doc doc = new SimpleDoc(out.toByteArray(), psFlavor, null);
System.out.println("Step 10 is done");
pj.print(doc, null);
System.out.println("Step 11 is done=>document is sent to Printer");
}
else{
System.out.println("The ByteArrayOutputStream is NULL");
}
}
catch (PrintException e) {
System.out.println("Step 12A is reached");
e.printStackTrace();
}
catch (Exception ex){
System.out.println("Step 12B is reached");
ex.printStackTrace();
}
}
else{
System.out.println("No printer service is found!!!");
}
--------------------------------------------------------
18 years ago