Satya Aravind Kopparthi Weblog

02/11/2009

tomcat – configure SSL/HTTPS

Filed under: tomcat — Tags: , , — akopparthi @ 10:18 pm
  1. >cd $CATALINA_HOME
  2. $JAVA_HOME/keytool -genkey -alias tomcat -keyalg RSA -keystore mycert.jks
  3. Enter keystore password: changeit
  4. What is your first and last name? : Aravind Kopparthi
  5. What is the name of your organizational unit? [Unknown]: CAT
  6. What is the name of your organization? [Unknown]: GOOGLE
  7. What is the name of your City or Locality? [Unknown]: FL
  8. What is the name of your State or Province? [Unknown]: FL
  9. What is the two-letter country code for this unit? [Unknown]: US
  10. US Is CN=Danesh Manoharan, OU=IT, O=”My Comp.”, L=KL, ST=KL, C=MY correct? [no]: yes
  11. Enter key password for (RETURN if same as keystore password): Hit Enter.

Tomcat will assume the password is “changeit” by default so it’s advised to leave it that way. Now let’s tell Tomcat to use the keystore file.

  1. cd $CATALINA_HOME/conf/
  2. vi server.xml
  3. Look for “<!– Define a SSL HTTP/1.1 Connector on port 8443 –>”. Remove the <!– –> comments indicator and add the keystore info.

<!– Define a SSL HTTP/1.1 Connector on port 8443 –>
<Connector port=”443” maxHttpHeaderSize=”8192″
maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”false” disableUploadTimeout=”true”
acceptCount=”100″ scheme=”https” secure=”true”
keystoreFile=”/opt/Tomcat5/mycert.jks
clientAuth=”false” sslProtocol=”TLS” />

Time to restart Tomcat and test.

  1. cd $CATALINA_HOME/bin/
  2. ./shutdown.sh to make sure Tomcat is down.
  3. ./startup.sh to start Tomcat.
  4. Fire up your browser and test your new https site. https://localhost:9080/

Tomcat – Use catalina servlet to disable file listing…

Filed under: tomcat — Tags: — akopparthi @ 10:12 pm

1. Edit the default servlet in the {$CATALINA_HOME}/conf/web.xml file.

2. Look for the <init-param> section within the <servlet section>

<servlet>
<servlet-name>default</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

3. Change the <param-value> to false for the <param-name>listing</param-name> section.

<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>

01/04/2009

Cutsomizing RichFaces skins

Filed under: Uncategorized — akopparthi @ 10:53 am

RichFaces comes with the following skins:

* DEFAULT
* plain
* emeraldTown
* blueSky
* wine
* japanCherry
* ruby
* classic
* deepMarine
* NULL

To use a skin, all you need to do is set the name in web.xml file:

org.richfaces.SKIN
ruby

Suppose you like the skin, but you want to make some small changes to it. Here is what to do.

1. Unzip richfaces-impl-3.2.x.GA.jar file. All the skin files are under META-INF/skin
2. Take the skin you want to modify and save it under a different name in resources folder for Maven developers or under class path for others. For example rubycustom.skin.properties
3. Open the file and change the parameter you need. For example

headerBackgroundColor=#FFFFFF

then just set the new skin in web.xml file:

org.richfaces.SKIN
mySkin

Save and restart the server.

Starting with RichFaces 3.2.1, this process has become simpler. You still create a new custom skin file under Java source, and specify which skin to extend:

baseSkin=ruby

this means the skin is based on ruby skin. Next, you just over write the parameter that you need. In this example, it would look like this:

baseSkin=ruby
headerBackgroundColor=#FFFFFF

01/01/2009

JSF can handle GET requests as any other Web Frameworks : using shale-view

Filed under: Uncategorized — akopparthi @ 2:29 pm

1.  Add shale-view, shale-application and shale-core jars deprendcies  to your pom

2. Define Shale filter in web.xml

<filter>
<filter-name>shale</filter-name>
<filter-class>
org.apache.shale.application.faces.ShaleApplicationFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>shale</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

3. manage your managed beans in faces-config.xml

<managed-bean>

<managed-bean-name>backing</managed-bean-name>

<managed-bean-class>com.foo.BackingBean</managed-bean-class>

<managed-property>

<property-name>personId</property-name>

<value>#{param.personId}</value>

</managed-property>

</managed-bean>

4. Extend your managed bean with Shale AbstractViewController or ViewController  and write business logic in prerender method.

public class BackingBean implements ViewController {

private int personId;

public int getPersonId() { return this.personId; }

public void setPersonId(int personId) { this.personId = personId; }

public void prerender() {

// By the time you get here, personId has aready

// been converted and injected, so use it to go look

// up the relevant information

}

}

04/17/2008

Flex

Filed under: Uncategorized — akopparthi @ 6:43 am

  • Working with the Flash Player cache
  • The Flash Player cache is a new feature available in Flash Player 9 Update 3 (9,0,115,0). The cache allows files signed by Adobe to be cached by Flash Player. These files end in the file extension .swz.
    The Flash Player cache differs from the browser cache in some useful ways. Because the cached SWZ files are signed by Adobe, they can be reused in more than one domain and are not limited to reuse within the domain in which they originated. For example, imagine that framework.swz is loaded from http://www.a.com and is placed in the cache of Flash Player. If the same framework.swz file needs to be downloaded from http://www.b.com, Flash Player looks in its cache to find a.com’s framework.swz file. When it finds a match, it uses the cached file rather than loading a new file from b.com


  • 04/14/2008

    IBM Dynamic Application Virtualization

    Filed under: Websphere — Tags: , , — akopparthi @ 6:47 pm
    Before we begin understanting Dynamic Application Virtualization, Let’s refresh virtualization first.

    Virtualization. The big Buzzword in computer system management . But what is virtualization?

    There are several ways of virtualization in the IT business.

    Quote from Wikipedia: “In computing, virtualization is a broad term that refers to the abstraction of computer resources.” Another useful definition is “a technique for hiding the physical characteristics of computing resources from the way in which other systems, applications, or end users interact with those resources. This includes making a single physical resource (such as a server, an operating system, an application, or storage device) appear to function as multiple logical resources; or it can include making multiple physical resources (such as storage devices or servers) appear as a single logical resource.”

    First, let’s categorize the different types of virtualization:

    1. Hardware Virtualization
    2. Presentation Virtualization
    3. Connectivity Virtualization
    4. Application Virtualization

    Presentation Virtualization

    In 2008 a new player comes to that market to provide application sharing without a Terminal server. You simply need a Windows XP machine, SVS, DAV (codename of the product) and an Internet connection.

    Users get access to a website where they have to logon, and they have full access to all the applications that they share.

    What is IBM Dynamic Application Virtualization?

    IBM® Dynamic Application Virtualization provides the ability to off-load function calls in a computationally intensive application to remote, high-performance computation nodes, thereby significantly reducing time to deployment, with minimal code changes and disruption to business.

    In financial services, IBM Dynamic Application Virtualization can help developers to quickly deploy new applications that take advantage of accelerated math libraries running on new or remote hardware systems. In particular, where original applications were not written to offload calculations to remote hardware, IBM Dynamic Application Virtualization can be used to prepare the application for invoking remote libraries, thereby avoiding a re-writing or customization of the original code base.

    Specifically, this technology can cut down overall time to deployment for business-critical applications that require ultra-high speed and low latency; such applications include options pricing (for example, Monte Carlo simulations) and FIX message parsing. In the past, such applications may have required significant application development time, prolonging the potential for a return on new investment, sometimes making the project cost-prohibitive. By using IBM Dynamic Application Virtualization to call the remotely deployed application functions residing on high-performance computation nodes, combined with the low-latency infrastructure provided by IBM Dynamic Application Virtualization, application calculation times can also be reduced.

    The technology virtualizes application libraries by examining the library’s exported functions and capturing additional semantics. Library functions, when invoked from an application, appear to be executed locally, insulating developers from the specifics of the computation nodes and reducing the effort involved in calling remote functions.

    IBM Dynamic Application Virtualization supports applications written in C/C++, Java™, and Excel spreadsheets (Visual Basic Application (VBA)), and it harnesses the power of the IBM BladeCenter® QS2X with Cell Broadband Engine™. The technology promotes heterogeneous adaptation; that is, it allows client applications running on one architecture (such as Intel®/Windows® XP) to execute functions hosted on a different architecture (such as Cell Broadband Engine).

    How does it work?

    IBM Dynamic Application Virtualization consists of an Eclipse plug-in called Tooling that virtualizes an application library by generating the appropriate client- and server-side code from the library specification (a C .h file).The Eclipse CDT is used to parse the customer library header file, and the user specifies additional semantics (such as array lengths). This latest update of IBM Dynamic Application Virtualization provides a semantics verifier within the Tooling plug-in that allows the library provider to test and verify the specified semantics locally before generating and deploying the server-side code. The Tooling component of IBM Dynamic Application Virtualization allows the generated client-side code to be linked with the client application, it builds the server-side code, and then this server-side code is deployed to the computation nodes.

    The client-side code then prepares a computational request and sends it to the service broker, which selects an available computation node, passing the function parameters to the generated server-side code on the selected node. This generated server-side code invokes the application library to perform the actual computation. On completion, the result is sent back to the client application through the client-side generated code.

    Also new in this update are support for requests from Linux® clients and the ability to run the Tooling component on a Linux client. Remote deployment is further simplified by a new tool that automates the distribution of Tooling-generated server-side code to computation nodes.

    References: http://www.alphaworks.ibm.com

    http://juice.altiris.com

    01/01/2008

    Use Heterogeneous Services to access non-Oracle data

    Filed under: oracle — akopparthi @ 1:40 pm

    Oracle’s Heterogeneous Services (HS) allows users to access data stored outside Oracle as if the data were in a local Oracle table. It can be intimidating setting up HS in Oracle SQL*Net.

    1. Install ODBC drivers for the SQL*Server database. The drivers are installed on your laptop or on the server that contains the Oracle code tree.
    2. Setup the ODBC connection on your laptop using the Windows ODBC Data Source Administrator
    3. Test the ODBC drivers to ensure that connectivity is made to the non-Oracle database.
    4. Ensure the Global_names parameter is set to False in the Oracle database.
    5. Configure the Hetergeneous services. This consists of creating an initodbc.ora file within the Oracle Oracle database installation.
    7. Modify the Listener.ora file on the database installation to connect to the Oracle instance and ODBC drivers.
    8. Modify the Tnsnames.ora file to point to the proper code tree.
    9. Reload the listener
    10. Create a database link on the Oracle installation.
    11. Run a Select statement for the Oracle installation using the database link.

    « Newer Posts

    Blog at WordPress.com.