Wednesday, December 26, 2012

Lookup request scope ATG components from non ATG web application present in ear that contain ATG web application

Problem Statement: In an ear, there are two web applications, one is ATG web application(say "atgWeb") and 2nd without ATG (i.e a normal j2ee web application).


As both are part of same ear, and if I want to look-up ATG Components from non ATG web application, how I can do it ?


Ans:-

For Global scope components :
               
Nucleus.getGlobalNucleus().resolveName(componentPath);


For request/session scope Components :
       For Request/session scope components, dynamo request is required. If ATG pipeline is placed in the web application, Dynamo request will already be there. But in this case we are trying to get request scope component from Non ATG web application so we don't have dynamo request.

To convert http request to HttpDynamoRequest do the following.


  1. Get Servlet context of atg web app.
  2. Pass it to ServletUtil api of ATG to convert http request to DynamoRequest

ServletContext sc=request.getSession().getServletContext().getContext("/atgWeb");
DynamoHttpServletRequest dynamoRequest=ServletUtil.getDynamoRequest(sc,request,response);

By using DynamoRequest's methods you can resolve component.       

Monday, November 19, 2012

How to bipass proxy on weblogic for internal http calls.

Set following property in startWebLogic.cmd file


set JAVA_OPTIONS=%JAVA_OPTIONS% -Dhttp.nonProxyHosts="localhost"