By Yogananda

“Remain calm, serene, always in command of yourself. You will then find out how easy it is to get along.”
-By Yogananda

Sunday, December 2, 2012

Encoding and Decoding
=================

You can use encoding in order to render a specific language properly in any browser. When you support encoding from your front end, you need to make sure that you adhere to the following in order to avoid upcoming future issues.

1. OS (windows, ubuntu and etc)
2. Browser
3. Code (whole flow from JSP to the back end)

1. OS

Different OS supports different encoding type as default. For example windows 7 supports cp1252 which is a western char set and ubuntu supports UTF-8 which unicode char set. If we take java, jvm by default pick up the char set from the OS. But you can change the char set to jvm by adding an environmental variable in windows for example to support UTF-8 in windows:

JAVA_TOOL_OPTIONS
Variable value : - -Dfile.encoding=UTF-8

FYI:- Windows XP and previous versions supports unicode. So that you don't need to add this. But after windows 7 only, you may need to add this only if the default char set is different from UTF-8.

The reason why i'm taken UTF-8 is most of the time we support in our code UTF-8 as it is unicode. So making whole flow into unique charset is important when it comes to encoding and decoding.

2. Browser

To view a particular language, you may have to switch to correct encoding from the browser. Browser precedence  when choosing right encoding is from:

          *  The encoding send by the server (in JSP eg: encoding specified in meta tag)
          *  User preference from the broswer

Since we include UTF-8 or some other encoding in JSP's, browser tends to choose them as the encoding every time a page getting loaded. In order to to choose different encoding from JSP's meta tag, we will have to choose it in every page reloads which is a pain for a user. So that we have to support such different encoding from JSP itself. Then only users can go ahead without facing any problem.

3. Code (whole flow from JSP to the back end)

Every where encoding and decoding should be taken as the correct charset. So in order to make sure, we might have to develop the back end supporting correct encoding and decoding. For an example:
Encoding in JSP's
Encoding to query parameters
Encoding to DB input values

Like wise, you will have to check each and every area where encoding decoding is handled in order to avoid loosing details by following wrong encoding type in the middle.

This post is to just to give an idea about encoding and it's issues so that we can think better to support internationalization of a developing web site.









Thursday, November 1, 2012

URL-Mapping on Stratos

Configure URL-mapping on Stratos
=========================

ELB setup
========

CARBON_HOME/repository/conf/loadbalancher.conf
    * enable cache_size with preferred size
    * enable url_sufix in each service
        Eg: 

************************************************************************************
appserver {
       hosts                   appserver.cloud-test.wso2.com;
       url_suffix             as.wso2.com;
       domains   {
           wso2.as.domain {
                          tenant_range    *;
           }
           
       }
    }

esb {
       hosts                   esb.cloud-test.wso2.com;
           url_suffix             esb.wso2.com;
       domains   {
           wso2.esb.domain {
               tenant_range    *;
           }
       }
    }

***************************************************************************************
as such all the servers which have axis2 services or any services should be defined with unique url_suffix.

Worker-manager node
================

appserver {
       domains   {
           CharithaASdomain {
               hosts mgt.charitha.appserver.wso2.com;
               sub_domain mgt;
               tenant_range    *;

           }
           CharithaASdomain {
               hosts             charitha.appserver.wso2.com;
                  url_suffix                     as.wso2.com;
               sub_domain worker;
               tenant_range    *;
           }
       
       }
    }

only worker node needs the url_suffix.


AS node setup
==========

by default url-mapping feature is there
So in CARBON_HOME/repository/conf/etc/url-mappings.xml
    * replace url-prefix as “localhost” with “as.wso2.com” which is given in the ELB’s conf as url-suffix for that particular AS node.


Worker_manager node (AS)
====================
Manager node should have the url-suffix defined as in loadbalancher.conf for the worker node.

Worker can be as default.

ESB node setup
===============

install url-mapping feature from p2 repo.
Then as like AS node setup, change the configuration file with relevant url-suffix from ELB conf.


Greg
====

Need to mount Greg’s governance as shared across all the modes.


DNS mapping for a URL-mapping
========================

Have to get a DNS mapping to that particular URL-mapping.


Saturday, September 8, 2012

Context Mapping for Applications and Services in WSO2 AS





If you would like to have your own name for a app that you are developing and hosting it with us in Apps server, then here is the way to go. The custom URL will be mapped to the long URL.

You can own a unique domain to your deployed web application in our Apps server. Basically your app can be accessible like http://example.wso2.com rather confusing with a long URL http://appserver.stratoslive.com/t/tenant.com/webapps/example. Here you can configure the suffix ".wso2.com" through a CARBON_HOME/reposiory/etc/conf/url-mappings.xml file. 

The services which hosts in apps server can also be accessible via http://serviceid.wso2.com?wsdl. Also, tryit and rest call could use the same URL.

The short URL is tenant isolated even though it is not having tenant URL pattern. Also, the webapps which could be accessible through short URL will work with:

1.Tenant Lazy loading
2.Ghost Deployment of artifacts
3.Billing and Metering in Stratos
4.Cloud Deployment of AS nodes

The configuration of URL mappings will be slight different in case of stand alone products and in stratos. I'll explain the configuration details in my next post.