Posts

Showing posts from May, 2012

JBoss Application Server 7

View more presentations from Raymond Ploski

CASifying your web application

CAS used for Single Sign On Download required jar files for CAS integration. Configuration in web.xml  <!--CAS Integration-->     <filter>         <filter-name>CAS Authentication Filter</filter-name>         <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>         <init-param>             <param-name>casServerLoginUrl</param-name>             <param-value>https://li419-10.members.linode.com:8443/cas/login</param-value>         </init-param>         <init-param>             <param-name>serverName</param-name>                        <param-value>http://li419-101.members.linode.com:8080</param-value>         </init-param>         <init-param>             <param-name>renew</param-name>             <param-value>false</param-value>         </init-param>         <init-param>           

IPCommerce Secure Hosted Payments for Invoicing Web Service Call

public static void main(String[] args) throws RemoteException,ServiceException {                         InvoicingServiceInfoServiceLocator lInfoServiceLocator = new InvoicingServiceInfoServiceLocator();                lInfoServiceLocator.setEndpointAddress("InvoicingServiceInfoService", "https://pay.cert.ipcommerce.com/LS/InvoicingServiceInfo/InvoicingServiceInfoService.svc");                        InvoicingServiceInfoServiceStub infoServiceStub = (InvoicingServiceInfoServiceStub) lInfoServiceLocator.getInvoicingServiceInfoService();                 AuthenticatedUser user = infoServiceStub.logon("username","password","SAK number");         InvoiceCodeRequest invoiceCodeRequest = new InvoiceCodeRequest();         invoiceCodeRequest.setCurrentAmount(new BigDecimal(3000));         invoiceCodeRequest.setInvoiceNo("");         invoiceCodeRequest.setCustomerName("Customer Name");         invoiceCodeRequest.setCustomerID

Display Images From a Non-Project Directory in JSF

<h:graphicImage value="/headerimage/?img=logo.jpg"/> Create Servlet : @WebServlet(name = "DynamicImageServlet", urlPatterns = "/headerimage/*"}) public class DynamicImageServlet extends HttpServlet {     protected void processRequest(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         response.setContentType("text/html;charset=UTF-8");                 try {             //Get image file             String img = request.getParameter("img");                        BufferedInputStream in = new BufferedInputStream(new FileInputStream("path to absolute location of image/"+img));             //Get image contents                         byte[] bytes = new byte[in.available()];                         in.read(bytes);             in.close();             //Write image contents to response             response.getOutputStream().write(bytes);

Send Email With Attachment in Java

public boolean sendEmailWithAttachment() {         // create some properties and get the default Session         Properties props = System.getProperties();         props.put("mail.smtp.host", "smtp host address");         props.put("mail.smtp.port", "25");         Session session = Session.getInstance(props, new MailAuthenticator());         try {             // create a message             MimeMessage msg = new MimeMessage(session);             msg.setFrom(new InternetAddress(from));             InternetAddress address = new InternetAddress(to);             msg.setRecipient(Message.RecipientType.TO, address);             msg.setSubject("Subject");             // create and fill the first message part             MimeBodyPart mbp1 = new MimeBodyPart();                        mbp1.setContent("Body Text", "text/html");             // create the second message part             MimeBodyPart mbp2 = new MimeBodyPart();