Tech-Today
Do some initialization work after the web application initialization process
We can achieve this by using a webListener. See code below:
package com.czetsuya;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.omnifaces.util.Messages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@WebListener
public class WebServletListener implements ServletContextListener {
private static Logger log = LoggerFactory
.getLogger(WebServletListener.class);
@Inject
private transient ResourceBundle resourceBundle;
@Override
public void contextDestroyed(ServletContextEvent arg0) {
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
log.info("Hello czetsuya");
log.info("@author: [email protected]");
log.info("-----------------------------------------------");
log.info("Web context starting...");
}
}
-
Social Login Using Rest Fb
This is an implementation tutorial on how we can use REST FB to enable facebook social login on our web application. Basically, it's a project created from javaee7-war template. To run this app you need to set up a Facebook application with callback...
-
How To Call A Javaee Rest Web Service With Basic Authentication Using Jquery Ajax
I don't really remember when I coded it, nor where I got it but I'm writing it here for future use :-) Below is the code I use to test CORS, http://en.wikipedia.org/wiki/Cross-origin_resource_sharing. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>...
-
Loading Locale From Post/get Parameter
This page will summarize how to load a resource bundle dynamically from a GET/POST parameter. 1.) In your mail xhtml template, make sure that you define f:view locale before the h:body tag: <f:view locale="#{languageBean.currentLocale}" />...
-
How To Load Property File From Glassfish Config's Folder
In seam you can define a component class in components.xml that will load the properties from the JBOSS_CONFIG folder. Add the ff lines: <component name="paramBean" class="com.ipil.PropertyBean" scope="application" auto-create="true" startup="true">...
-
How To Receive An Asynchronous Jms Message
This tutorial assumes that you have glassfish installed and followed the 2 previous tutorials: http://czetsuya-tech.blogspot.com/2012/06/how-to-setup-set-jms-factory-and-queue.html http://czetsuya-tech.blogspot.com/2012/06/how-to-send-jms-message-to-jms-queue.html...
Tech-Today