Tech-Today
How to enable Jersey Servlet in web.xml
To enable jersey web service in your web application, simply copy and paste the code below in your web.xml file.
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.ipiel</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
-
How To Protect Your Page Using Webfilter In Javaee
This tutorial is to be use in conjunction with picketlink. Normally we want some pages to be accessible only after a user has logged in. In this case we need a real protection filter. The class below filters a url path and check if there's a logged...
-
How To Implement No Caching On Jsf Pages
Currently there are 2 ways I know that can do this. 1.) By implementing Filter and manually overriding the cache controls. See code below (note: not my original I found this somewhere else long time ago): @WebFilter(servletNames = { "Faces Servlet" })...
-
Using Ejb3.1 As The Backing Bean For Jsf Using Cdi (jsr-330)
This tutorial assumes that you already have knowledge on EJB, JSF, maven and injection. These are the steps as well as the code I use to make it work. 1.) Create 2 maven projects (web, ejb - has HelloBean class) 2.) 2.) In the web part we need to create...
-
How To Call A Stateless Ejb From A Spring Rest Servlet Component
In my recent project I was ask to develop a rest servlet (using jersey) in a spring web project that would call an stateless EJB, where the business logic is. This project is deployed on glassfish. After several hours I was able to figure out how...
-
How To Auto Wire A Spring Bean From A Jsf Managed Bean In Liferay Portlet
There are 2 ways I know to auto-wire a spring bean into a jsf managed bean: 1.) Is through WebApplicationContext, invoke during jsf managed bean constructor: Below are the most vital files to perform this action: web.xml <?xml version="1.0"?>...
Tech-Today