Wednesday, November 29, 2017

JSF SpringMVC Hibernate Integration Example Tutoria with maven

According to spring MVC structure, we can create three layers in our project
  1. DAO Layer
  2. Service Layer
  3. Model Layer

This is Project structure

Firstly configure all XML file. It will help to continue your project without errors.

faces-config.xml

</plugins> </build> </project>


Step 03 - Create Controller class(SpringBootController.java)


package com.boraji.tutorial.springboot.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class SpringBootController{ @RequestMapping("/") public String sayHello() { return "Hello Spring Boot!!"; } }



Tuesday, November 7, 2017

Spring Boot - Hello world example

This sample explains how to create spring boot hello world application

Tools and technologies used for this application are-

  • Spring Boot 1.5.4.RELEASE
  • JavaSE 
  • Maven
  • Eclipse Neon

Here is project Structure





















Step 01 - Create Maven project

File -> New -> Maven Project ->select Create a simple project ->Enter details and finish.

Step 02 - Add dependencies to pom.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.boraji.tutorial.springboot</groupId> <artifactId>spring-boot-hello-world-example</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <java.version>1.8</java.version> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.4.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>


Step 03 - Create Controller class(SpringBootController.java)

package com.boraji.tutorial.springboot.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class SpringBootController{ @RequestMapping("/") public String sayHello() { return "Hello Spring Boot!!"; } }




Step 04 - Create Main Class(MainApplication.java)

package com.boraji.tutorial.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MainApplication{ public static void main(String[] args) { SpringApplication.run(MainApplication.class, args); } }



Step 05 - Run Application

Right click on MainApplication.java - > Run As -> Java Application



















Step 06 - Get Output

Now, enter the http://localhost:8080 in browser's address bar and see the output


Monday, October 30, 2017

Garbage collection

Singleton in same package same class,


package com.singletone.test;


class SingletoneBorn{

private static SingletoneBorn instanse = new SingletoneBorn();

private SingletoneBorn(){}

public static SingletoneBorn getInstanse() {
return instanse;
}

public void showDetails(){
System.out.println("This is singletone born world");
}
}

public class SingletoneTest {

public static void main(String args[]){
SingletoneBorn sb = SingletoneBorn.getInstanse();
sb.showDetails();

}


}

Singleton same package different class


Singleton class

package com.singletone.test;

public class SingletoneTest {


private static SingletoneTest instanse = new SingletoneTest();

private SingletoneTest(){}

public static SingletoneTest getInstanse() {
return instanse;
}

public void showDetails(){
System.out.println("This is singletone born world");
}

}

Singleton usage class

package com.singletone.test;

public class TestSingletone {
public static void main(String args[]){

SingletoneTest st = SingletoneTest.getInstanse();
st.showDetails();
}


}

Singleton different package different class


Singleton class

package com.singletone.test;

public class SingletoneTest {


private static SingletoneTest instanse = new SingletoneTest();

private SingletoneTest(){}

public static SingletoneTest getInstanse() {
return instanse;
}

public void showDetails(){
System.out.println("This is singletone born world");
}

}

Singleton usage class

package com.singletone.test2;

import com.singletone.test.SingletoneTest;

public class SingleTest {

public static void main(String args[]){
SingletoneTest st = SingletoneTest.getInstanse();
System.out.println("Singletone method call in nother package");
st.showDetails();
}




}

Sunday, October 29, 2017

How to create http proxy service in Wso2 ESB

Now we are going to explain about how to create http proxy service and call it to with client side.


Configuring Wso2 ESB to route messages through a proxy server


Edit the <ESB_HOME>/repository/conf/axis2/axis2.xml file, and add the following parameters in the <transportSender> configuration of the http transport:
  • http.proxyHost - The host name of the proxy server.
  • http.proxyPort - The port number of the proxy server.

You can see like this code when you set above parameters. 

<transportSender name="http" 
   class="org.apache.synapse.transport.passthru.PassThroughHttpSender">    
    <parameter name="non-blocking" locked="false">true</parameter>
    <parameter name="http.proxyHost" locked="false">localhost</parameter>
    <parameter name="http.proxyPort" locked="false">8080</parameter>
</transportSender>


Create proxy service using Wso2 Developer Studio.




Friday, October 27, 2017

How to create proxy service using WSO2 ESB (Call Using Soap UI)

If you don't have idea about how to install wso2 esb for your PC follow this link.

I'm going to explain how to create proxy service using wso2 developer tool.

Here is I only  added log mediator inside the proxy service. Now expose the car app

Lets go to the admin console panel. Here you can see bellow things.

  1. Proxy URL
  2. wsdl file

Click this wsdl link. You can see wsdl file inside the another tab. Copy that wsdl link.

Now we need to create SOAP project. Open soap UI.
Create new soap project using copied link.


Tuesday, October 24, 2017

How to includeHTML page into another HTML page

I'm going to include content.html file inside main.html,

content.html file


<html> 
  <body>
    <div id="new-projects">
    <a href="howto_google_maps.asp">Google Maps</a><br>
    <a href="howto_css_animate_buttons.asp">Animated Buttons</a><br>
    <a href="howto_css_modals.asp">Modal Boxes</a><br>
    <a href="howto_js_animate.asp">Animations</a><br>
    <a href="howto_js_progressbar.asp">Progress Bars</a><br>
    <a href="howto_css_dropdown.asp">Hover Dropdowns</a><br>
    <a href="howto_js_dropdown.asp">Click Dropdowns</a><br>
    <a href="howto_css_table_responsive.asp">ResponsiveTab</a><br>
    </div>
</body>
</html>



main.html file


<html lang="en">
<head>
 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 <script>
$(document).ready(function() {
$('#result').load('content.html #new-projects', function() {
//alert("loaded");
});
});
 </script>
</head>

<body>
   <b>Projects:</b>
<div id="result"></div>
</body>

</html>





You need to include both file in same folder. Otherwise you have to change inside the load() method.


Run this as localhost/path/main.html