Friday, October 19, 2012

J2EE App එකකට reCAPTCHA එකක් දා ගන්න කොහොමද කියලා බලමු.

How to reCAPTCHA your Java application

reCAPTCHA is a novel CAPTCHA system developed by the School of Computer Science at my alma mater, Carnegie Mellon University. I won’t explain its coolness here since they do a good job of explaining that coolness themselves. What I will do here, though, is explain how to get your Java app reCAPTCHAed very quickly. Note however that reCAPTCHA is not tied specifically to Java.
In this tutorial I’m using Spring 2.5 MVC with annotations, and Commons Validator, but you’ll be able to follow this whether or not you’re using Spring and Validator.
These instructions are based on the instructions from the reCAPTCHA site, but I’m focusing specifically on Java integration whereas the site makes you dig around a bit to get the information. Not too bad, but enough that there’s value in my writing a Java-specific tutorial.

 Step 1. Get your account and key pair

First, go to the reCAPTCHA web site and create an account. As part of that account creation process you’ll have to specify the domain your reCAPTCHA will be protecting. The reCAPTCHA site will will give you a key pair for that domain. The key pair allows you to authenticate your reCAPTCHA requests to the reCAPTCHA servers, as we’ll see.

Step 2. Put the reCAPTCHA JavaScript in your app’s form

Here’s the JavaScript you need to put in your form, meaning in between the <form> and </form> tags. Put it wherever you would have normally put a CAPTCHA text box. This JavaScript will generate the reCAPTCHA box when users request the page:

================================================================
<script type="text/javascript"
    src="http://api.recaptcha.net/challenge?k=<your_public_key>">
</script>
<noscript>
 <iframe src="http://api.recaptcha.net/noscript?k=<your_public_key>"
    height="300" width="500" frameborder="0"></iframe><br>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40">
    </textarea>
    <input type="hidden" name="recaptcha_response_field" 
        value="manual_challenge">
</noscript>
================================================================
 
It probably goes without saying, but I’ll say it anyway: you need to replace the two instances of <your_public_key> with the public key that you received during the account creation process. Be careful that you don’t use your private key by mistake. If you do that then everybody will be able to see your private key and act like they’re you.

Step 3. Run your app and make sure the reCAPTCHA is showing up

 

You should see it there in your form. It’s OK if you are coming from localhost or 127.0.0.1 instead of the domain that you specified in the account creation step; reCAPTCHA will allow that. You should be able to click the buttons on the reCAPTCHA box and they should work.
After you goof around with that a bit, you’ll need to update your app itself so that it actually uses the reCAPTCHA box to validate the form submission.
Let’s turn now to the Java piece, where we validate the form and reCAPTCHA.

වැදගත් විස්තර ටිකක් [ Courier Services ]

 ලංකාවේ ජනප්‍රිය Courier Services
++++++++++++++++++++++++++++++++++++++++++++++

163/1A, Siri Dhamma Mawatha, Colombo 10, Sri Lanka
Telephone:
  • +94 11 523 5086
  • +94 11 523 4529
  • +94 11 523 4579
E-mail:
===============================================

ACX International (Pte) Ltd
151/6 Kirula Rd Colombo 05
Telephone + 94 11 4529529


Ace International Express (Pvt) Ltd
Branches-Kandy
Telephone + 94 08 14475061

Antron Express (Pvt) Ltd
No 16/5 Elliot Place Colombo 08
Telephone + 94 11 2691666

Aramex Lanka (Pvt) Ltd
307 Negombo Rd Peliyagoda
Telephone + 94 11 4728100

Capitol Overseas Courier Service (Pvt) Ltd
633 Sirimavo Bandaranaike Mw Colombo 14
Telephone + 94 11 5533433

Ceylinco Express
261 Highlevel Rd Kirulapone Colombo 05
Telephone + 94 11 5338391

City Link Courier International (Pvt) Limited
50 1st Floor, Colombo Plaza Galle Road Colombo 06, Sri lanka
Telephone + 94 11 2555560, 2555587, Fax 2303827

Citypak Courier Services
UPS House 209/2 Union Place Colombo 02
Telephone + 94 11 4703394, 4703900

Domestic Express (Pvt) Ltd
No 61 Robert Gunawardane Mw Colombo 06
Telephone: (00)94 - 11 4449418

Delmon Express (Pvt) Ltd
No 15 Mile Post Avenue Colombo 03
Telephone + 94 11 2370488

Dreamco Express (Pvt) Ltd
141/7 C Vauxhall St Colombo 02
Telephone + 94 11 2314541

drh Courier Express Lanka (Pvt) Ltd
7 Galle Face Terrace Colombo 03
Telephone + 94 11 5367700

Domestic Express (Pvt) Ltd
35/8 Polhengoda Rd Colombo 05
Telephone + 94 0714741474

D H L Keells (Pvt) Ltd
148 Vauxhall St Colombo 02
 Telephone + 94 11 2304304

Esdex Worldwide Express
A - 5 Adhikarana Mw Colombo 10
Telephone + 94 11 4737627

Fedex Express
3rd Floor 65 C Dharmapala Mw Colombo 07
 Telephone + 94 11 4522222

Hemas Holdings PLC
36, Bristol Street, Hemas Building, Colombo 01, Sri Lanka.
Telephone: (00)94 - 11 4731731 Fax 2332889, (+9411) 4731777

Institute of Policy Studies of Sri Lanka
99, St. Michael’s Road Colombo 03 Sri Lanka.
Telephone: (00)94 - 11 - 2431368, 2431378, 2431408 Facsimile: (00)94 - 11 - 2431395

Manoj Express Services
No 67/A Wolfendhal St Colombo 13
Telephone: (00)94 - 11 2390128

N D Express (Pvt) Ltd
No 339/1 Kotte Rd Nugegoda
Telephone: (00)94 - 11 5756647

Pronto Lanka (Pvt) Ltd
160/16 Kirimandala Mw Colombo 05
Telephone + 94 11 2369001

Skynet Worldwide Express
2nd Floor 135 Union Place Colombo 02
Telephone + 94 11 4798480

United Parcel Service
UPS House 209/2 Union Place Colombo 02
Telephone + 94 11 2337773

Utoexpress Pvt Ltd
20 A De Fonseka Rd Colombo 05
Telephone + 94 11 2585520

UPS
UPS House 209/2 Union Place Colombo 02
Telephone: (00)94 - 11 2337773

Vivid Express Courier Services (Pvt) Limited
13, De Fonseka Place Colombo 04
Telephone + 94 777 997996