Friday, September 15, 2017

WSO2 ESB Filter Mediator

Filter mediator is used to match or filter the message of a given xpath.

If we give only the xpath then it will return true or false. If we give regular expression, the string returned from evaluating the XPath will be matched against the regular expression.

There are two ways of operation

  • Specify the XPath (boolean expression), return true or false
  • XPath will be matched against the regular expression, return true or false

Examples :

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="test"
       transports="http https"
       startOnLoad="true">
   <description/>
   <target>
      <inSequence>
         <property name="statusCode" value="200"/>
         <filter xpath="get-property('statusCode')!='204'">
            <then>
               <log level="custom">
                  <property name="----------Status Code--------------------------"
                            value="status code is not equals to 204"/>
               </log>
            </then>
         </filter>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
</proxy>

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="test"
       transports="http https"
       startOnLoad="true">
   <description/>
   <target>
      <inSequence>
         <property name="statusCode" value="200"/>
         <filter source="get-property('statusCode')" regex="200">
            <then>
               <log level="custom">
                  <property name="----------Status Code--------------------------"
                            value="status code is equals to 200"/>
               </log>
            </then>
         </filter>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
</proxy>

Thursday, August 17, 2017

How to share folders between Ubuntu and Windows running in Virtualbox

Step 1 : Create a directory called “vmsharedfiles”  in Ubuntu.

Step 2: Open up virtualbox instance.

Go to top menu and Click on Devices → Shared Folders → Shared Folders Settings.

If you are getting any error like “The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting Insert Guest Additions CD image from the Devices menu. If they are installed but the machine is not yet fully started then shared folders will be available once it is.”, select the Devices option from VirtualBox's menu bar, and click on the Install Guest Additions CD Image option. Guest Additions installer will start automatically.
Follow the instructions to install.

Step 3 : Click on the green folder icon to Add new shared folder option in the right hand side.

Step 4 : You will prompt to the screen to select the folder you created in step 1. Select that folder and click open. And check “Make Permanent” option.

Step 5 : Go to My computer → computer → Map network drive → Map network drive.
You will see the screen below:

Step 6 : Click on Browse to select the shared folder that is created on step 1. Click OK and Finish.




Step 7 : Then this shared folder will be added to the My computer section.


Step 8 : Now you can access “vmsharedfiles” folder  in Ubuntu from Windows 10 in virtualBox.

How To Install Windows 10 In VirtualBox in Linux

Step 1: Download Windows 10 ISO

The first and foremost step is to download Windows 10 ISO. You can download Windows 10 32 bit or 64 bit, depending upon your system.

Step 2: Install Windows 10 in VirtualBox

Start VirtualBox. You should see a screen like the one below. Click on new:

Name the VM. Select the Operating System and version, in this case Windows 10 and 64 bit for me. Choose RAM size. Next is the size for the virtual machine.

You can choose where to create the virtual disk. Default location (Home directory). For hard disk file type select VDI format.

After successful creation, You should be back to start screen. Click on Settings. Go to Storage and select the Empty disk. Under Attributes section, select disk icon to select the windows 10 ISO file for Optical Drive option.

You should be back to the main screen of VirtualBox.You have everything ready now. Next step is to install Windows 10. Click on Start from the main screen. Now You should see the Windows boot screen: After that you can do normal installation of windows 10.

If you didn’t get the above screen and getting the error as below.

Go to BIOS by press F1. Under security tab select virtualization. Enable VT option.