Subscribe: Employing J2EE
http://wsdlj2ee.blogspot.com/atom.xml
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
call  data  digest  hash  java  lsvedg gyy  message digest  message  myfaces  new  password  tomcat  user  yfrrkrhjdbomacm lsvedg 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Employing J2EE

Employing J2EE



All about Javaserver Faces, Java Bean, JSP, JSTL, SOAP, WSDL and etc!



Updated: 2014-10-03T00:29:27.198-07:00

 



JFreeChart 1.0.1

2006-02-24T21:27:49.366-08:00

A new release of JFreeChart is available for download from:

http://www.jfree.org/jfreechart/

This release contains a number of minor bug fixes and a few API adjustments (additions and deprecations only). JFreeChart is free software under the terms of the GNU Lesser General Public License.

by Avatar Ng



Chart a new course with JFreeChart

2006-02-24T21:22:06.716-08:00

Creating a Pie Chart by using the famous JFreeChart library.

Read more at www.javaworld.com/javaw...

Although creating graph in Servlets and server-side is easy, but it burden the server and it is certainly not the big thing now.

Moreover, to draw some realtime charts, you need client-side scripting combining AJAX to stream the data for a real dynamic chart!


By Avatar Ng



Dynamic Double Combo -- Chapter 9 of Ajax in Action

2006-02-24T21:15:32.216-08:00

Ajax in Action!

See how this example of double "combo box" works in "Ajax in Action" book! The example actually take an "onchange()" event on the first "combo box" to triggle the Ajax to populate data into the second "combo box" depending on the selected value.

Read more at searchvb.techtarget.com...


by Avatar Ng




What is JUG?

2005-12-12T13:37:03.046-08:00

Java User Group or JUG, is part of Sun Developer Network (SDN) . It's a community, bulletin board for Java developer to gather and share ideas.

I've just created a local JUG for Malaysian's KL Java group, feel free to join the family!



Encryption Algorithm

2005-11-18T08:52:19.876-08:00

Encryption Algorithm in JavaToday, I will be discussing about protecting data by using Java encryption methods. This article also explains different algorithms used for the encryption process.Most of the web sites today have some sort of a registration module where a user is asked to choose a username/password combination. This data gets stored in the database. You might wonder if the password you provide will be kept well-protected (read encrypted). In case you are the person designing such backend registration component, why not give your users peace of mind by encrypting their passwords?One-way Hash EncryptionThis scenario is a perfect candidate for "one-way hash encryption" also known as a message digest, digital signature, one-way encryption, digital fingerprint, or cryptographic hash. It is referred to as "one-way" because although you can calculate a message digest, given some data, you can't figure out what data produced a given message digest. This is also a collision-free mechanism that guarantees that no two different values will produce the same digest. Another property of this digest is that it is a condensed representation of a message or a data file and as such it has a fixed length. There are several message-digest algorithms used widely today. Algorithm Strength MD5 128 bit SHA-1 160 bit SHA-1 (Secure Hash Algorithm 1) is slower than MD5, but the message digest is larger, which makes it more resistant to brute force attacks. Therefore, it is recommended that Secure Hash Algorithm is preferred to MD5 for all of your digest needs. Note, SHA-1 now has even higher strength brothers, SHA-256, SHA-384, and SHA-512 for 256, 384 and 512-bit digests respectively. Typical Registration ScenarioHere is a typical flow of how our message digest algorithm can be used to provide one-way password hashing:1) User registers with some site by submitting the following data: Username password Jsmith mypass 2) before storing the data, a one-way hash of the password is created: "mypass" is transformed into "5yfRRkrhJDbomacm2lsvEdg4GyY=" .The data stored in the database ends up looking like this: username password jsmith 5yfRRkrhJDbomacm2lsvEdg4GyY= 3) When jsmith comes back to this site later and decides to login using his credentials (jsmith/mypass), the password hash is created in memory (session) and is compared to the one stored in the database. Both values are equal to "5yfRRkrhJDbomacm2lsvEdg4GyY=" since the same password value "mypass" was used both times when submitting his credentials. Therefore, his login will be successful.Note, any other plaintext password value will produce a different sequence of characters. Even using a similar password value ("mypast") with only one-letter difference, results in an entirely different hash: "hXdvNSKB5Ifd6fauhUAQZ4jA7o8=" . plaintext password encrypted password mypass 5yfRRkrhJDbomacm2lsvEdg4GyY= mypast hXdvNSKB5Ifd6fauhUAQZ4jA7o8= As mentioned above, given that strong encryption algorithm such as SHA is used, it is impossible to reverse-engineer the encrypted value from "5yfRRkrhJDbomacm2lsvEdg4GyY=" to "mypass". Therefore, even if a malicious hacker gets a hold of your password digest, he/she won't be able determine what your password is.Java Code that Implements One-way Hash AlgorithmLet's assume that you are writing a web application to be run in a servlet container. Your registration servlet might have the following portion (for clarity, I ommitted input validation steps and assume that a password value was passed in within the password form input field):[...]public void doPost(HttpServletRequest request, HttpServletResponse response){ User user = new org.myorg.registration.User(); user.setPassword(org.myorg.services.Pa[...]



JSF-Database Demo

2005-10-30T00:36:45.930-07:00

code{color: rgb(51, 102, 255);}JSF-Database DemoWell it has been a hot topic now people talking about `JavaServer Faces`, and there are a few implementation (RI) of `JSR-000127` (e.g.: MyFaces, JSF).Ingredients- JSF(JSR-000127) RI (MyFaces / Tomahawk) 1.1.0- Server/Servlet Container (Apache Tomcat 5.5)- Java Developement Kit (JDK 5.0)IntroductionThe reason I picked MyFaces instead of pure JSF is because I'musing Apache Tomcat as my Servlet Container, but that isn't the mainreason; its because MyFaces had lots more cool UI to pick from than theofficial JSF RI (e.g.: Calendar, WSIWYG Editor, Menu, Tree, ...)!So what is so great about the concept? I will describe it as aweb-based Swing (for those who code in Java desktop b4, you should befamiliar with the swing package)!JSF is really a technology to separate presentation layer from logic layer, and the content developer need not know programming at all (or at least only know how to use which JavaBean).Installation I'm assuming that you are using Windows XP as your developement environment.- download MyFaces 1.1.0- download Apache Tomcat 5.5- go here to download JDK 5.0 (it was JDK 5.0 Update 5 by the time I'm writing this)When you have all the ingredients ready, install them by following the official guide or my simple steps(windows only):(1)Installing JDK- Start installation by excuting the file `jdk-1_5_0_05-windows-i586-p.exe`, choose the path `c:\dev\jdk5` when it ask you `Where to install JDK?`; for the JVM just leave by the default path!- Second thing to do is to set the environment variable for the JDK:- right click on `My Computer`->choose `Properties`->click on `Advance` tab->click `Environment Variables` on the lower left->create a new variable name by clicking `New` under section `User variables for xxx`)->put `Variable name` as `JAVA_HOME` put the `Variable value` as `c:\dev\jdk5`->click `Ok` ... `Ok` all the way back- To make compilation and execution java application easier, create a new entry for Windows to lookup java, edit the `PATH` variable by appending `;c:\dev\jdk5\bin`- Test the instalation by keying in echo %JAVA_HOME% in command prompt, and you should get this: `c:\dev\jdk5`- Further test the java command by using java in command prompt, and you should get something like this:Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)- Done! (2)Installing Tomcat - official guide to install tomcat - unzip the file `apache-tomcat-5.5.12.zip` to directory `c:\dev\`, and you will get something like `c:\dev\apache-tomcat-5.5.12`. Rename it to `c:\dev\tomcat`.- Set your environment variables `CATALINA_HOME` and `CATALINA_BASE` to `c:\dev\tomcat`.- To make server startup/shutdown easier, create a new entry for Windows to lookup tomcat, edit the `PATH` variable by appending `;c:\dev\tomcat\bin`- To start your server, type `startup.bat` in command prompt, and you should see some message like below and a command prompt will popup:Using CATALINA_BASE: E:\dev\tomcatUsing CATALINA_HOME: E:\dev\tomcatUsing CATALINA_TMPDIR: E:\dev\tomcat\tempUsing JAVA_HOME: C:\Program Files\Java\jdk1.5.0_04- Navigate your server by pointing you browser to `http://localhost:8080`- To shutdown your server, type `shutdown.bat` in command prompt, and you should see same message as well and the popup should be close by itself after a while.- Done!(3)Installing MyFaces - A dataTable ExampleExtract `myfaces-1.1.0.zip` to any directory(e.g.:C:\dev\myfaces-1.1.0) for javadoc reference. For realdevelopment, download the example package -`myfaces-1.1.1RC2-examples.zip` and unzip it to `C:\dev\myfaces-1.1.1RC2-examples`. You will find some examples web applications like `simple.war`,`blank.war`, and so on, extract `blank.war` into `C:\dev\myfaces-1.1.1RC2-examples\blank` using Winrar or similar software. Now copy all the jars files from `C:\dev\myfaces-1[...]



Writing a XMPP chat client in Java (Google Talk)

2005-09-23T23:09:07.360-07:00

I think I just start off to the topic, firstly u need a 3rd-party library "smack.jar"+"smackx.jar" which extracted from "smack-2.0.0.zip". Get the file from here ! I'm using "javax.swing" classes to build the UI, below is a brief design layout:+-----------------------------------------------+| Login : __________ | [...]



WSDL Sample

2005-09-08T09:36:54.043-07:00

Before porting the web service module into a J2EE application, firstly lets look at how I get a stock quote in a normal Java concole.

As I will continue on application of WSDL on my next post ... .

Below is the full generic code to demostrate on calling a WSDL:

//
// XMethods sample client for the Stock Quote service
//

import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;

public class StockQuoteClient{

public static float getQuote (URL url, String symbol) throws Exception {

Call call = new Call ();

// Service uses standard SOAP encoding
String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
call.setEncodingStyleURI(encodingStyleURI);

// Set service locator parameters
call.setTargetObjectURI ("urn:xmethods-delayed-quotes");
call.setMethodName ("getQuote");

// Create input parameter vector
Vector params = new Vector ();
params.addElement (new Parameter("symbol", String.class, symbol, null));
call.setParams (params);

// Invoke the service ....
Response resp = call.invoke (url,"");

// ... and evaluate the response
if (resp.generatedFault ()) {
throw new Exception();
} else {
// Call was successful. Extract response parameter and return result
Parameter result = resp.getReturnValue ();
Float rate=(Float) result.getValue();
return rate.floatValue();
}
}

// Driver to illustrate service invocation
public static void main(String[] args) {
try {
URL url=new URL("http://services.xmethods.net:80/soap");
String symbol= args[0];
float quote = getQuote(url,symbol);
System.out.println(quote);
}
catch (Exception e) {e.printStackTrace();}
}
}