Mahol Dot Org

Icon

Weblog For All Your Need

Spotcloud Buy Or Sell Unused Cloud Space Best Price Service From IaaS Enomaly ECP Provider

This is one good example of cloud IaaS (infrastructure as service). SpotCloud is the first commercial cloud computing clearing house and spot market service. Spotcloud is cloud capacity clearing house, a secure central platform for buying or selling unused cloud capacity based on location cost and capacity.

Spot New Cloud Capacity Providers

For Buyers: The SpotCloud marketplace provides a singular point of access to discover an extensive global network of cloud infrastructure providers. This service is like pre-paid mobile phones service, ie pay first to use but good thing is no need to pay extra for bandwidth, storage, etc
You need to use a Google Account & Email address.
For now this service is offered without SLA, reason they quote is “to keep the costs as low as possible the service is offered without any SLA, direct support or guarantees.”
For Sellers: The SpotCloud Clearing House empowers service providers to sell unused cloud capacity enabling increased utilization and revenue.
What is the minimum requirements for Sellers to offer capacity?
Decent bandwidth / connectivity, a compatible IaaS platform and at least 80 cores, (5 – 10 servers).
Cloud Capacity ClearingHouse(A clearing-house is an intermediary service which facilitates and simplifies transactions among multiple parties for the purpose of selling excess or unused computing capacity. )

Other services include Hotwire.com and Priceline.com, Google’s Adwords, Adsense and double-click exchange platform.

Enomaly ECP Service Provider Edition is a complete “cloud in a box” solution, enabling telcos and hosting providers to deliver revenue-generating Infrastructure-on-demand (IaaS) cloud computing services.

Number of View :585

An Introduction To SOA Basics Service Oriented Architecture As Developers Persepstive

I was reading this article, An Introduction to Service-Oriented Architecture from a Java Developer Perspective. To build service-oriented applications.

SOA Designed To change

For me difference between typical development and SOA based development is, Typical approach is designed to LAST, SOA based approach is designed to CHANGE. Meaning, once development is done, and as its working don’t touch it, in SOA approach, if one value needs to be changed its designed for that.

Evolve Around Business Object

Typical development is concentrated around CODE, SOA approach focuses for process and business object. If one business object is in use then how that business object will be re-usable, what are changes needed in that, eg. If Hiring management needs process as an business object to be applied in Sales management then what changes, what level of authentication and such changes are required. Such Approach in used while designing SOA based architectures.
Well there is always room for improvement.
And Good News is that, Successful SOA adoption is done incrementally.

What is SOA?

You well get many definitions and descriptions for SOA, I like this defination, SOA enables the development of applications that are built by combining loosely coupled and interoperable services.
In short for me SOA involves following things.

  1. Development,
  2. Integration,
  3. Infrastructure management.

SOA Standards?

Service Oriented Architecture (SOA) represents a collection of best practices principles and patterns related to service-aware, enterprise-level, distributed computing. SOA standardization efforts at OASIS focus on workflows, translation coordination, orchestration, collaboration, loose coupling, business process modeling, and other concepts that support agile computing. OASIS standard named Business Process Execution Language (BPEL); most platform vendors are adhering to this standard. BPEL is essentially a programming language but is represented in XML.

Few Reference SOA arcitectures.

SOA Reference Architecture from IBM

SOA Workrooms

SOA Work Group

Do share your experience about developing your first service-oriented applications.

Number of View :552

How To Get The Parameters From One Servlet To Another Using Request

Access Parameters From One Servlet To Another

Parameters can only be set from the web.xml file or can be input from a user input through a view. It cannot be set from the servlet code. Once we have accessed the required parameter/parameters in one servlet,we can set a particular attribute and set that very attribute with the accessed value of parameter and it can be accessed through out various pages depending upon the type and nature and scope of the attributes .Here it must be noted that attributes and only attributes can be set with a value from code and not the parameters. So if we want to access a parameter from one one servlet to another,we must first access it in one servlet ,set an attribute with its value and then we can access it in other servlet.If the scope of attribute is request it will exist till request exists,if session then till session and if servletcontext then once set it can be accessed through the application. But the parameters can be read only once when taken from user input. The following code demonstrates this :

<servlet>

<servlet-name>FirstServlet</servlet-name>

<servlet-class>myjobs.FirstServlet</servlet-class>

<init-param>

<param-name>username</param-name>

<param-value>john</param-value>

</init-param>

</servlet>

<servlet>

<servlet-name>SecondServlet</servlet-name>

<servlet-class>myjobs.SecondServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>NewServlet</servlet-name>

<url-pattern>/NewServlet</url-pattern>

</servlet-mapping>

FirstServlet :

public class FirstServlet extends HttpServlet {

/**

* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.

* @param request servlet request

* @param response servlet response

* @throws ServletException if a servlet-specific error occurs

* @throws IOException if an I/O error occurs

*/

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType(“text/html;charset=UTF-8″);

PrintWriter out = response.getWriter();

try {

String uname=getServletConfig().getInitParameter(“username”);

request.setAttribute(“usrname”,uname);

request.getRequestDispatcher(“SecondServlet”).forward(request, response);

} finally {

out.close();

}

}

}

Second Servlet :

public class SecondServlet extends HttpServlet {

/**

* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.

* @param request servlet request

* @param response servlet response

* @throws ServletException if a servlet-specific error occurs

* @throws IOException if an I/O error occurs

*/

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType(“text/html;charset=UTF-8″);

PrintWriter out = response.getWriter();

try {

/* TODO output your page here*/

out.println(“<html>”);

out.println(“<head>”);

out.println(“<title>Servlet SecondServlet</title>”);

out.println(“</head>”);

out.println(“<body>”);

out.println(“<h1>Parameter from first servlet is ” + request.getAttribute(“usrname”) + “</h1>”);

out.println(“</body>”);

out.println(“</html>”);

} finally {

out.close();

}

}

}

Here we are getting the paramter in FirstServlet setting an attribute and accessing in another servlet called SecondServlet.

Number of View :2025

How To Set Environment Variable When Debugging Using Microsoft Visual Studio 2008

Set up project properties environment variable

I am new to microsoft windows visual studio 2008 IDE , Was looking for How to set environment variables when debugging in Visual Studio?
My project is in c/c++ windows console application.

Set Environment Variables in VS2008

Here are few simple steps to add environment variable.

  1. Open your project.
  2. Go to Project>Properties or pres Alt+F7
  3. Under Configuration Properties>Debugging, edit the ‘Environment’ value to set environment variables.

I wanted to set and add the directory “C:\Program Files\Hummingbird\Connectivity\13.00\Exceed” to the path when debugging app X applications, set the ‘Environment’ value to

PATH=%PATH%;C:\Program Files\Hummingbird\Connectivity\13.00\Exceed;C:\Program Files\Intel\Compiler\Fortran\10.1.021\IA32\Bin

And done.

Set System Wide Environment Variables in Windows PC

Other way to set up this is using system wide environment variable.

  1. Right click “My Computer”, Select properties
  2. Select the “advanced” tab
  3. Click the “environment variables” button
  4. In the “System variables” section, add the new environment variable that you desire
  5. “Ok” all the way out to accept your changes

Note : Visual Studio 2003 doesn’t allow you to set environment variables for debugging. In this case one can use _putenv function.
source – Windows Sysinternals: Documentation, downloads and additional resources

Number of View :694

How To Redirect From One Servlet To Another Servlet Basics Servlet Redirect

Redirect to Other Servlets

Here we will talk about how to redirect from one servlet to another.Redirecting to a servlet is something like someone calls one for some work and the approached guy asks the person to call some other as he doesnot have the solution. It must be noted that the aproachee has to send the request to that other guy.The same thing happens in servlet redirecting as the request url changes and response comes form the servlet where request has been redirected. So,what can be done is write that very code in a servlet and that can be used at various places .The response object gives the method for redirect.The RequestDispacher class as the name suggests is the request delegater as it delegates the request but in redirect the request itself changes,so we can redirect the response to be given by another servlet.Iinside the doPost or doGet method.we can write the code to redirect in which the url for the servlet has to be given as a string..The example code is written below :

import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ResponseRedirect extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      ServletContext sc = this.getServletContext();
      response.senRedirect(“login”)
      }
      PrintWriter out = response.getWriter();
      out.print("Output after the content of login");
   }
}

Here we can see that redirection is occurring to login servlet in the ResponseRedirect servlet.In the redirection from one servlet to another we need to give the entry in <url-pattern> tag for the servlet as string.Once redirection happens the new request goes to login servlet,that means that client url changes and response comes from the login servlet as opposed to in the case of include or forward.With redirection we can move across applications and even across containers.Inside the servlet where redirection is happening,the rest of the code for the servlet will not be executed as the execution goes to the new redirected servlet.In the case of redirection we donot pass the request and response objects from the first servlet because new request and response is generated.

Number of View :713

how to forward from one servlet to another Servlet Essentials Servlet Forward

Forward to Servlets

Here we will talk about how to forward from one servlet to another.Forwarding to a servlet is something like someone calls one for some work and the approached guy asks some one for help and returns the result to the approachee. It must be noted that the aproachee always sees the response from the that same guy only whom he called.The same thing happens in servlet forwarding as the request url doesnot change and response always comes as it has come from the first servlet and not the forwarded one. So,what can be done is write that very code in a servlet and that can be used at various places.The forward basically is a dynamic .The RequestDispatcher class gives the method for forward.The RequestDispacher class as the name suggests is the request delegater. The RequestDispatcher instance can be get from the request object inside the doPost or doGet method.Here the request and response objects are passed as paramters from the servlet code where forward code is written.The example code is written below :

import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RequestDispatch extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      ServletContext sc = this.getServletContext();
      RequestDispatcher rDis = sc.getRequestDispatcher("/login");
      if (rDis != null){
          rDis.forward(request, response);
      }
      PrintWriter out = response.getWriter();
      out.print("Output after the content of login");
   }
}

Here we can see that request is forwarded to login servlet in the RequestDispatch servlet.In the getting of RequestDispatch instance from the request object we need to give the entry in <url-pattern> tag for the servlet as string.

Number of View :754

how to include one servlet into another Servlet Essentials Servlet Include

Include Servlets

Here we will talk about how to include one servlet into another.Including a servlet is as same as include that servlet`s code into the servlet in which it is included. This concept is used in places where we need to have reusable servlet codes which can be used at multiple places.Suppose we have some common code like login or some other logic which can be used at various places.So,what can be done is write that very code in a servlet and that can be used at various places.The inclusion basically is a dynamic inclusion which means the response of the included servlet is included in the includer servlet.The RequestDispatcher class gives the method for inclusion.The RequestDispacher class as the name suggests is the request delegater. The RequestDispatcher instance can be get from the request object inside the doPost or doGet method.Here the request and response objects are passed as paramters from the servlet code where inclusion code is written.The example code is written below :

import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RequestDispatch extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      ServletContext sc = this.getServletContext();
      RequestDispatcher rDis = sc.getRequestDispatcher("/login");
      if (rDis != null){
          rDis.include(request, response);
      }
      PrintWriter out = response.getWriter();
      out.print("Output after the content of login");
   }
}

Here we can see that login is included in the RequestDispatch servlet.In the getting if RequestDispatch instance from the request object we need to give the entry in <url-pattern> tag for the servlet.Then we can find that if we are printing anything from the included the servlet it will appear when we run RequestDispatch servlet as the login servlet is included.

Number of View :679

Tomcat Error Pages list Display different error pages in tomcat setup Error Pages in tomcat

Setup error pages in tomcat

We can set up error pages for our applications running on tomcat server,so that when error or exception is thrown the user can get the appropriate message instead of the usual tomcat exception page which a user cant understand.The proper way to handle this issue is to have one`s own exception classes and throw them from the code and display error pages stating the possible causes for the error or exception and how to get rid of the same.Basically an error is a bug which is cannot be handeled from the source code such as linkage error or JVM crashes etc.An exception is a bug which our source code is liable to handle.Exceptions like file not found,sql exception etc. are checked exceptions which our code necessarily need to handle because of their possiblities of occurrences.Other exceptions which are run time exceptions need not be handled from our code as they are runtime and basically are logical errors such as division by zero,null pointer exception etc.But we can configure the error pages for errors and exceptions regardless of their nature in our tomcat application in the similar manner.We need to introduce a tag <error-pag> in our application`s web.xml file.In which we can specify error code and the location of the file to which the application must proceed if the error or exception has occurred.The snippet from the web.xml file is shown below :

<web-app>

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>LoginView.jsp</welcome-file>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <error-page>
     <error-code>404</error-code>
      <location>/error404.jsp</location>
  </error-page> 

  <error-page>
     <error-code>java.lang.NullPointerException</error-code>
      <location>/NullPointerException.jsp</location>
  </error-page>

</web-app>

The error-page tag is generally put in the last section of web.xml file,just below the welcome-file tag.Here we have put one error and an exception for demonstration.When we talk about errors we need to specify the error code in the <error-code> tag and the location of the html or jsp file which should be displayed when the error occurs.Likewise we have to cofigure for exceptions with the difference that instead of error in the error-code tag ,we have to write the fully qualified name of the exception class.For the checked exceptions however we need to throw our own exception derived from the class RuntimeException from the catch block of our code and configure the error page for our derived class inside the web.xml file.

Number of View :1495

Tomcat Welcome file list Tomcat directory listing setup welcome files in tomcat

Setup Welcome File List

When we type the URL till the project name only,we get the directory listing of the project folders.To avoid this we can setup the welcome files,which acts the the default welcome page when we type the url till project folder.We can use this facility provided by the tomcat folder when we want to display something like a login page or welcome page as the default or first page for the website and check other pages to be in session so that the user once logins then only he/she can traverse through different views of the site.The entry for the welcome file can be done in the delpoyment descriptor,i.e. Web.xml file .The sample is given below :

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>LoginView.jsp</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Here we can see that,when the url for till the project folder is hit in the browser,the welcome file is displayed.We can write as many welcome files in the <welcome-file-list> tag.The container first looks up for the first file to be present.If it exists it is displayed instead the container searches for the second entry.If not found it searches for the next page and so on till it finds one or els page not found error is thrown.However,to enable directory listing we can either edit the containers web.xml file which lies in the CATALINA_HOME/conf,or we can can edit our application specific web.xml file.In the server`s web.xml file we need to edit listings init param value for DefaultServlet entry as true.For the application specific purpose we need to override the DefaultServlet behaviour by making a sparate entry in the servlet tag for DeafaultServlet and making the listings init param as true.The snippet from the application`s web.xml file illustrates this:

<!-- Enable directory listings by overriding the server`s default web.xml file -->
<!-- The default servlet →

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

<!-- Add a mapping for our new default servlet -->
<servlet-mapping>
    <servlet-name>DefaultServletOverride</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

It must be noted that the entry in the servlet-name tag for the DefaultServlet be different in the container`s web.xml file and the application`s web.xml file otherwise a conflict will occur.

Number of View :1325

Context Params How to get context parameters in servlets Retrieving context params in servlets

Context Parameters

We can provide the context parameters for an application,insdie the web.xml file.These parameters are specific to a particular application and are initialised at the time application is loaded. Inside the web.xml file we declare a particular context param as shown below in the web.xml fragment :

<web-app>

<servlet>

<servlet-name>HelloWorld</servlet-name>

<servlet-class>HelloWorld</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>HelloWorld</servlet-name>

<url-pattern>/HelloWorld</url-pattern>

</servlet-mapping>

<context-param>

<param-name>username</param-name>

<param-value>Steve</param-value>

</context-param>

</webapp>

Here inside the web-app tag where we define the servlet-name and servlet-class tags,we introduce the context-param tags which consist of param-name and param-value tags.param-name is the name of the context parameter and param-value is the value to which it has to be initialised.

Inside the servlet code we can access the context parameters from the servlet context object.Servlet context instance can be get from the inherited getServletContext() method.

The servlet code below illustrates the above :

import java.io.IOException;

import java.io.PrintWriter;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

public class HelloWorld extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

doPost(request, response);

}

protected void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType(“text/html;charset=UTF-8″);

PrintWriter out = response.getWriter();

out.println(“<html>”);

out.println(“<head>”);

out.println(“<title>Servlet HelloWorld</title>”);

out.println(“</head>”);

out.println(“<body>”);

out.println(“<h1>Context Parameter username is ” + getServletContext().getInitParameter(“username”) + “</h1>”);

out.println(“</body>”);

out.println(“</html>”);

}

}

Here we get the context parameter “username” declared in the web.xml file by calling the method getInitParameter(“username”) on the servlet context object.The getInitParameter() method takes the name of the context parameter as string.The method getInitParameterNames() returns the enumeration of parameter values,all of which are declared in the web.xml file.Having run the above servlet code we get the output as :

Context Parameter username is Steve

steve is the value with which we inialised the context parameter,username in the web.xml file.

Number of View :1188
Content Protected Using Blog Protector By: PcDrome.

Mahol Dot Org is Digg proof thanks to caching by WP Super Cache