Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Monday, January 30, 2012

Solution : com.sun.net.ssl.internal.ssl.Provide Exception

When implementing the java mail i faced an exception  i.e, com.sun.net.ssl.internal.ssl.Provide .

While executing the java mail program the ssl security looking for some classes in java mail jar but its not finding thats why the exception occur

to resolve this problem you need add a jar to you web-inf/lib directory to your ear directory

find this jar file javax-ssl-1_1.jar and add it.

Monday, February 28, 2011

Non English Character Encoding In GWT

If you are typing the data in plain English then the data will be persisted in your database.Suppose if you are typing the data in some non-english format, then the data will not be persisted.

All format of value supports the front end as well as back end, then what is the issue for not saving the data.

Go to your data source xml file (Database Data source File will be located in your Jboss Deploy Folder) and add this encoding UTF-8, so that all kind of data will be persisted.

*After opening this data source xml file.
*Find the connection url and add this character Encoding "&useUnicode=true&characterEncoding=utf-8".
Example
jdbc:mysql://localhost:3306/yourdb?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8


Amazon S3 File Upload In Java - Google Web ToolKit

Learn How to Upload Files to amazon s3 using Google web toolkit .


Client Side Coding ..

Create FormPanel on client Side page.

FormPanel formPanel=new FormPanel();

FormPanel allows you to set action and encoding method like we do in HTML Forms .

If you are using GWT FormPanel then use this

formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setMethod(FormPanel.METHOD_POST);

If you are using EXT GWT FormPanel then use this

formPanel.setEncoding(Encoding.MULTIPART);
formPanel.setMethod(Method.POST);


Write a listener to your upload button and write the below code under the button listener.


String fileName = fileUploadField.getValue();
String fileType = fileUploadField.getValue();
fileType = fileType.substring(fileType.indexOf(".") + 1);

if (fileName != null && !fileName.equalsIgnoreCase(""))
{
amazonFileUploadServletUrl = GWT.getHostPageBaseURL()+ "amazonfileuploadservlet?bucketName=" + "BukcetName"
+ "&keyName=" + "BukcetNameKey" + "&fileName="+ fileName + "&fileType=" + fileType;
System.out.println("amazonFileUploadServletUrl="+ amazonFileUploadServletUrl);
}
formPanel.setAction(amazonFileUploadServletUrl);
formPanel.submit();



Server side coding..

Get the AmazonFileUploadServlet.java and S3Upload.java and put it in server package.

Download aws-java-sdk.jar ,common-codec.jar,common-fileupload.jar,commons-io.jar and common-httpclient.jar and put it in WebProject > War > Web-Inf > Lib >Paste It all jar files.


You have done the client side coding as well as server side coding, now you have to make a communication between client and server using servlet mapping

Go to Web.xml and write servlet path and servlet mapping

AmazonFileUploadServlet
your server package


AmazonFileUploadServlet
/amazonfileuploadservlet
Now compile and run your project to upload the files to amazon s3.

Monday, February 7, 2011

Java Developing Framework Tools

Java Developing Framework Tools

1.Spring
2.JBoss
3.Hibernate
4.Swing
5.Eclipse
6.GlassFish
7.JavaServer Faces (JSF)
8.Struts
9.NetBeans
10.IntelliJ IDEA