<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6059900666911337555</id><updated>2024-09-10T13:19:02.142+01:00</updated><category term="development"/><category term="j2ee"/><category term="javaee"/><category term="software"/><category term="MacOS X"/><category term="Objective-C"/><category term="iOS"/><category term="iPhone"/><category term="java"/><category term="jboss"/><category term="Google"/><category term="Google books"/><category term="HTTP"/><category term="JSON"/><category term="NSRunLoop"/><category term="NSTimer"/><category term="NSURLConnection"/><category term="SBJSon"/><category term="eclipse"/><category term="fedora"/><category term="glassfish"/><category term="linux"/><category term="oracle"/><category term="pgworksheet"/><category term="postgresql"/><category term="python"/><category term="run loop"/><category term="sun java system application server"/><category term="timer"/><category term="vmware"/><category term="web service"/><title type='text'>Software development, Operating Systems, ...</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-6733044603568836528</id><published>2019-02-14T14:35:00.001+00:00</published><updated>2019-02-14T14:35:48.990+00:00</updated><title type='text'>HomeEasyBudget : Easy Budget For Your Personnal Finances</title><content type='html'>&lt;h1 class=&quot;section-heading&quot;&gt;
Your household budget everywhere, all the time&lt;/h1&gt;
&lt;h1 class=&quot;section-heading&quot; style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;&amp;nbsp;Sign Up for Free !&lt;/a&gt;&lt;/h1&gt;
&lt;h2&gt;
Manage your personal finances&lt;/h2&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; allows you to manage your finances independently of your banking applications.&lt;br /&gt;




It is an application made for you who like to manage your finances manually, to the nearest penny and forecast.&lt;br /&gt;
&lt;br /&gt;




Unlike a bank account aggregator (such as Linxeo, Bankin or your bank
 application) &lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; does not access your account data online: 
no security risk, bank account piracy and no problem with your bank 
account confidentiality.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;You want precise and daily management? HomeEasyBudget allows you to 
enter all your transactions at any time and from all your devices, and 
to schedule recurring transactions.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;You want a management forecast? &lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; allows you to create 
lines of provisioning and to plan your budgets holidays, works, 
important purchases, savings, …&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; remembers for you which operations you have entered or modified and when&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;You close a bank account? &lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; allows you to keep the history of your old accounts indefinitely.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Schedule your operations&lt;/h2&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; allows you to schedule your recurring transactions for easy management of your daily finances.&lt;br /&gt;
&lt;br /&gt;
You can plan your monthly, weekly, bi-monthly, quarterly and annual transactions with or without a planning deadline.&lt;br /&gt;
&lt;br /&gt;
You can also create &lt;strong&gt;custom repetitions&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Analyze your finances&lt;/h2&gt;
&lt;br /&gt;
With &lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; create graphical reports or tables to analyze 
your accounts and quickly visualize your expenses and revenue items by 
category, sub-category, monthly, annually or any other period or 
criterion at your convenience.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; offers simple reports already configured for each bank
 account for quick viewing of your transactions, for a month or a year.&lt;br /&gt;
&lt;br /&gt;
For a more detailed analysis you can also create your own reports on 
multiple criteria: period, fiscal years, bank accounts, categories, 
subcategories, amounts, means of payment, third parties, …&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Share with your family&lt;/h2&gt;
&lt;div class=&quot;col-md-12&quot;&gt;
    &lt;div class=&quot;page-content&quot;&gt;
      
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; allows you to share your account with your all the 
member of your family or with the people who share a bank account with 
you like your roommates, associates, …&lt;br /&gt;




&lt;h3&gt;
Share and keep control&lt;/h3&gt;
Share one or more of your accounts with any other &lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; user.&lt;br /&gt;








Each share can be controlled by means of rights for each account: 
consultation only, possible modification, possible reconciliation or 
permission to create or not a planned operation.&lt;br /&gt;








&lt;h3&gt;
Association or other accounts&lt;/h3&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt;’s account sharing allows you to easily create an 
account for an association and share it with all members of the 
association’s office, including those who only have to view the account 
and not modify it with permissions sharing.&lt;br /&gt;
&lt;br /&gt;




&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; also facilitates the creation of a cash account for an
 event such as an evening, a sports event or a birthday. Create the 
account and share it with all the managers of the event.&lt;br /&gt;

          &lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;section class=&quot;page-header&quot;&gt;
 &lt;div class=&quot;container&quot;&gt;
  &lt;div class=&quot;row&quot;&gt;
   &lt;div class=&quot;col-md-6&quot;&gt;
    &lt;div class=&quot;page-title&quot;&gt;
     &lt;h2&gt;
Check your accounts&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;



  
 
  
   
   
       
      
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; allows you to check your accounts easily and quickly through reconciliations.&lt;br /&gt;




&lt;h3&gt;
&lt;strong&gt;Transactions reconciliations&lt;/strong&gt;&lt;/h3&gt;
The reconciliation feature allows you to check your transactions at 
the end of the month or when you receive your bank statement.&lt;br /&gt;




The reconciliations allows you to check if your finances are perfect:
 no forgotten operations, error of entering a credit or debit, duplicate
 transactions, etc.&lt;br /&gt;








With the help of an account statement and the search function, the 
reconciliation is even faster. For example, you can search for 
point-based transactions based on an amount, a third party, a category, 
or a date.&lt;br /&gt;
&lt;h3&gt;
Go back&lt;/h3&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; keeps the history of all your reconciliations and also allows you to cancel them in case of error or doubt. &lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;section class=&quot;page-header&quot;&gt;
 &lt;div class=&quot;container&quot;&gt;
  &lt;div class=&quot;row&quot;&gt;
   &lt;div class=&quot;col-md-6&quot;&gt;
    &lt;div class=&quot;page-title&quot;&gt;
     &lt;h2&gt;
All your devices&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;



  
 
  
   
   
       
      
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; is available for all your devices: Windows PC, Mac OS,
 Android or iOS mobile phone, Android tablet, iOS or Windows. As an 
application or from any internet browser.&lt;br /&gt;








&lt;div class=&quot;wp-block-image&quot;&gt;
&lt;figure class=&quot;aligncenter&quot;&gt;&lt;figure&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=app.homeeasybudget.mobile&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png&quot; width=&quot;200px;&quot; /&gt;&lt;/a&gt;&lt;/figure&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;HomeEasyBudget&lt;/a&gt; is an application in the cloud that allows you to do 
your accounts anytime, anywhere: at home, at work, on public transport, 
on holidays, …&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;h1 class=&quot;section-heading&quot; style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://homeeasybudget.app/en/&quot;&gt;&amp;nbsp;Sign Up for Free !&lt;/a&gt;&lt;/h1&gt;
&lt;h2&gt;
&amp;nbsp;&lt;/h2&gt;
&lt;h1 class=&quot;section-heading&quot;&gt;
 &lt;/h1&gt;
</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/6733044603568836528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/6733044603568836528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/6733044603568836528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/6733044603568836528'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2019/02/homeeasybudget-easy-budget-for-your.html' title='HomeEasyBudget : Easy Budget For Your Personnal Finances'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-7712031522382021774</id><published>2011-10-19T09:38:00.001+01:00</published><updated>2011-10-19T09:39:17.026+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><category scheme="http://www.blogger.com/atom/ns#" term="Google books"/><category scheme="http://www.blogger.com/atom/ns#" term="HTTP"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="MacOS X"/><category scheme="http://www.blogger.com/atom/ns#" term="NSURLConnection"/><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><category scheme="http://www.blogger.com/atom/ns#" term="SBJSon"/><category scheme="http://www.blogger.com/atom/ns#" term="web service"/><title type='text'>Asynchronous web service client using NSURLConnection and SBJSON</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt; class&lt;/span&gt;&lt;br /&gt;
A &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt; object is used to perform the execution of a web service using HTTP.&lt;br /&gt;
When using&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt;, requests are made in asynchronous form. This mean that you don&#39;t wait the end of the request to continue, but you do something else until the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt; object tell you that some data arrived or the connection started, failed on ended.&lt;br /&gt;
When initializing the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt; object you have to pass the reference of a delegate. This is the object called by &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt; to inform your program about the status on the connection.&lt;br /&gt;
This delegate must have to implement the following methods &amp;nbsp;:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connection:didReceiveResponse&lt;/span&gt; : called after the connection is made successfully and before receiving any data. Can be called more than one time in case of redirection.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt; connection:didReceiveData &lt;/span&gt;: called for each bloc of data.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connectionDidFinishLoading&lt;/span&gt; : called only one time upon the completion of the request, if no error.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connection:didFailWithError&lt;/span&gt; : called on error.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;The Google Books service&lt;/span&gt;&lt;br /&gt;
In this example, we will use the&lt;a href=&quot;http://code.google.com/intl/us-US/apis/books/&quot;&gt; Google Book web service&lt;/a&gt;. We selected this service mainly for the easy of use and the&amp;nbsp;concise&amp;nbsp;results. We also selected this service because it use JSON to return the datas, and JSON is the best data interchange format for mobile devices like iPhone because it&#39;s lightweight and easy to parse.&lt;br /&gt;
A typical request to the search function of the Google Book web service is :&lt;br /&gt;
&lt;a href=&quot;https://www.googleapis.com/books/v1/volumes?q=biologie&quot;&gt;https://www.googleapis.com/books/v1/volumes?q=biologie&lt;/a&gt;&lt;br /&gt;
where &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;searchterms&lt;/span&gt; are replaced by the searched keywords. You can see by clicking on the preceding link that the service return an array of &lt;i&gt;items&lt;/i&gt; consisting of books description.&lt;br /&gt;
We will extract the &lt;i&gt;volumeInfo/title&lt;/i&gt;, &lt;i&gt;volumeInfo/description,&lt;/i&gt;&amp;nbsp;&lt;i&gt;volumeInfo/imageLinks/smallThumbnail&lt;/i&gt; and &lt;i&gt;volumeInfo/previewLink&lt;/i&gt; in this example.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;Integrating SBJSon&lt;/span&gt;&lt;br /&gt;
Unfortunately, neither the MacOS X nor the iOS SDK have some JSON parsing API, despite the fact that Apple use JSON intensively in their own applications.&lt;br /&gt;
There is several third party API that can easily be found on the Internet, and we selected &lt;a href=&quot;http://stig.github.com/json-framework/&quot;&gt;SBJSon&lt;/a&gt; for this example.&lt;br /&gt;
You need to &lt;a href=&quot;https://github.com/stig/json-framework/downloads&quot;&gt;download&lt;/a&gt; the latest &lt;a href=&quot;http://stig.github.com/json-framework/&quot;&gt;SBJSon&lt;/a&gt; distribution, extract it somewhere and import it in your XCode project under a new group :&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEGdFeBrG6g9ZYnYxDA3gKRXzTZGJrVewSp374mQ0HGoNwwJDTKx8U6w53U2Zs7ijuQNyjZi4Omm8pstaHpwpTKEkLc-WFIb5MXeu3y_sgpnTzfKa3INrls-VrlxUSQCAfb_QpXDyl23k/s1600/Capture+d%25E2%2580%2599%25C3%25A9cran+2011-10-18+%25C3%25A0+13.25.44.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;247&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEGdFeBrG6g9ZYnYxDA3gKRXzTZGJrVewSp374mQ0HGoNwwJDTKx8U6w53U2Zs7ijuQNyjZi4Omm8pstaHpwpTKEkLc-WFIb5MXeu3y_sgpnTzfKa3INrls-VrlxUSQCAfb_QpXDyl23k/s320/Capture+d%25E2%2580%2599%25C3%25A9cran+2011-10-18+%25C3%25A0+13.25.44.png&quot; width=&quot;287&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;Writing the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Book&lt;/span&gt; business class&lt;/span&gt;&lt;br /&gt;
The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Book&lt;/span&gt; class represent a book with only the attributes we need in the example: a title, a description, a thumbnail image and a URL to the book page. A &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Book&lt;/span&gt; object will be initialized using a JSON string corresponding to a single &lt;i&gt;item&lt;/i&gt; from the Google Book web service.&lt;br /&gt;
This is the interface :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;co1&quot; style=&quot;color: #6e371a; font-style: normal;&quot;&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@interface&lt;/span&gt;&amp;nbsp;Book&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSObject&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;title;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;desc;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; UIImage&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;smallThumbnail;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURL&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;url;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@property&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;nonatomic, copy&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;title;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@property&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;nonatomic, copy&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;desc;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@property&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;nonatomic, retain&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;UIImage&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;smallThumbnail;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@property&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;nonatomic, retain&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURL&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;url;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;initWithJSONDictionnary&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSDictionary&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;json;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and the implementation :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;co1&quot; style=&quot;color: #6e371a; font-style: normal;&quot;&gt;#import &quot;Book.h&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@implementation&lt;/span&gt;&amp;nbsp;Book&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@synthesize&lt;/span&gt;&amp;nbsp;title, desc, smallThumbnail, url;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;initWithJSONDictionnary&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSDictionary&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;json&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; self&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;super init&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;self&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSDictionary&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&amp;nbsp;volumeInfo&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;json objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;volumeInfo&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.title&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;volumeInfo objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;title&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.desc&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;volumeInfo objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&amp;nbsp;path&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;volumeInfo objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;imageLinks&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;smallThumbnail&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UIImage&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&amp;nbsp;image&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;UIImage alloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;initWithData&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSData&lt;/span&gt;&lt;/a&gt;&amp;nbsp;dataWithContentsOfURL&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURL&lt;/span&gt;&lt;/a&gt;&amp;nbsp;URLWithString&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;path&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.smallThumbnail&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;image;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;image release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.url&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURL&lt;/span&gt;&lt;/a&gt;&amp;nbsp;URLWithString&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;volumeInfo objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;previewLink&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;return&lt;/span&gt;&amp;nbsp;self;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;dealloc&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;url release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;desc release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;title release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;smallThumbnail release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;super dealloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/gp/product/1449388434/ref=as_li_tf_il?ie=UTF8&amp;amp;tag=vxp-20&amp;amp;linkCode=as2&amp;amp;camp=217145&amp;amp;creative=399369&amp;amp;creativeASIN=1449388434&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;amp;Format=_SL160_&amp;amp;ASIN=1449388434&amp;amp;MarketPlace=US&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;tag=vxp-20&amp;amp;ServiceVersion=20070822&quot; /&gt;&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://www.assoc-amazon.com/e/ir?t=vxp-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=1449388434&amp;amp;camp=217145&amp;amp;creative=399369&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&lt;br /&gt;
&lt;/center&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;GoogleBookService&lt;/span&gt; class&lt;/span&gt;&lt;br /&gt;
This class implements the code to query the Google Books web service using HTTPS and translate the JSON resulting datas into &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Books&lt;/span&gt; business objects.&lt;br /&gt;
The resulting objects are stored in a &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSMutableArray&lt;/span&gt; collection of &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Books&lt;/span&gt;, and the search is started by the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-performSearch&lt;/span&gt; function :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;co1&quot; style=&quot;color: #6e371a; font-style: normal;&quot;&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@interface&lt;/span&gt;&amp;nbsp;GoogleBooksService&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSObject&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSMutableArray&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;books;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableData_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSMutableData&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;data;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@property&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;nonatomic, retain&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSMutableArray&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;books;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;performSearch&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;keyword;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;@end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;data&lt;/span&gt; instance variable will be used by the same callbacks to store the raw datas received from by the&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLConnection&lt;/span&gt; object.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;Implementing the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;GoogleBookService&lt;/span&gt; class&lt;/span&gt;&lt;br /&gt;
The first thing is of course to write the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-dealloc&lt;/span&gt; destructor :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;dealloc&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;data release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;books release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;super dealloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-performSearch&lt;/span&gt;&amp;nbsp;allocate the temporary data storage, build the URL using the keyword (note that you can build a better URL by encoding/escaping the keyword, not done here for clarity), build a &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSURLRequest&lt;/span&gt; object using the URL then execute the request using NSURLConnection :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;performSearch&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;keyword&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; data&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableData_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSMutableData&lt;/span&gt;&lt;/a&gt;&amp;nbsp;alloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;init&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURL&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;url&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURL&lt;/span&gt;&lt;/a&gt;&amp;nbsp;URLWithString&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;stringWithFormat&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;https://www.googleapis.com/books/v1/volumes?q=%@&quot;&lt;/span&gt;,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;keyword&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLRequest&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;request&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLRequest&lt;/span&gt;&lt;/a&gt;&amp;nbsp;requestWithURL&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;url&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLConnection&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;connection&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLConnection&lt;/span&gt;&lt;/a&gt;&amp;nbsp;alloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;initWithRequest&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;request&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delegate&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;self&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;!&lt;/span&gt;connection&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;co2&quot; style=&quot;color: #11740a; font-style: italic;&quot;&gt;// this is better if you @throw an exception&amp;nbsp;here&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NSLog&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;error while starting the connection&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;data release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The request to the web service will be executed in a background thread by the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connection&lt;/span&gt; object. This thread will call the callback functions, in order :&lt;br /&gt;
-&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connection:didReceiveResponse&lt;/span&gt;, after the connection object have received the response and HTTP headers from the remote web server :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLConnection&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection didReceiveResponse&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLResponse_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLResponse&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;response&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;data setLength&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: #2400d9;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
-&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connection:didReceiveData&lt;/span&gt;, for each block of raw data received :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLConnection&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection didReceiveData&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSData&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;someData&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;data appendData&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;someData&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
-&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connection:didFailWithError&lt;/span&gt;, in case of error :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLConnection&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection didFailWithError&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSError&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;error&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;connection release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;data release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
-&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;connectionDidFinishLoading&lt;/span&gt;, at the end of the request, if no error have happened. In this function we use SBJSon to translate the raw datas in &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Books&lt;/span&gt; objects :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connectionDidFinishLoading&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSURLConnection&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;connection&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;connection release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;jsonString&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSString&lt;/span&gt;&lt;/a&gt;&amp;nbsp;alloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;initWithData&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;data&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;encoding&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;NSUTF8StringEncoding&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;data release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #0000bb; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSArray&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&amp;nbsp;jsonItems&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;jsonString JSONValue&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;objectForKey&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;co3&quot; style=&quot;color: #bf1d1a;&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #bf1d1a;&quot;&gt;&quot;items&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw4&quot; style=&quot;color: #a61390;&quot;&gt;id&lt;/span&gt;&amp;nbsp;item;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; books&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw5&quot; style=&quot;color: #400080;&quot;&gt;NSMutableArray&lt;/span&gt;&lt;/a&gt;&amp;nbsp;alloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;init&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;item&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #a61390;&quot;&gt;in&lt;/span&gt;&amp;nbsp;jsonItems&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Book&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&amp;nbsp;book&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;Book alloc&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;&amp;nbsp;initWithJSONDictionnary&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;item&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;books addObject&lt;span class=&quot;sy0&quot; style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;book&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;[&lt;/span&gt;jsonString release&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;]&lt;/span&gt;;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #002200;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/7712031522382021774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/7712031522382021774' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/7712031522382021774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/7712031522382021774'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2011/10/asynchronous-web-service-client-using.html' title='Asynchronous web service client using NSURLConnection and SBJSON'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEGdFeBrG6g9ZYnYxDA3gKRXzTZGJrVewSp374mQ0HGoNwwJDTKx8U6w53U2Zs7ijuQNyjZi4Omm8pstaHpwpTKEkLc-WFIb5MXeu3y_sgpnTzfKa3INrls-VrlxUSQCAfb_QpXDyl23k/s72-c/Capture+d%25E2%2580%2599%25C3%25A9cran+2011-10-18+%25C3%25A0+13.25.44.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-4838383633776419539</id><published>2011-10-14T11:46:00.007+01:00</published><updated>2011-10-19T08:56:14.807+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="MacOS X"/><category scheme="http://www.blogger.com/atom/ns#" term="NSRunLoop"/><category scheme="http://www.blogger.com/atom/ns#" term="NSTimer"/><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><category scheme="http://www.blogger.com/atom/ns#" term="run loop"/><category scheme="http://www.blogger.com/atom/ns#" term="timer"/><title type='text'>How to schedule the execution of a function using NSTimer</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSTimer&lt;/span&gt; class&lt;/span&gt;&lt;br /&gt;
The &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSTimer&lt;/span&gt; class can be used to schedule the execution of a function in a program for MacOS X, iPhone / &amp;nbsp;iOs.&lt;br /&gt;
You can execute a function for any object, pass some user defined datas, and optionally you can repeat the scheduled execution automagically.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;The target function&lt;/span&gt;&lt;br /&gt;
First, you have to write the target function.&lt;br /&gt;
This function must have a &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSTimer*&lt;/span&gt; parameter because you can use it with multiple timers.&lt;br /&gt;
In this exemple, the target function called &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;timerEnd&lt;/span&gt; stops the animation of a &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;UIActivityIndicatorView&lt;/span&gt;&amp;nbsp;called &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;indicator&lt;/span&gt; then posts a notification if the user have entered some text in a &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;UITextField&lt;/span&gt; named &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;textNom&lt;/span&gt; :&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;-(&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;) timerEnd: (NSTimer *) theTimer { 
    [indicator stopAnimating]; 
    &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; ([textNom.text length] &amp;gt; &lt;span style=&quot;color: maroon;&quot;&gt;0&lt;/span&gt;) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@&lt;span style=&quot;color: maroon;&quot;&gt;&quot;My Notification&quot;&lt;/span&gt;  
                                                            object:textNom.text]; 
    } 
    textNom.text = @&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;; 
} &lt;/pre&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;Scheduling the timer&lt;/span&gt;&lt;br /&gt;
Once you have your target function ready, you can schedule the execution using the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;+NSTimer:scheduledTimerWithTimeInterval&lt;/span&gt; class function.&lt;br /&gt;
In the following example, the timer execute the&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt; [self timerEnd]&lt;/span&gt; message after 5 seconds :&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;[NSTimer scheduledTimerWithTimeInterval: &lt;span style=&quot;color: maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;.0&lt;/span&gt;  
                                 target: self  
                               selector: @selector(timerEnd:)  
                               userInfo: nil  
                                repeats: NO];&lt;/pre&gt;&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/gp/product/0321706242/ref=as_li_tf_il?ie=UTF8&amp;tag=vxp-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0321706242&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=0321706242&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=vxp-20&amp;ServiceVersion=20070822&quot; &gt;&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=vxp-20&amp;l=as2&amp;o=1&amp;a=0321706242&amp;camp=217145&amp;creative=399369&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;&lt;br /&gt;
&lt;/center&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-size: large;&quot;&gt;Notes on &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSTimer&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Never forget that &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;NSTimer&lt;/span&gt; relies on the run loop. It means :&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;You must have a run loop. If you write a MacOS X console application, you must write it yourself. If you write a library or a Framework, you must document the fact that a run loop is mandatory.&lt;/li&gt;
&lt;li&gt;Run loops &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;retain&lt;/span&gt; timers. So you can &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;release&lt;/span&gt; your timers once scheduled.&lt;/li&gt;
&lt;li&gt;It&#39;s not real time. The run loop execute the timers once it have checked that the timer time have been passed. Hence in the preceding example the &quot;after 5 seconds&quot; and not &quot;in 5 seconds&quot;.&lt;/li&gt;
&lt;li&gt;the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;+NSTimer:scheduleTimer*&lt;/span&gt; functions creates the timer and pushes it in the run loop. If you only want to create the timer use &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;+NSTimer:timerWithTimeInterval&lt;/span&gt; functions then use &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-NSRunLoop:addTimer&lt;/span&gt; to push the timer (you can use &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;+NSRunLoop:currentRunLoop&lt;/span&gt; to get the current run loop).&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/4838383633776419539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/4838383633776419539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/4838383633776419539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/4838383633776419539'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2011/10/how-to-schedule-execution-of-function.html' title='How to schedule the execution of a function using NSTimer'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-9017549572081001387</id><published>2008-03-05T09:36:00.018+00:00</published><updated>2017-02-15T10:12:34.815+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="glassfish"/><category scheme="http://www.blogger.com/atom/ns#" term="j2ee"/><category scheme="http://www.blogger.com/atom/ns#" term="javaee"/><category scheme="http://www.blogger.com/atom/ns#" term="sun java system application server"/><title type='text'>Glassfish login module : a simple example</title><content type='html'>In this tutorial we will see how to write a very simple custom login module for the &lt;a href=&quot;https://glassfish.dev.java.net/&quot;&gt;Glassfish&lt;/a&gt; application server.&lt;br /&gt;
Even if Glassfish ships with some useful login modules, there are not adapted to every situations, most notably with custom LDAP directories or strange authentication methods.&lt;br /&gt;
&lt;a href=&quot;http://docs.sun.com/app/docs/doc/819-3672/beabo?a=view&quot;&gt;Chapter 5&lt;/a&gt; of the Glassfish developer documentation is a must read on this subject, and reading it is recommended before trying to write your own custom login module.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #663366;&quot;&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt; Our custom authentication scheme &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
In this example we want to implement a very simple authentication method : a user is authenticated if is username start with a specific string. For example, if the string is &quot;z&quot;, then the users &lt;span style=&quot;font-style: italic;&quot;&gt;zed&lt;/span&gt; and &lt;span style=&quot;font-style: italic;&quot;&gt;zorro &lt;/span&gt;can login.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;A configurable login module&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
The login module must be fully configurable. The application server administrator can configure the string used in our authentication scheme.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;The custom realm&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;A custom login module in glassfish is composed by two classes :&lt;br /&gt;
- a &lt;span style=&quot;font-style: italic;&quot;&gt;custom realm&lt;/span&gt;, which handle realm configuration&lt;br /&gt;
- a &lt;span style=&quot;font-style: italic;&quot;&gt;custom login module&lt;/span&gt;, which handle authentication based on the informations given by the custom realm&lt;br /&gt;
A custom realm must extends &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;AppservRealm&lt;/span&gt; :&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt;&amp;nbsp;MyRealm&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;AppservRealm&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; private&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&amp;nbsp;jaasCtxName&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; private&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&amp;nbsp;startWith&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
@&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Override.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;Override&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #006600; font-weight: bold;&quot;&gt;void&lt;/span&gt;&amp;nbsp;init&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw46&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;Properties&lt;/span&gt;&lt;/a&gt;&amp;nbsp;props&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt;&amp;nbsp;BadRealmException, NoSuchRealmException&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&amp;nbsp;_&lt;br /&gt;
&amp;nbsp; logger.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;X-TECH MyRealm: init()&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; jaasCtxName = props.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;jaas-context&quot;&lt;/span&gt;,&amp;nbsp;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;xtechMyRealm&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; startWith = props.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;getProperty&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;startWith&quot;&lt;/span&gt;,&amp;nbsp;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;z&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
@&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Override.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;Override&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&amp;nbsp;getJAASContext&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt;&amp;nbsp;jaasCtxName&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/util/Enumeration.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw46&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;Enumeration&lt;/span&gt;&lt;/a&gt;&amp;nbsp;getGroupNames&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&amp;nbsp;string&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt;&amp;nbsp;InvalidOperationException, NoSuchUserException&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw166&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://www.google.com/search?sitesearch=java.sun.com&amp;amp;q=allinurl%3Aj2se%2F1+5+0%2Fdocs%2Fapi+List&quot; style=&quot;color: #000066;&quot;&gt;List&lt;/a&gt;&lt;/span&gt;&amp;nbsp;groupNames =&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw46&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;LinkedList&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; return&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/util/Enumeration.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw46&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;Enumeration&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;groupNames&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&amp;nbsp;getAuthType&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; return&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;X-TECH MyRealm&quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&amp;nbsp;getStartWith&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; return&lt;/span&gt;&amp;nbsp;startWith&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;The custom login module&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;A custom login must extends &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;AppservPasswordLoginModule&lt;/span&gt; and override &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;authenticateUser()&lt;/span&gt;:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f0f0f0; color: #000066; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;&quot;&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt;&amp;nbsp;MyLoginModule&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;AppservPasswordLoginModule&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #006600; font-weight: bold;&quot;&gt;void&lt;/span&gt;&amp;nbsp;authenticateUser&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/javax/security/auth/login/LoginException.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw93&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;LoginException&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; _logger.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;X-TECH MyLoginModule : authenticateUser for &quot;&lt;/span&gt;&amp;nbsp;+ &lt;br /&gt;
&amp;nbsp; &amp;nbsp; _username&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; MyRealm realm =&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;MyRealm&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;_currentRealm&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; if&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt;_username.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;startsWith&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;realm.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;getStartWith&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; _logger.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;Invalid credentials.&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; throw&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/javax/security/auth/login/LoginException.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw93&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;LoginException&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;Invalid credentials.&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; _logger.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;User authenticated&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw46&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html&quot; style=&quot;color: #000066;&quot;&gt;Set&lt;/a&gt;&lt;/span&gt;&amp;nbsp;principals = _subject.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;getPrincipals&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; principals.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt;&amp;nbsp;PrincipalImpl&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;_username&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;String&lt;/a&gt;&lt;/span&gt;&amp;nbsp;grpList&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html&quot; style=&quot;color: #000066;&quot;&gt;&lt;span class=&quot;kw21&quot; style=&quot;color: #003399; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; grpList&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span class=&quot;st0&quot; style=&quot;color: blue;&quot;&gt;&quot;User&quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw2&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;nbsp; this&lt;/span&gt;.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;commitUserAuthentication&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;grpList&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;center&gt; &lt;a href=&quot;http://www.amazon.com/gp/product/1849510369/ref=as_li_tf_il?ie=UTF8&amp;amp;tag=vxp-20&amp;amp;linkCode=as2&amp;amp;camp=217145&amp;amp;creative=399369&amp;amp;creativeASIN=1849510369&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;amp;Format=_SL160_&amp;amp;ASIN=1849510369&amp;amp;MarketPlace=US&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;tag=vxp-20&amp;amp;ServiceVersion=20070822&quot; /&gt;&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://www.assoc-amazon.com/e/ir?t=vxp-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=1849510369&amp;amp;camp=217145&amp;amp;creative=399369&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&lt;br /&gt;
&lt;/center&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt; Installing the custom login module&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;Installing and activating the customs realm and login module involve three steps :&lt;br /&gt;
- Configuring a realm using the glassfish administration console&lt;br /&gt;
- Linking the custom realm with the custom login module&lt;br /&gt;
- Make the classes avaible to glassfish&lt;br /&gt;
The first step is illustrated in the screenshot below :&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE_ueJy0eBJTifrYkR7NJBcGvOou3PxOYgZ2kXlyveluCTfKqd-ZcijCF9gcsa1EFpHDeRbzwqC14hguDUDv5hMuW2SC5wfRDAq_8i2JuYk-9WMVPrzh0TWdumr1yh0Zomg30-LFo7IMQ/s1600-h/Capture-Sun+Java+System+Application+Server+9.1+Admin+Console+-+Mozilla+Firefox-1.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5174193815322260322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE_ueJy0eBJTifrYkR7NJBcGvOou3PxOYgZ2kXlyveluCTfKqd-ZcijCF9gcsa1EFpHDeRbzwqC14hguDUDv5hMuW2SC5wfRDAq_8i2JuYk-9WMVPrzh0TWdumr1yh0Zomg30-LFo7IMQ/s320/Capture-Sun+Java+System+Application+Server+9.1+Admin+Console+-+Mozilla+Firefox-1.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;The second step is done by editing the &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;login.conf&lt;/span&gt; file located in the &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;config&lt;/span&gt; directory of the domain. Add a line like this one to the end of the &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;login.conf &lt;/span&gt;file:&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;xtechMyRealm {&lt;/span&gt; &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;    org.xtech.examples.gfloginmodule.MyLoginModule required;&lt;/span&gt; &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;};&lt;/span&gt;&lt;br /&gt;
For the last step just copy the&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; .jar&lt;/span&gt; file containing the customs realm and login module classes in the &lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;lib&lt;/span&gt; directory of glassfish (you must restart glassfish).&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;&lt;br /&gt;
Writing an example application&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;To try the new login module create a web application with only a index.jsp page. Put this line to display the authenticated user name :&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;Welcome ${pageContext.request.userPrincipal.name}&lt;/span&gt;&lt;br /&gt;
Add security to the web.xml file:&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQb9PXLr6UxzDiyCba-c6Z3hdrAzZyKbmoRJobQpCspozQskT3aRuYzIvsLuKm_68_6yACqc1-C1BfSVZJhJph-dA7K71IU6AGlUosakMRO2pK4VnWWNtFsYvUsmdhOujDN_Gp42OYnjk/s1600-h/Capture-GlassfishCustomLoginModuleTest+-+NetBeans+IDE+6.0.1.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5174196774554727282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQb9PXLr6UxzDiyCba-c6Z3hdrAzZyKbmoRJobQpCspozQskT3aRuYzIvsLuKm_68_6yACqc1-C1BfSVZJhJph-dA7K71IU6AGlUosakMRO2pK4VnWWNtFsYvUsmdhOujDN_Gp42OYnjk/s320/Capture-GlassfishCustomLoginModuleTest+-+NetBeans+IDE+6.0.1.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;security-constraint&gt;&lt;security-role&gt;&lt;description&gt; &lt;/description&gt;&lt;br /&gt;
and link the web application security roles with the group name used in the custom login module by adding the folowing lines to the sun-web.xml file:&lt;br /&gt;
&lt;security-role-mapping&gt;&lt;/security-role-mapping&gt;&lt;/security-role&gt;&lt;/security-constraint&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNfPpusst97FQjqjVNAF8C9X0Ax1kbAQMJ5pKL6a_OHTmyCWpI8T4iHw4ooxSJ_idJKm_Z6KZs5rw9soqXehqtO7m6xLV56pSjlWO1ZgXC3Qtqm7wzevBcQmSJH0Mamk0GVxa0Si5BXaM/s1600-h/Capture-GlassfishCustomLoginModuleTest+-+NetBeans+IDE+6.0.1-1.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5174196856159105922&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNfPpusst97FQjqjVNAF8C9X0Ax1kbAQMJ5pKL6a_OHTmyCWpI8T4iHw4ooxSJ_idJKm_Z6KZs5rw9soqXehqtO7m6xLV56pSjlWO1ZgXC3Qtqm7wzevBcQmSJH0Mamk0GVxa0Si5BXaM/s320/Capture-GlassfishCustomLoginModuleTest+-+NetBeans+IDE+6.0.1-1.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Deploy your application and give it a try !

&lt;br/&gt;&lt;a href=&quot;http://akikilestlenumero.fr/&quot;&gt;A Ki Ki L&#39;Est Le Numéro ? Annuaire téléphone et adresse inverse et pas inverse&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/9017549572081001387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/9017549572081001387' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/9017549572081001387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/9017549572081001387'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2008/03/glassfish-login-module-simple-example.html' title='Glassfish login module : a simple example'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE_ueJy0eBJTifrYkR7NJBcGvOou3PxOYgZ2kXlyveluCTfKqd-ZcijCF9gcsa1EFpHDeRbzwqC14hguDUDv5hMuW2SC5wfRDAq_8i2JuYk-9WMVPrzh0TWdumr1yh0Zomg30-LFo7IMQ/s72-c/Capture-Sun+Java+System+Application+Server+9.1+Admin+Console+-+Mozilla+Firefox-1.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-4109290906788307096</id><published>2007-04-03T14:23:00.003+01:00</published><updated>2011-10-19T08:58:37.500+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="j2ee"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="javaee"/><category scheme="http://www.blogger.com/atom/ns#" term="jboss"/><title type='text'>JBoss custom login module : a simple example</title><content type='html'>In this tutorial we will see how to write a very simple custom login module for the JBoss application server.&lt;br /&gt;
Even if JBoss ships with some useful login modules, there are not adapted to every situations, most notably with custom LDAP directories or strange authentication methods.&lt;br /&gt;
&lt;a href=&quot;http://docs.jboss.org/jbossas/jboss4guide/r5/html/ch8.chapter.html&quot;&gt;Chapter 8&lt;/a&gt; of the JBoss documentation is a must read on this subject, and reading it is recommended before trying to write your own custom login module.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #663366;&quot;&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt; Our custom authentication scheme &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
In this example we want to implement a very stange authentication method :&lt;br /&gt;
- dynamic user login names in the form &lt;span style=&quot;font-style: italic;&quot;&gt;userX&lt;/span&gt; where X is a decimal number&lt;br /&gt;
- dynamic administrators login names in the form &lt;span style=&quot;font-style: italic;&quot;&gt;adminY&lt;/span&gt; where Y is what you want and is not very important&lt;br /&gt;
- a guest user name for anonymous connections&lt;br /&gt;
- dynamic user passphrase in the form &lt;span style=&quot;font-style: italic;&quot;&gt;userX loves you&lt;/span&gt;&lt;br /&gt;
- dynamic administrator passphrase in the form &lt;span style=&quot;font-style: italic;&quot;&gt;adminY is the boss&lt;/span&gt;&lt;br /&gt;
- empty password for the guest user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;A configurable login module&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
The login module must be fully configurable.&lt;br /&gt;
We want :&lt;br /&gt;
- a regular expression to indentify guest users (optional, &quot;anonymous&quot; if not configured)&lt;br /&gt;
- a regular expression to indentify normal users&lt;br /&gt;
- a regular expression to indentify administrators&lt;br /&gt;
- a model for the users passphrases&lt;br /&gt;
- a model for the administrator passphrases&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;JBoss configuration&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Default JBoss login modules configuration file is &lt;tt&gt;${JBOSS_HOME}/server/default/conf/login-config.xml&lt;/tt&gt;.&lt;br /&gt;
Every JBoss login module must be given a JAAS security domain name. We will call our security domain &quot;MyLoginModule&quot;.&lt;br /&gt;
Add the following to the configuration file just before the &quot;other&quot; security domain :&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcND-AnSnwnUkLUb0W1PE1hDZbtrky6rlZ1Lqn_yZ097w94sddxFcjbCL_dHQBBqKvno23zirY9ZB8evvEFvRwkUK9NH2bD0aXnag_AlXvaxdBVXPNOHCqLa0U-KHvd8hN_uSgpw2VZes/s1600-h/Capture-NetBeans+IDE+5.5.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5049206106315530306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcND-AnSnwnUkLUb0W1PE1hDZbtrky6rlZ1Lqn_yZ097w94sddxFcjbCL_dHQBBqKvno23zirY9ZB8evvEFvRwkUK9NH2bD0aXnag_AlXvaxdBVXPNOHCqLa0U-KHvd8hN_uSgpw2VZes/s400/Capture-NetBeans+IDE+5.5.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;tt&gt;com.blogger.xtechteam.examples.jboss.loginmodule.CustomJBossLoginModule&lt;/tt&gt;&lt;br /&gt;
is the name of our custom login module class.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;The custom login module&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Our custom login module is a class derived from &lt;tt&gt;org.jboss.security.auth.spi.UsernamePasswordLoginModule&lt;/tt&gt;.&lt;br /&gt;
By derivating UsernamePasswordLoginModule we only need to implements the following methods :&lt;br /&gt;
- &lt;tt&gt;initialize()&lt;/tt&gt; : called by JBoss after creating a new instance of our login module&lt;br /&gt;
- &lt;tt&gt;validatePassword()&lt;/tt&gt; : called by JBoss each time a user try to login&lt;br /&gt;
- &lt;tt&gt;getRoleSets()&lt;/tt&gt; : called by JBoss after a user have been successfully authenticated to get the list of roles for this user&lt;br /&gt;
This is the code of our login module :&lt;br /&gt;
&lt;tt style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
public class CustomJBossLoginModule extends UsernamePasswordLoginModule {&lt;br /&gt;
&lt;br /&gt;
/* Regular expressions used for user login name */&lt;br /&gt;
private Pattern guestRegEx;&lt;br /&gt;
private Pattern userRegEx;&lt;br /&gt;
private Pattern adminRegEx;&lt;br /&gt;
/* Magic phrases used in place of user password */&lt;br /&gt;
private String userMagic;&lt;br /&gt;
private String adminMagic;&lt;br /&gt;
&lt;br /&gt;
/* Currently authenticated user roles */&lt;br /&gt;
private boolean isGuest;&lt;br /&gt;
private boolean hasUserRole;&lt;br /&gt;
private boolean hasAdminRole;&lt;br /&gt;
&lt;br /&gt;
/* called by JBoss when loading the login module */&lt;br /&gt;
@Override&lt;br /&gt;
public void initialize (&lt;br /&gt;
Subject subject,&lt;br /&gt;
CallbackHandler callbackHandler,&lt;br /&gt;
Map sharedState,&lt;br /&gt;
Map options) {&lt;br /&gt;
super.initialize (subject, callbackHandler, sharedState, options);&lt;br /&gt;
log.info (&quot;CustomJBossLoginModule : initialize&quot;);&lt;br /&gt;
&lt;br /&gt;
/* load the optional login module option */&lt;br /&gt;
String guestParam = (String)options.get (&quot;guestRegEx&quot;);&lt;br /&gt;
if (guestParam == null) {&lt;br /&gt;
guestParam = &quot;anonymous&quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* load the mandatory login module options */&lt;br /&gt;
guestRegEx = Pattern.compile (guestParam);&lt;br /&gt;
userRegEx = Pattern.compile ((String)options.get (&quot;userRegEx&quot;));&lt;br /&gt;
adminRegEx = Pattern.compile ((String)options.get (&quot;adminRegEx&quot;));&lt;br /&gt;
userMagic = (String)options.get (&quot;userMagic&quot;);&lt;br /&gt;
adminMagic = (String)options.get (&quot;adminMagic&quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public CustomJBossLoginModule () {&lt;br /&gt;
super ();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/* called by JBoss to validate a user password */&lt;br /&gt;
@SuppressWarnings (&quot;unchecked&quot;)&lt;br /&gt;
@Override&lt;br /&gt;
protected boolean validatePassword (String inputPassword, String expectedPassword) {&lt;br /&gt;
log.info (&quot;CustomJBossLoginModule : validatePassword for &quot; + getUsername ());&lt;br /&gt;
&lt;br /&gt;
/* validate the user name */&lt;br /&gt;
isGuest = guestRegEx.matcher (getUsername ()).matches ();&lt;br /&gt;
if (!isGuest) {&lt;br /&gt;
hasUserRole = userRegEx.matcher (getUsername ()).matches ();&lt;br /&gt;
if (!hasUserRole) {&lt;br /&gt;
hasAdminRole = adminRegEx.matcher (getUsername ()).matches ();&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* validate the password */&lt;br /&gt;
boolean validPassword = isGuest;&lt;br /&gt;
if (hasUserRole) {&lt;br /&gt;
validPassword = inputPassword.equals (&lt;br /&gt;
String.format (userMagic, getUsername ()));&lt;br /&gt;
} else if (hasAdminRole) {&lt;br /&gt;
validPassword = inputPassword.equals (&lt;br /&gt;
String.format (adminMagic, getUsername ()));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* save some informations for the application */&lt;br /&gt;
if (validPassword) {&lt;br /&gt;
Set&lt;principal&gt; principals = subject.getPrincipals ();&lt;br /&gt;
principals.add (new SimplePrincipal (getUsername ()));&lt;br /&gt;
principals.add (new SimplePrincipal (inputPassword));&lt;br /&gt;
principals.add (new SimplePrincipal (&quot;Hello from CustomJBossLoginModule&quot;));&lt;br /&gt;
principals.add (new SimplePrincipal (Boolean.toString (isGuest)));&lt;br /&gt;
principals.add (new SimplePrincipal (Boolean.toString (hasUserRole)));&lt;br /&gt;
principals.add (new SimplePrincipal (Boolean.toString (hasAdminRole)));&lt;br /&gt;
log.info (String.format (&quot;CustomJBossLoginModule : user %s authenticated (guest : %b, user : %b, admin : %b)&quot;,&lt;br /&gt;
getUsername (), isGuest, hasUserRole, hasAdminRole));&lt;br /&gt;
} else {&lt;br /&gt;
log.info (&quot;CustomJBossLoginModule : Invalid credentials&quot;);&lt;br /&gt;
}&lt;br /&gt;
return validPassword;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@Override&lt;br /&gt;
protected String getUsersPassword () throws LoginException {&lt;br /&gt;
return &quot;&quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* fill the role collection */&lt;br /&gt;
@Override&lt;br /&gt;
protected Group[] getRoleSets () throws LoginException {&lt;br /&gt;
SimpleGroup userRoles = new SimpleGroup (&quot;Roles&quot;);&lt;br /&gt;
if (isGuest)  {&lt;br /&gt;
userRoles.addMember (new SimplePrincipal (&quot;Guest&quot;));&lt;br /&gt;
}&lt;br /&gt;
if (hasUserRole) {&lt;br /&gt;
userRoles.addMember (new SimplePrincipal (&quot;User&quot;));&lt;br /&gt;
}&lt;br /&gt;
if (hasAdminRole) {&lt;br /&gt;
userRoles.addMember (new SimplePrincipal (&quot;Admin&quot;));&lt;br /&gt;
}&lt;br /&gt;
Group[] roleSets = { userRoles };&lt;br /&gt;
return roleSets;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;/principal&gt;&lt;/tt&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;Compilation&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
To compile this login module you need two .jar files from JBoss : &lt;tt&gt;jboss-common.jar&lt;/tt&gt; and &lt;tt&gt;jbosssx.jar.&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;Deployment&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Put the login module class in a .jar file and copy this archive to &lt;tt&gt;${JBOSS_HOME}/server/default/lib&lt;/tt&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;Getting informations about the user from the application&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
You (normally) have noticed that our login module save some informations in the collection of principals for the subject (the authenticated user).&lt;br /&gt;
This is needed to have this informations from our web applications or from our EJBs in a application-server independant way.&lt;br /&gt;
This is an example of a class that can be used to get this informations :&lt;br /&gt;
&lt;tt style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
public class AuthenticatedUserInformations  {&lt;br /&gt;
&lt;br /&gt;
public class InvalidUserException extends Exception {};&lt;br /&gt;
&lt;br /&gt;
/** The JACC PolicyContext key for the current Subject */&lt;br /&gt;
private static final String SUBJECT_CONTEXT_KEY =&lt;br /&gt;
&quot;javax.security.auth.Subject.container&quot;;&lt;br /&gt;
&lt;br /&gt;
private String username;&lt;br /&gt;
private String password;&lt;br /&gt;
private String hello;&lt;br /&gt;
private boolean isGuest;&lt;br /&gt;
private boolean isAdmin;&lt;br /&gt;
private boolean isUser;&lt;br /&gt;
&lt;br /&gt;
public AuthenticatedUserInformations () throws InvalidUserException {&lt;br /&gt;
Subject caller;&lt;br /&gt;
try {&lt;br /&gt;
caller = (Subject) PolicyContext.getContext (SUBJECT_CONTEXT_KEY);&lt;br /&gt;
if (caller == null) {&lt;br /&gt;
throw new InvalidUserException ();&lt;br /&gt;
}&lt;br /&gt;
Iterator&lt;principal&gt; it = caller.getPrincipals ().iterator ();&lt;br /&gt;
username = it.next ().getName ();&lt;br /&gt;
password = it.next ().getName ();&lt;br /&gt;
hello = it.next ().getName ();&lt;br /&gt;
isGuest = Boolean.valueOf (it.next ().getName ());&lt;br /&gt;
isUser = Boolean.valueOf (it.next ().getName ());&lt;br /&gt;
isAdmin = Boolean.valueOf (it.next ().getName ());&lt;br /&gt;
} catch (PolicyContextException e) {&lt;br /&gt;
throw new InvalidUserException ();&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public String getUsername () {&lt;br /&gt;
return username;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public String getPassword () {&lt;br /&gt;
return password;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public boolean isGuest () {&lt;br /&gt;
return isGuest;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public boolean isAdmin () {&lt;br /&gt;
return isAdmin;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public boolean isUser () {&lt;br /&gt;
return isUser;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;/principal&gt;&lt;/tt&gt;&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/gp/product/0596007345/ref=as_li_tf_il?ie=UTF8&amp;tag=vxp-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0596007345&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=0596007345&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=vxp-20&amp;ServiceVersion=20070822&quot; &gt;&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=vxp-20&amp;l=as2&amp;o=1&amp;a=0596007345&amp;camp=217145&amp;creative=399369&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important;&quot; /&gt;&lt;br /&gt;
&lt;/center&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 130%;&quot;&gt;&lt;span style=&quot;color: #663366;&quot;&gt;Web application example&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Finally, write a web application example to test our login module.&lt;br /&gt;
First, the &lt;tt&gt;web.xml&lt;/tt&gt; file must contain the classic security configuration elements :&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqj2GrNj8GQN45cWn0Do37qWBpCGOUoFuKHt6e6JOGjs4B4nJxl9XqVs6SlpkgwX1WXkpcFKvGvFRluPpnD5B8-ZuNhZgKIYaDMfb6HNJ6QABbdjlRgruRwMyUfGlT6q-FLmoHhvkNw-Q/s1600-h/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModule.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5049211565218963538&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqj2GrNj8GQN45cWn0Do37qWBpCGOUoFuKHt6e6JOGjs4B4nJxl9XqVs6SlpkgwX1WXkpcFKvGvFRluPpnD5B8-ZuNhZgKIYaDMfb6HNJ6QABbdjlRgruRwMyUfGlT6q-FLmoHhvkNw-Q/s400/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModule.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;Second, the &lt;tt&gt;jboss-web.xml&lt;/tt&gt; must declare the security domain :&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgujqMol0YgjV7P5ZBg3iTroKF0xg0Lle_Aru0xkwS9qLO5Ctp4XqU_2Aw80sRVO5iIrsQSf90b65RD3f3_wN2l7bvyRhyphenhyphenSzEs6S7hJGPnO0keRq4hmvT_MAJRa8LvSd3NKkB9qVJN5cqw/s1600-h/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModuleTest.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5049211835801903202&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgujqMol0YgjV7P5ZBg3iTroKF0xg0Lle_Aru0xkwS9qLO5Ctp4XqU_2Aw80sRVO5iIrsQSf90b65RD3f3_wN2l7bvyRhyphenhyphenSzEs6S7hJGPnO0keRq4hmvT_MAJRa8LvSd3NKkB9qVJN5cqw/s400/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModuleTest.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Third, a simple JSP page to demonstrate the use of the AuthenticatedUserInformations class.&lt;br /&gt;
In an empty JSP page add the following lines before the HTML body :&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrv8WwAnrOFL2WasTfQ5ibsWMEJYkJUNoD_E2A2ZpfzR3QPEnumzKir52oWwpLNOEdEER0oUv_3G7khEXqkZnUjPkTvt6F4p9f3cfLepxDStbMRkmQoDvuF5V_npw5em6p9h_jB_UK-Xo/s1600-h/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModuleTest-1.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5049212673320525938&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrv8WwAnrOFL2WasTfQ5ibsWMEJYkJUNoD_E2A2ZpfzR3QPEnumzKir52oWwpLNOEdEER0oUv_3G7khEXqkZnUjPkTvt6F4p9f3cfLepxDStbMRkmQoDvuF5V_npw5em6p9h_jB_UK-Xo/s400/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModuleTest-1.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;and some JSP and HTML code in the body :&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8modihq0bfCpzt64tzzYCRhxaMigYb1Jjvlc9XovRfDDrWdk5xFcFyj4yQlQxmb3eK-7FbmWYh_FQrWMALauhrlISy0KyhHGL4Y8Q41YYwhupQ0SK31zya1M25r1uAd30rk8pG8kZprc/s1600-h/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModuleTest-2.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5049212879478956162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8modihq0bfCpzt64tzzYCRhxaMigYb1Jjvlc9XovRfDDrWdk5xFcFyj4yQlQxmb3eK-7FbmWYh_FQrWMALauhrlISy0KyhHGL4Y8Q41YYwhupQ0SK31zya1M25r1uAd30rk8pG8kZprc/s400/Capture-NetBeans+IDE+5.5+-+JBossCustomLoginModuleTest-2.png&quot; style=&quot;cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;&quot; /&gt;&lt;/a&gt;Deploy your application and give it a try !</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/4109290906788307096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/4109290906788307096' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/4109290906788307096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/4109290906788307096'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2007/04/jboss-custom-login-module-simple.html' title='JBoss custom login module : a simple example'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcND-AnSnwnUkLUb0W1PE1hDZbtrky6rlZ1Lqn_yZ097w94sddxFcjbCL_dHQBBqKvno23zirY9ZB8evvEFvRwkUK9NH2bD0aXnag_AlXvaxdBVXPNOHCqLa0U-KHvd8hN_uSgpw2VZes/s72-c/Capture-NetBeans+IDE+5.5.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-4099611840467810269</id><published>2006-12-01T22:16:00.001+00:00</published><updated>2008-03-05T10:08:03.716+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="j2ee"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="javaee"/><category scheme="http://www.blogger.com/atom/ns#" term="jboss"/><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>Eclipse+JBoss Error : &quot;transport error 202&quot;</title><content type='html'>I get the following error when starting JBoss 4.0.5 from Eclipse/JBossIDE :&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;ERROR: transport error 202: gethostbyname: unknown host [&quot;transport.c&quot;,L41]&lt;br /&gt;ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) [&quot;debugInit.c&quot;,L500]&lt;br /&gt;JDWP exit error JVMTI_ERROR_INTERNAL(113): No transports initializedFATAL ERROR in native method: JDWP No transports initialized, jvmtiError=JVMTI_ERROR_INTERNAL(113)&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;Since this error only appears when starting JBoss when connected to my home network and not at work, I suspected a DNS/Resolver problem.&lt;br /&gt;To correct the problem, just add the following line to &lt;code&gt;/etc/hosts&lt;/code&gt; :&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;127.0.0.1        localhost&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;Apparently the problem appears only when launching the Eclipse debugger and is not linked with JBoss.</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/4099611840467810269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/4099611840467810269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/4099611840467810269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/4099611840467810269'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2006/12/eclipsejboss-error-transport-error-202.html' title='Eclipse+JBoss Error : &quot;transport error 202&quot;'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-602727619628438765</id><published>2006-11-30T12:00:00.000+00:00</published><updated>2006-11-30T12:24:04.420+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="fedora"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="software"/><category scheme="http://www.blogger.com/atom/ns#" term="vmware"/><title type='text'>WMWare : &quot;End of error message&quot;</title><content type='html'>A great error message from VMWare server :&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/x/blogger2/3155/739733968128825/1600/207357/Capture-Error.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;&quot; src=&quot;http://photos1.blogger.com/x/blogger2/3155/739733968128825/320/401688/Capture-Error.png&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&quot;End of error message&quot;.... very usefull !&lt;br /&gt;To view the real error message, just check the &lt;code&gt; /var/log/vmware/vmware-serverd.log&lt;/code&gt; file :&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;Msg_Post: Could not open /dev/vmmon: No such file or directory.&lt;br /&gt;Nov 30 12:59:53: app| Please make sure that the kernel module `vmmon&#39; is loaded.&lt;br /&gt;Nov 30 12:59:53: app|&lt;br /&gt;Nov 30 12:59:53: app| Msg_Post: Error&lt;br /&gt;Nov 30 12:59:53: app| [msg.vmmonPosix.initFailed] Failed to initialize monitor device.&lt;br /&gt;Nov 30 12:59:53: app| [localized] Failed to initialize monitor device.&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;Ooops, the VMWare service (which create &lt;code&gt;/dev/vmmon&lt;/code&gt; and other devices) was not started :&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;# sudo service vmware start&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/602727619628438765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/602727619628438765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/602727619628438765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/602727619628438765'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2006/11/wmware-end-of-error-message.html' title='WMWare : &quot;End of error message&quot;'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6059900666911337555.post-8761869990448907631</id><published>2006-11-27T13:08:00.000+00:00</published><updated>2006-11-27T14:37:54.067+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="pgworksheet"/><category scheme="http://www.blogger.com/atom/ns#" term="postgresql"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="software"/><title type='text'>Introducing PgWorksheet</title><content type='html'>&lt;a href=&quot;http://pgworksheet.projects.postgresql.org/&quot;&gt;PgWorksheet&lt;/a&gt; is a simple GUI frontend to PostgreSQL for executing SQL queries and psql commands without using the psql command line tool.&lt;br /&gt;&lt;br /&gt;Development of this tool have started at the &lt;a href=&quot;http://www.e-cml.org/&quot;&gt;E-CML&lt;/a&gt; Computer Science school for SQL and PL/SQL courses when Oracle was replaced by &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; for this courses.&lt;br /&gt;PostgreSQL was choosen in place of Oracle for several reasons :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Minimal server administration compared to the mammoth-style administration tasks requiered by Oracle&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Minimal CPU &amp;amp; memory footprint : Oracle needed a single server only for the courses. With PostgreSQL, the database was installed on the school main NFS/Samba/DNS/DHCP/VPN/... server.&lt;/li&gt;&lt;li&gt;No need to install a mammoth-sized client to have a simple GUI client to execute simples SQL queries.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;This last point is also an important problem with PostgreSQL at the time of the switch : the total lack of a simple, light, easy to install, open source, free GUI client.&lt;br /&gt;While PostgreSQL offers some great administration tools (&lt;a href=&quot;http://www.pgadmin.org/&quot;&gt;PgAdmin&lt;/a&gt;, &lt;a href=&quot;http://phppgadmin.sourceforge.net/&quot;&gt;phpPgAdmin&lt;/a&gt;) there are administration tools, not just SQL scratch pads.&lt;br /&gt;&lt;br /&gt;Since the main GUI tool used during SQL courses with Oracle was SQLWorksheet, we started to explore the web to find an identical tool for PostgreSQL. We found only one application fullfiling our requirements, &lt;a href=&quot;http://sourceforge.net/projects/pgst/&quot;&gt;pgst.&lt;/a&gt; But pgst have an important problem : despite the fact that is was written in Python, pgst was not portable and needed some important modifications to run under Microsoft Windows.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://pgworksheet.projects.postgresql.org/&quot;&gt;PgWorksheet&lt;/a&gt; started as a re-implementation of some ideas of pgst, written from scratch, but with portability in mind since we have 3 different operating system used during the courses : FreeBSD, Linux Fedora and Microsoft Windows.&lt;br /&gt;&lt;br /&gt;Now &lt;a href=&quot;http://pgworksheet.projects.postgresql.org/&quot;&gt;PgWorksheet&lt;/a&gt; version 1.8 offers several, but limited to provide easy of use, fonctionnalities :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;portability (runs on *BSD, all Linux distribs and Microsoft Windows XP)&lt;/li&gt;&lt;li&gt;syntax coloring&lt;/li&gt;&lt;li&gt;load/save SQL queries&lt;/li&gt;&lt;li&gt;SQL queries history&lt;/li&gt;&lt;li&gt;unlimited undo/redo&lt;/li&gt;&lt;li&gt;display of SQL queries results separated (one tab for one query)&lt;/li&gt;&lt;li&gt;server connection history&lt;/li&gt;&lt;/ul&gt;The PgWorksheet project is hosted by &lt;a href=&quot;http://pgfoundry.org/projects/pgworksheet/&quot;&gt;PgFoundry&lt;/a&gt; and the &lt;a href=&quot;http://pgworksheet.projects.postgresql.org/&quot;&gt;PgWorksheet&lt;/a&gt; sources are hosted by &lt;a href=&quot;http://sourceforge.net/projects/pgworksheet&quot;&gt;SourceForge&lt;/a&gt; (you can &lt;a href=&quot;http://pgworksheet.cvs.sourceforge.net/pgworksheet/&quot;&gt;browse source code&lt;/a&gt;)</content><link rel='replies' type='application/atom+xml' href='http://x-techteam.blogspot.com/feeds/8761869990448907631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6059900666911337555/8761869990448907631' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/8761869990448907631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6059900666911337555/posts/default/8761869990448907631'/><link rel='alternate' type='text/html' href='http://x-techteam.blogspot.com/2006/11/introducing-pgworksheet.html' title='Introducing PgWorksheet'/><author><name>HM</name><uri>http://www.blogger.com/profile/15314161484458836048</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-RCZ2mlbmVd0/TpgZlCf1LyI/AAAAAAAAAbo/CXeSJw4Tp64/s220/icon-software-development.jpg'/></author><thr:total>2</thr:total></entry></feed>