The i-Technology Media!
Register | Log in
   
 
.NET  ·  AJAX  ·  CLOUD  ·  ECLIPSE  ·  FLEX  ·  OPEN WEB  ·  iPHONE  ·  JAVA  ·  LINUX  ·  OPEN SOURCE  ·  ORACLE  ·  PBDJ  ·  SEARCH  ·  SILVERLIGHT  ·  SOA  ·  VIRTUALIZATION  ·  WEB 2.0  ·  WIRELESS  ·  XML
Comments
Google Wave Invitation Giveaway
By Aditya Banerjee
Timo Hirvonen wrote: I would really appreciate an invitation. Been desperately trying to find one :) timo [dot] hirvonen [at] gmail [dot]com
Nov. 27, 2009 11:13 AM EST
Cloud Expo on Google News
Did you read today's front page stories & breaking news?


2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts

2009 East
GOLD SPONSORS:
CA
Get Your Transactions Under Control: SOA Performance Management
Software AG
Performance Driven Adoption: The Secret to Advancing SOA
Intel
The Evolving SOA Appliance: 3 Game-Changing Innovations
SILVER SPONSOR:
Denodo
Data Mashups: Deliver Your Project Faster with Virtualized Data Services Across Internal & External Sources
POWER PANELS:
The Business Value of Service Orientation
Driving Profitability Through User Experience
Click For 2008 West
Event Webcasts
Live Google News by SYS-CON!
Top Three Links You Must Click On


Ajax Proxy for Web 2.0 Feature pack - quick look

By: Kevin Haverlock
Dec. 2, 2008 03:59 PM

The security model of modern browsers dictate that XMLHttpRequests (Dojo.xhr style requests if using the Dojo Toolkit) must have the same domain in order to connect and exchange data. From a security perspective, that is a good thing and helps make your web application secure from outside influence. The problem is that it makes cross site mashup creation downright difficult.

There are a couple of options that have been proposed:

Flash: A proprietary solution that requires learning Adobe's programming model. Requires the deployment of a crossdomain.xml file.

JSONP: proposed by Bob Ippolito, JSONP is a script tag injection which passes the response from the server (normally JSON) into a user specified function.

Proxy: Using a service that marshals requests to the server. Since the Proxy is located on the same domain, the content appears to originate from the same server.

Lets look at the proxy option as a it relates to the Web 2.0 Feature Pack for WebSphere Application server. The Ajax proxy is a lightweight proxy application that is used by Ajax clients to issue out of domain requests. As an example, your web application may access various RSS sites outside of the your original domain to display current news information.

Under the covers the Ajax proxy uses Apache's HTTPClient to handle connecting to other servers and passing the results back to the Ajax client. On top of HTTPClient is code that provides a configuration interface that can be used to tailor the proxy. The customization include context mapping, white-listing, filtering based on cookies, mime-type, HTTP verbs (POST, GET, etc). The end result is a highly customizable Servlet proxy that can be embedded into your JEE application to provide proxy services. At the heart of the Ajax proxy is the proxy-config.xml configuration file. The configuration file is located in your WEB-INF/ directory of the Ajax Proxy WAR file.

The listing shows a basic proxy configuration that is used to access two services. In this case Yahoo's and CNN's RSS feeds. Lets walk through the configuration.

<?xml version="1.0" encoding="UTF-8"?>
<proxy:proxy-rules  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:proxy="http://www.ibm.com/xmlns/prod/sw/ajax/proxy-config/1.0">
	    
    <proxy:mapping contextpath="/rss/tech"          url="http://rss.news.yahoo.com" />    
    <proxy:mapping contextpath="/rss/cnn_world.rss" url="http://rss.cnn.com" />
            
    <proxy:policy url="http://rss.news.yahoo.com/*" acf="none"> 
        <proxy:actions>
	    <proxy:method>GET</proxy:method>
	</proxy:actions>  
    </proxy:policy>
    
    <proxy:policy url="http://rss.cnn.com/*" acf="none">
       <proxy:actions>
	    <proxy:method>GET</proxy:method>
	   </proxy:actions>  
    </proxy:policy>       

    <proxy:meta-data>
         <proxy:name>maxconnectionsperhost</proxy:name>
         <proxy:value>2</proxy:value>
	</proxy:meta-data>	
     <proxy:meta-data>
         <proxy:name>maxtotalconnections</proxy:name>
         <proxy:value>5</proxy:value>
	</proxy:meta-data>	

The <proxy:mapping> sets the contextpath for the URL of the service you are connecting too. As an example, if you are trying to access http://rss.news.yahoo.com/rss/tech from your site, then the contextpath would be /rss/tech and the matching URL would be http://rss.news.yahoo.com. When it comes time to access the service through the proxy, you would use the <servlet-mapping>

	<servlet-mapping>
		<servlet-name>ProxyServlet</servlet-name>
		<url-pattern>/proxy/*</url-pattern> 		
	</servlet-mapping>

combined with the context root mapping of mysite. As an example, if the Ajax proxy Servlet is accessed from http://localhost/mysite/proxy then the URL for Yahoo's news service would be http://localhost/mysite/proxy/rss/tech.

The <proxy:policy> defines a policy to be used against the URL. In the case of http://rss.news.yahoo.com, the <proxy:method> states that only a HTTP GET request is supported on the URL. Other requests, such as POST will be rejected by the Ajax proxy. In addition >proxy:method<, other rules can be applied such as preventing cookies, allowing only certain mime-types and http headers.

Additionally, performance tuning can also be done against the Ajax proxy. The parameters correspond to those that are available Apache's HTTPClient and can be used to fine tune the Ajax proxy. The <proxy:meta-data> contain optional parameters. The maxconnectionsperhost is a global value that specifies the maximum number of connections kept alive for any host or port combination and can be increased if your site access more than two remote sites for content. The maxtotalconnections is the maximum total of connections supported by the proxy. The default value is 5. The value you choose must be a high enough to support the number of simultaneous connections you might receive. In reality, the maximum connections will also be dependent on how WebSphere's Web container is configured.

There are additional parameters as well, including unsigned SSL certificate support, pass-through proxy support (in case the Ajax proxy needs to authenticate through a border firewall before accessing the network). Information and parameters are available with the documentation and can be found online through IBM's InfoCenter for the Web 2.0 Feature Pack.

Kevin Haverlock

Read the original blog entry...

Published Dec. 2, 2008— Reads 503
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
About Kevin Haverlock
Kevin Haverlock is an advisory software engineer for IBM's WebSphere Application Server product. He joined IBM in 1995 at Research Triangle Park, NC, where he worked as a developer for the Tivoli division. In 2000 he transferred to the WebSphere Application Server organization and is currently an architect and developer for the WebSphere Application Server Express product.

Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers

ADS BY GOOGLE

Breaking Java News
Platinex and Ontario Continue Discussions Over Big Trout Lake Property
Garson Gold Announces Filing of Audited Financial Statements for the Year Ended July 31, 2009
Khan Acknowledges ARMZ Intention to Make an Unsolicited Offer
Killdeer Minerals Announces Financing With MineralFields Group
West Street Announces Third Quarter Results
Homeland Uranium Inc. Reprices Options
South American Silver Corp. Completes $2.78 Million Financing
Stone Resources Limited Announces Resignation of Directors
L.A.'s West 3rd Street to Launch Public Valet Service Tomorrow

ADVERTISE   |   MAGAZINE SUBSCRIPTIONS   |   FREE BREAKING-NEWSLETTERS!   |   SYS-CON.TV   |   BLOG-N-PLAY!   |   WEBCAST   |   EDUCATION   |   RESEARCH

.NET Developer's Journal - .NETDJ   |   ColdFusion Developer's Journal - CFDJ   |   Eclipse Developer's Journal - EDJ   |   Enterprise Open Source Magazine - EOS
Open Web Developer's Journal - OPENWEB   |   iPhone Developer's Journal - iPHONE   |   Virtualization - Virtualization   |   Java Developer's Journal - JDJ   |   Linux.SYS-CON.com
PowerBuilder Developer's Journal - PBDJ   |   SEO / SEM Journal - SJ   |   SOAWorld Magazine - SOAWM   |   IT Solutions Guide - ITSG   |   Symbian Developer's Journal - SDJ
WebLogic Developer's Journal - WLDJ   |   WebSphere Journal - WJ   |   Wireless Business & Technology - WBT   |   XML-Journal - XMLJ   |   Internet Video - iTV
Flex Developer's Journal - Flex   |   AJAXWorld Magazine - AWM   |   Silverlight Developer's Journal - SLDJ   |   PHP.SYS-CON.com   |   Web 2.0 Journal - WEB2
Apache   |   CMS   |   CRM   |   HP   |   Oracle Journal   |   Perl   |   Python   |   Red Hat   |   Ruby on Rails   |   SAP   |   SaaS

SYS-CON MEDIA:   ABOUT US   |   CONTACT US   |   COMPANY NEWS   |   CAREERS   |   SITE MAP
SYS-CON EVENTS:   |  AJAXWorld Conference & Expo  |  iPhone Developer Summit  |  Cloud Computing Conference & Expo  |  SOA World Conference & Expo  |  Virtualization Conference & Expo
INTERNATIONAL SITES:   India  |  U.K.  |  Canada  |  Germany  |  France  |  Australia  |  Italy  |  Spain  |  Netherlands  |  Brazil  |  Belgium
 Terms of Use & Our Privacy Statement     About Newsfeeds / Video Feeds
Copyright ©1994-2008 SYS-CON Publications, Inc. All Rights Reserved. All marks are trademarks of SYS-CON Media.
Reproduction in whole or in part in any form or medium without express written permission of SYS-CON Publications, Inc. is prohibited.
 
close this window