Mukesh Bhojwani

Greenhorn
+ Follow
since Mar 11, 2008
Merit badge: grant badges
For More
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 Mukesh Bhojwani

Hello Poonam... it's unfortunate that your solution as well not worked for me. When I hover mouse to 'Click Me', in browser's status bar it's showing only the URL WITHOUT ;jsessionid=123456.

Am I missing anything??? Please guide me.
Hi Poonam, Thanks for correcting the quote miss match.

I explain you what I am intending to do.

In HFJS I read if cookies are disabled the container uses URL rewriting provided you use encodeURL(..) function, and the URL will automatically be appended with JSESSIONID
E.g
http://192.168.0.127:8084/CookieTest/result.jsp;jsessionid=123456

So with the code below (cosider the one provided by you), the URL is created, now providing URL pattern of the servlet on the browser I get 'Click Me' hyperlink. Now when I do mouse over to 'Click Me' hyperlink, in the status bar of the browser where the url appears, I expect ;jsessionid=123456 appended to the URL but it is not. Moreover, the same thing happens when I click the link, the browser's url bar also resembles the same thing.

I hope, I explained the problem. Please let me know if there require further explanations.
Hello All,

From my browser I disabled the Cookies to check the URL rewriting thing.

In my servlet I use the following code



I deploy and run the application, ensured that the cookies are disabled by getting request.getCookies() as NULL, when I do mouse over on the 'Click Me' I do not see anything like ';jsessionid=123456' appended to the URL. If I click still on the URL bar I am unable to see this thing.

Could anyone help me out to solve the problem.
Thanks Christophe.... Yes I agree fully.

Thanks Chinmaya for locating the method and providing the API link but still as Christophe pointed out the exam is for Servlet 2.4,
So looks like printing mistake...., what you say?
In Head First Servlet & JSP 2nd Edition Chapter 5 - Attributes and listeners, check the mock answer 14 where it mentions that ServletContext has method getContextPath, but when I verified.... I did not find any such method.

when I tried the test I did not mark the getContextPath method for ServletContext interface.. later when I checked the answer,,, I thought I incorrectly answered the question... But when verified I realized I did it correctly.

Is it a printing mistake in the book?
Thank You very very much.

I tried it, it worked absolutely funtastic!!!
I want to print the following POST request details by the servlet



I use the following code in my servlet.

Of the intended details I am unable to print the following two details:

1) 'The protocol version that the web browser is requesting' as shown in the intended output's first line HTTP/1.1.
2) The message body or payload as shown in the intended output's last line color-dark&taste-malty

Please help me out as to which methods I need to use to get the above two details.
Thanks Anil.. for the nice wishes!
15 years ago
Thanks Kshitij for the nice explanation.

Now, I am pretty much clear that what is happening. Just your following line I am unable to fully understand, please explain.
that is "a list of 'anything' that is either of type E or its super type; but not exceeding Number". ''

Moreover, I would like to discuss the following case:

The code for case - A does not compiles, suggests that Object we can not add to this list. But case - B compiles and runs fine, also while iterating through the elements it treats the element as references of Object only but never allow to add Object to the list, why?? I know you would be definitely having the reason

Thanks Asanka for the wishes, but I think the wishes are for Kshitij for the great performance.

Thanks Narendra for your efforts, but the question is complete. We need to find appropriate input and output references such that it matches the method definition, but you have changed the method definition itself to match different answers. I will obey your suggestion of posting these type of questions in new forum .
15 years ago
Dear Ranchers,

I have one query in K & B book

Chapter 7: Generics and Collections

Q16. Given a method declated as:
public static <E extends Number> List<? super E> process(List<E> nums)

A programmer wants to use this method like this

//INSERT DECLARATIONS HERE
output = process(input);

Which pairs of declarations could be placed at //INSERT DECLARATIONS HERE to allow the code to compile? (Choose all that apply.)

A. ArrayList<Integer> input = null;
ArrayList<Integer> output = null;

B. ArrayList<Integer> input = null;
List<Integer> output = null;

C. ArrayList<Integer> input = null;
List<Number> output = null;

D. List<Number> input = null;
ArrayList<Integer> output = null;

E. List<Number> input = null;
List<Number> output = null;

F. List<Integer> input = null;
List<Integer> output = null;

G. None of the above.



The books says B, E and F are correct answers. But when I tried to compile the code I came to know G would be the correct answer as with none of the mentioned in A, B, C, D, E and F compiles successfully.

Also when I tried to compile with
List<Integer> input = null;
List<? super Integer> output = null;

It compiled successfully. It seems mistake in book, am I correct?
also could anyone explain how does this works? I think I am poor in understanding this. I would like to know what would have been the implications if say B compiles fine.
15 years ago
Thanks James!

Credit goes to K&B book, Java Ranch, ranchers who helped a lot, my hard efforts.

Regards.
15 years ago
Thanks Kshitij!

really it's one of the happiest moment in my life.
15 years ago
Alex your start of the journey is great.

I too agree with you for K & B book it's really a master piece.

I wish all the best for your upcoming targets.
15 years ago
Hey guys!

I cleared the SCJP 5 with 94%. Thanks for all the support and this great place to share the knowledge.
15 years ago