View RSS Feed

All Blog Entries

  1. Client Sockets

    by , 04-25-2012 at 11:18 PM
    Client sockets are handled by a class which is in package. This line would be included generally;

    So that package method’s short names could be used. Number of constructors could be used for creation of new [client] socket. This depends upon the specific circumstances. Simplest one is:
    Java Code:
     Socket(String host, int port)
    that connects to machine host’s port. For example,
    Java Code:
    Socket s = new Socket("",
  2. Object Serialization Pitfall

    by , 04-25-2012 at 11:16 PM
    It shall be kept in mind while dealing with object serialization that hashtable is maintained by the ObjectOutputStream which maps the objects which have been written in stream, to a handle. When object has been written for very first time to the stream, all of its contents are copied into stream. However, writes after it would be resulting in a handle, to that object which has been written to stream. Couple of problem might arise.

    • When a written object to stream is written and
  3. RMI vs. Sockets and Object Serialization

    by , 04-25-2012 at 11:15 PM
    RMI or Remote Method Invocation is that Java system which is used to create the applications which are distributed object based. Given formula could be used to express the RMI that uses object serialization extensively.

    Remote method invocation = Sockets + Object Serialization + Some Utilities
    Compiler & RMI registry are utilities to generate the skeletons & stubs.

    If you are aware of RMI then you would definitely know that it is a very simple task to ...
  4. Overview of Object Serialization

    by , 04-25-2012 at 11:14 PM
    Object serialization is that mechanism which is considered useful in all programs which save object’s state to the file and then reads objects for reconstruction of the state of program, or using the sockets to send object at the network. Class serialization could be done very easily by using class implement interface. It is marker interface which has no methods to be implemented. This is used for informing the JVM (Java Virtual Machine) which one wants an object to get serialized. ...
  5. What Is a Socket?

    by , 04-25-2012 at 11:13 PM
    At some specific computer, server usually runs. It consists of a socket which remains bound to some particular port number. Server’s function is to hold or wait and listen to socket if some client sends the connection request.

    On the client-side: Client is aware of the machine at which server runs has a hostname and a port number at which server listens. Client makes an attempt at the machine and port of the server to rendezvous with server so that to make the connection request. ...
  6. What are Sockets and Threads?

    by , 04-25-2012 at 11:11 PM
    Socket is basically the software endpoint which creates a bi-directional communication b/w client programs & a server program. A server program is associated by the socket with specific hardware port present at machine at which it runs and client program present in network along with socket which is being associated to similar port might do communication with server program.

    Resource is provided by a server program to the client program network. Requests are sent by the client ...
  7. Java Mail Authenticator

    by , 04-25-2012 at 11:09 PM
    Benefit of the Authenticator class might be taken by the Mail APIs, just like packages. Protected resources are being accessed by this class by using Username/Password. This resource might be simple file, server or anything else. In case of Java Mail, server would be the resource. In essence, Authenticator object gets passed to getInstance()/getDefaultInstance() method as a parameter which controls the Session object’s security aspect.

    Authenticator could be used by 2 methods. ...
  8. Java Mail Protocols

    by , 04-25-2012 at 11:07 PM
    Protocols are those rules which declare the format to do communication among systems. Main protocols for mailing systems are given below:
    1. SMTP
    2. IMAP
    3. POP
    4. MIME

    Let's consider them one by one.

    1. SMTP:

    SMTP i.e. Simple Mail Transfer Protocol defines email delivery mechanism. For mail transfer, mail client makes contact to organization’s SMTP server which send message in turn to the SMTP server recipient. IMAP or ...
    Mail API
  9. Read Multipart mail using Java Mail

    by , 04-25-2012 at 11:04 PM
    Multipart messages could be read by javamail api which has been shown in this example. Multipart class object is created to read the multipart mail.

    For composition of mails along with attachments, Multipart mail is being used now a days. One might attach the doc, images, zip files, xls etc. Mails that could be designed nicely are created by it.

    Classes are provided by the Java Mail API so that Multipart messages could be created, sent or read. Java Mail api is used ...
    Mail API
  10. Send multipart mail using java mail

    by , 04-25-2012 at 11:02 PM
    By the help of java mail how one could send multipart mails has been shown in this example. One might think a Multipart to be a container which contains more than one body parts. For sending the multipart mail, Multipart class object is made. After this BodyPart class object is created and text is set in the BodyPart class object which is then added to Multipart class object. Ultimately message is sent. In the given code, Class Multipart is abstract class. In this program, method of Multipart class ...
    Mail API
  11. Reading message using Java Mail

    by , 04-25-2012 at 10:58 PM
    To read the messages by the help of javamail api. , consider the given example. Folder Objects holds the stored messages. Folder might consist of messages or folders or both. Methods are declared by the Folder class so that to fetch, copy, append, copy or delete the messages. In this program, few used methods are given below:

    System.getProperties() system properties are obtained by this method.
    Session.getDefaultInstance(properties) Default Session object are obtained by this ...
    Mail API
  12. Java Mail API Store and folder

    by , 04-25-2012 at 10:56 PM
    When session is obtained, connection is made b/w javax.mail.Store & host, authenticator, port, username/password. Store objects which are involved in implementation of specified protocol might be formed by protocol information passage to the getStore() method.

    Java Code:
    // create object of store class.
    Store store = session.getStore("pop3");
    store.connect(host, username, password);
    After connecting to store you need to get a folder that holds ...
  13. Java Mail API Address

    by , 04-25-2012 at 10:54 PM
    Address class is considered to be the abstract class hence class javax.mail.internet.InternetAddress will be used here.

    Address address = new InternetAddress("");

    For name text to be displayed to Email add, one or more arguments shall be used for the name

    Java Code:
    Address address = new InternetAddress(“”, ”name”);
    After address has been created, make connection with message by 2 ways:

    1: ...
    Mail API
  14. Java Mail API Message

    by , 04-25-2012 at 10:51 PM
    When session object has been created, message is created so that to send it by the help of Message class. As message class is considered as abstract class hence subclass javax.mail.internet.MimeMessage will be used.
    Java Code:
    MimeMessage message = new MimeMessage(session) 
    // set the content of message by setContent() method
    message.setContent(“[url]”[/url], “text/plain”);
    setText() method can also be used to set the content.
    Java Code:
    Mail API
  15. Java Mail API Session

    by , 04-25-2012 at 10:49 PM
    Top leveled entry class that presents mailing session is known as session. java.util.Properties object is used for seeking information regarding username/password and mail server. Private constructor is present in this class and session objects can be obtained via getDefaultInstance() & getInstance() method. The default session object are provided by the getDefaultInstance() method where authenticator objects and properties are taken as arguments.

    Java Code:
    Properties props = new
    Mail API
  16. Apache Mail server (James)

    by , 04-25-2012 at 10:48 PM
    This section will discuss the James mail server. James is a portable and complete enterprise mailing server and a mailing app platform. Its latest version is found to be 2.3.1
    Mailet API

    This is basically a Java API which comes along James Mailing server. Developers are supported by it to develop mailing processing app quickly so that enterprise mailing problems could be solved. Flexible solutions for mail processing can be developed very easily and be deployed in production. ...
    Mail API
  17. Mailing protocols

    by , 04-25-2012 at 10:47 PM
    Standard methods are presented by a protocol used at every communication channel’s end so that the information could be transmitted properly.

    Four protocols send/receive Emails.

    (Simple Mail Transfer Protocol) SMTP: Email is delivered by SMTP to the mailing server of recipient. Communication is done by the Java mail applications with the ISP SMTP servers of user or company. SMTP servers send messages to the SMTP server of the recipient.

    (Post Office Protocol ...
    Mail API
  18. How does Email works

    by , 04-25-2012 at 10:42 PM
    Every DOMAIN consists of mailing server, when an email is sent by a user.

    1. Message is sent by email client program to the email server.
    2. Email server of recipient is contacted by the email server
    3. Validity of username is checked by the email server.
    4. If username is valid, email is sent to the email server of the address.
    5. When recipient signs in to his mailing account, he finds his email.

    Name:  1.jpg
Views: 6043
Size:  21.6 KB
    Mail API
  19. Introduction to Java Mail API

    by , 04-25-2012 at 10:39 PM
    Java Mail API provides an opportunity to the developers to do the additional functionalities of email, to the java app. This section details the introduction of the Java Mail API.
    A platform independent sort of framework is provided by the Java Mail API so that messaging & mail applications could be developed in Java technologies. This is protocol independent which makes it much more beneficial. Various protocols could be used to work with messages and mails.
    Java Mail API provides ...
    Mail API
  20. Sending Mail with Attachments

    by , 04-25-2012 at 10:37 PM
    There could be no or more than one file attachments present with an outgoing message.
    File data and file name is present with an attachment. File data may be extracted from some source like data store or application data file. Attachment’s MIME type is determined by the filename.

    Below is given MIME types list and also their file name extensions which are permitted for the attachments, to an email. You are not just bound to such extensions. If an unknown extension is used, ...
  21. Receiving Mail

    by , 04-25-2012 at 10:36 PM
    Email could be received by your application at such kind of addresses.

    It shall be noted that even application gets deployed at the customized domain, application couldn’t get the mail that has been sent to those addresses which are present at that domain.

    To applications, email messages are being sent as HTTP requests. Such requests are basically generated by the help of app Engine and are being posted to the applications. ...
    Mail Message
  22. Email Multi-Part Messages

    by , 04-25-2012 at 10:33 PM
    Message could be sent with text, HTML message body or file attachment by using multi part messages. MimeMultipart object can be created to hold parts, then MimeBodyPart objects are created for every attachment/ message body and added to container. Lastly, container is assigned to MimeMessage content.

    Java Code:
    import javax.activation.DataHandler;
    import javax.mail.Multipart;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMultipart;
  23. Email Senders and Recipients

    by , 04-25-2012 at 10:31 PM
    Recipient and sender of email addresses are presented in JavaMail, by InternetAddress class instances. Email addresses are taken by the constructor as a string, & AddressException are raised when there is no resemblance b/w valid email address and address. Personal name is provided as a string, for 2nd parameter.
    Sender address could be set by calling setForm() method, at MimeMessage object. Sender address has these given types:
    • Registered administration’s address, for application.
    • User’s
  24. Sending Email Messages

    by , 04-25-2012 at 10:28 PM
    A MimeMessage object is prepared by an application so that to send email. Email is sent along with static method send(), on Transport class. JavaMail session object is used to create the message. Transport and session work along with App Engine Mail service, with no extra configuration.

    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.AddressException; ...
    Mail Message
  25. Java Logging - Practical Usage

    by , 04-25-2012 at 04:53 PM
    The intent of the post is not to delve into all the detail around setting up Java logging for an application. So you won't find any information here about Filters, Formatter and Handlers. For all those details, I invite you to visit Oracle's JavaTM Logging Technology documentation site and read the Overview.

    When problems occur in complex Java applications, symptoms are generally detected as incorrect data or as exceptions. In the case of exceptions, we get stack ...
  26. Working with JDBC in Java

    by , 04-04-2012 at 07:32 AM
    Java Database Connectivity (JDBC) is a technology that allows Java applications working with relational database management systems (RDBMS) such as MySQL, Microsoft SQL Server, Oracle, PostgreSQL, … via Structured Query Language (SQL) statement. The JDBC API is included in JDK, so any Java application can communicate with various database systems without requiring additional installation, as long as a JDBC driver is provided for the targeted database system.

    By the end of this article, ...
  27. How to create a Java web service

    by , 04-04-2012 at 06:57 AM
    Web service is a XML-based standard that allows interoperability between different applications on different platforms, for example, a .NET based application on Windows can communicate with a Java based one on Linux. The communication can be done through a set of XML messages over HTTP protocol.

    Throughout this article, you will learn how to create and publish a web service, and consume the web service by a command line client. This article supposes you are familiar with basic Java ...
  28. isTheStringPalinDrome, reverseTheWordOrder, fibonaciWithoutRecursion, removeDuplicates

    by , 04-04-2012 at 12:51 AM
    Java Code:
    package assignmentOne;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Set;
    public class PartOneAssignments {
    	// This method accepts a String as the argument and checks whether it is palindrome or not
    	static boolean isTheStringPalinDrome(String s) {
    		// Be positive and assume that the String provided is Palindrome
    		boolean stringIsPalinDrome = true;
  29. Using threads in Java applications

    by , 04-03-2012 at 12:57 PM
    Are you going to code a Java application that processes multiple tasks at the same time? Or is your program doing some heavy operations in the background, while the user is viewing a chart report? Such applications are referred as multi-threaded or concurrency programs. The Java platform has built-in support for threading from its very early versions, so developing multi-threaded applications in Java is not tough at all, thanks to the comprehensive and powerful threading and concurrency API. ...
    Tags: java, thread, tutorial Add / Edit Tags
  30. Working with JSP and Servlet

    by , 04-03-2012 at 12:44 PM
    Suppose you are familiar with some beginner concepts regarding Servlet and Java Server Pages (JSP), this article focuses on some techniques for making JSP and Servlet working together in a Java web application.

    A brief overview of Servlet and JSP technologies

    A Servlet is a Java class running on a web server to serve client’s requests. Servlets are commonly used to handle HTTP requests. They are created to address shortcomings of CGI scripting, and enhance functionality ...
    Tags: jsp, servlet Add / Edit Tags
    Servlet , JSP
Page 14 of 48 FirstFirst ... 4121314151624 ... LastLast