Help coderanch get a
new server
by contributing to the fundraiser

avaya sahu

+ Follow
since Oct 16, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by avaya sahu

I am trying to register my custom PropertyAccessor. I am able to register it and is working fine when expression is directly evaluated against it using Ognl. but the same is not working from value stack. Asper my understanding the property is searched in the stack till it find a match or reach end of the stack. Am I right? please help. below is the code
14 years ago
Thanks for the information and email id
Can I access request and response within LoginModule.login()?
If I get access to servlet container within login module can I create session with a specified ID?
Can I give it a different name instead of JSESSIONID?
I have enabled basic authentication on Tomcat 5 server.
please help.

15 years ago
I am working on security module with the following requirement.
1. Authentication should happen once using basic authentication.

2. Any subsequent request should go through the process but should not do the actual authentication rather should check the data from session.

can some provide me sample class and configuration detail to integrate simple LoginModule. At this point I don't have any Autherization requirement, all modules are accessible to all authenticated user. Authentication criteria: user name should same as password.

I have tried it by reading some document. I am able to complete the authentication part I belive but authorization is not working.
Below are the files and steps that I have performed.

web.xml Change
<web-resource-name>Entire Application</web-resource-name>
<!-- Define the Login Configuration for this Application -->
<realm-name>Your Realm</realm-name>

jaas config:
DemoSP {
HttpLoginModule required debug=true;


<Realm className="org.apache.catalina.realm.JAASRealm"
public class HttpLoginModule implements LoginModule {
public boolean login() throws LoginException {
String username = null;
String password = null;
try {
username = ((NameCallback) callbacks[0]).getName();
password = new String(((PasswordCallback) callbacks[1]).getPassword());
} catch (IOException e) {
throw new LoginException(e.toString());
} catch (UnsupportedCallbackException e) {
throw new LoginException(e.toString());
userPrincipal = new SamplePrincipal(username);
return true;
public boolean commit() throws LoginException {
return true;
//default implementation for others

JDK argument :

15 years ago
Hi All,
I have taken a voucher for SCEA part 2.
I would like to know the process to get the assignment downloaded.
Do I have to register for the exam through some online system?
I asked the persom from whom I bought the voucher, but he told me I have to get it from sun site.
Please let me know how to proceed.

Originally posted by Ulf Dittmer:
First of all, Patience Is A Virtue.

As to your question, Apache Xerces is one such a library.

I have very specific requirement, so wnatted to know whether it can handle it or not.

I have an element node with me and user will give xpath relative to the element to retrive to node(s) pointed by the xpath.

It should support attribute and regular expression.
pls. let me know what API(class) should be used for this?
Hi, I am new to XPath. Can any one let me know from where I can download xpath library(free and meets w3c specification). I am using jdk 1.4.
Is there any such library form w3c. Please let me know.
It is very urgent.

Thanks in advance !!!

1. what is servlet context and what it takes actually
as parameters? (other than from .xml file)

Ans: Servlet container takes care of it. I don't know how it is created. pls. let me know if u get any ans to this question.

2. can we call destroy() method on servlets from
service method?

Ans: yes. it is like any otehr method. But it will not deregister the servlet. if you have any code which do some cleanup then it will lead the servlet to unstable state.

3. is there any difficulty of using the vector class
within a servlet class

Ans: No, but if you are using it as instance variable it will degrade the performace as vector is thread safe.

4. what are the parsers and how can you use them in
your application?
Ans: XML -> sax, pull, dom

java parser: Antlr, YMCC

5. is there any other immutable object other than

Ans: don't know, let me know if there is any.

6. how you are implementing multithreading concept in
fourth driver?

Ans: which 4rth driver is not multithreaded?

7. what are the advantages of doget() method?

Ans: can be invoked directly by passing query string. Is useful for invoking resource through hyper link

8. when the servlet is going to initialize first time?

Ans: At startup and only once

9 how to avoid deadlock situation?(other than singleton)

Ans: singleton is not for avoiding deadloc.

10. how to identify and remove the duplicate values in
an array?

Ans: iterate through entire list and compare each one with other to find duplicate. use 2 for loop for this.

11. if a system exposes bussiness API's to a client -
then what pattern it is using?
a) data access object.
b) value object.
c) business delegate.

Ans : c) business delegate.

12. What is threadsafe,class variable, instance variables? What is the difference in that
19 years ago
I think you have not registered the Delete servlet, u have to to call sendredirect by passing the path of servlet. once you do it by using urlrewriting you can invoke the delete servlet and after performing the task can redirect the request to search page again.

I will suggest you to go for JSp soln instead of servlet.
in case of jsp you have to drop you out.print* with simple text

e.g if you have written a statement like out.print("<Html>");

just write <html>

for any logic where u need java code just write it inside
// code

html code

<% code
19 years ago

it is possible. I think you are trying to fetch field name from Global class. if the Global.LANG ="english" you want to fetch the corresponding constant value from Language class.

You have to use reflection for this. There is no language feature which directly support expression evaluation as you mentione in the post.

but following code will work fine

int lang = 0;
Field f = (Language.class).getField(Global.LANG.toUpperCase());
lang =f.getInt(Language.class);
catch(IllegalAccessException ise)
}catch( NoSuchFieldException ne)
19 years ago
It seems that you are trying to play with java language feature. When catch statement is used compiler should be informed about the type of the exception so that it can check whetehr the order of catch are correct and whether it is inherited form the proper class(e.g Excpetion,RuntimeException, Throwable) by allowing class literal it will have no clue of the class type an its heirachy.

I don'tnow any elegant soln to the problem. but you can catch throwable then use reflection to check whether the exception is of expected type.
cath(Throwable th)
if (th.isAssingable(use))
19 years ago
Hi Geoffrey,
The solution you mentioned will work if the child classloader is depends on a single classloader(single parent), but in my case the child classloader is dependant on two or more classloader excpet its own jar file. There is no cyclic dpendancies.

19 years ago
I am working on a multiple application launcher. As it runs multiple applications simultaneously it requires that classes of each should be issolated from each other. There is no problem in implementing this. I have completed this using custom classloader. But the new requirement says that if two application refer to some common jar file then they should be shared. The main intension of this is to reduce memory usage. so keeping eye on new requiremtn we have decide to load each jar file using a new class loader. Take an example :

ClassLoader 1 loads a.jar

ClassLoader 2 loads b.jar (this depends on a.jar i.e classloader 1) so we set the parent of 2 as 1.

ClassLoader 3 loads c.jar (this depends on a.jar i.e classloader 1) so we set the parent of 3 as 1.

ClassLoader 4 loads d.jar

Now the class loader 5 which loads e.jar depends on a.jar, b.jar, c.jar

Now the class loader 6 which loads f.jar depends on a.jar, d.jar

Is it possible to reuse the 1,2,3 class loader in 5 and 6?

It is very urgent.
19 years ago
How to Create toolbar window in java(awt)? It should have win9x features. when user drag the toolbar, it should be displayed in a separate window. On double clicking on the title bar of the toolbar widow it should be agin added to the parent frame.
What I want is to create a window with default frame behaviour? It should not have built in title bar or it should be customizable.
22 years ago