• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in UrlRewriting

 
Ankur Gargg
Ranch Hand
Posts: 55
Java jQuery Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Ranchers

I have got two doubts
1)session.setAttribute("a",5);

Will this work in JEE 6?I mean to ask whether autoboxing feature is available in JEE6 .I know it is available in JDK 1.6.

2)Upon a user's first visit to website which two operations are always performed when the getSession() is called without arguments on a servlet
a)All URLS' returned are encoded.
b)An HttpSession object is created if necessary.
c)Session ID is stored as cookie in response.

As per me answer should be a) and c).Am I correct ranchers?
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) of course it will work. Java EE 6 is built on top of Java SE 6.
2) wrong.
Option "a" is wrong because url rewriting does not happen automatically.
Option "b" is correct because this is what getSession() does.
Option "c" is correct because container is required to support cookies as session tracking mechanism.
 
Ankur Gargg
Ranch Hand
Posts: 55
Java jQuery Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Piyush

What if I was writing the SCWCD 5 exam then what would have been your answer for 1).
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ankurr,

What if I was writing the SCWCD 5 exam then what would have been your answer for 1).

This depends on your servlet-container provider. If you check the servlet specifications (e.g. Servlet 2.4, SRV 1.2):
J2SE 1.3 is the minimum version of the underlying Java platform with which
servlet containers must be built.

Have you tried Tomcat 5.5? I guess it does support Java SE 1.5 and therfore autoboxing.

Regards,
Frits
 
Ankur Gargg
Ranch Hand
Posts: 55
Java jQuery Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In exam we are not given the container provider details.
So suppose I am writing SCWCD 5 then can I consider autoboxing as automatic?
I mean will autoboxing occur.


Regards
Ankur Garg
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JRE version of JVM, that container uses to run, can be changed as needed (Just set the JAVA_HOME environment variable).
In exam you can assume that Java EE5 container runs Java SE5 JVM, so the autoboxing will work.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So suppose I am writing SCWCD 5 then can I consider autoboxing as automatic?

I agree with Piyush (if I had to choose an option in such a question).
An exam question involving autoboxing without mentioning Java SE1.5 wouldn't be fair as it isn't mandated by the specifications (and those are the subject of the certification), so I guess it won't happen.

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic