Posts

SOAP and REST WebServices with SOAP WS Interceptor

REST WebService REST : Representational State Transfer REST is a kind of structure. It is not a protocol. REST uses JAX-RS java API for webservice development. REST supports text, html, xml and JSON data Formats. REST generates WADL (WebService Application Description Language). REST allows client to interact with a web-based system using simple URLs rather than complex request paremeters and request body. The purpose of WADL is to define a contract between two parties. At the client end all the resources are Representational and can be accessed by Browser or REST client. RESET uses following JAX-RS based annotations. @Path @Get @Post @Delete @Put @Produces @Consumes Example import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) @Path("/import") public ...

JSP and Servlet Interview Questions Part-3

1} Why is _jspServic e () start with ‘_’? Ans: _jspService() method will be written by the container hence any methods which are not to be overridden bythe end user are typically written starting with a '_'. T his is the reason why we don't override _jspService()  method in any JSP page. 2} How to pre-c ompile jsp? Ans: Add jsp_precompile as a request parameter and send a request to the JSP file. T his will make the jsp pre- compile. http://localhost:8080/jsp1/test.jsp?jsp_precompile=true It causes execution of JSP life cycle until jspInit() method without executing _jspService() method. 3} What is the benefit of pre-c ompile jsp page? Ans: It removes the start-up lag that occurs when a container must translate a JSP page upon receipt of the first  request. 4} What is the difference between variable declared inside the declaration tag and variable  declared in scriptlet? Ans: Variable declared inside declaration part is treated as a instance variable and will ...

JSP and Servlet Interview Questions Part-2

1} What is the <load-on-startup> element? Ans: The <load-on-startup> element of a deployment descriptor is used to load a servlet file when the server  starts instead of waiting for the first request. It is also used to specify the order in which the files are to be loaded. 2} What is session? Ans: A session refers to all the requests that a sing le client mig ht make to a server in the course of viewing any  pag es associated with a g iven application. Sessions are specific to both the individual user and the application. 3} What is the session tracking ? Ans: Session tracking is a mechanism that servlets use to maintain state about a series of requests from the same  user (requests orig inating from the same browser) across some period of time. 4} What is the need of session trac king in web application? Ans: HT T P is a stateless protocol. Every request is treated as new request. For web applications to be more  realistic they have to retain...