Thursday, January 28, 2016

Cookie vs URL Rewriting

Cookie
With the first response from a stateful servlet after a session is created, the server (container) sends a cookie with a session identifier back to the client, often along with a small amount of other useful information (all less than 4 KB). The container sends the cookie, named JSESSIONID, in the HTTP response header.
Upon each subsequent request from the same Web client session, if the client supports cookies it sends the cookie back to the server as part of the request, and the cookie value is used by the server to look up session state information to pass to the servlet.
With subsequent responses, the container sends the updated cookie back to the client.
The servlet code is not required to do anything to send a cookie; this is handled by the container. Sending cookies back to the server is handled automatically by the Web browser, unless the end-user disables cookies.

The container uses the cookie for session maintenance. A servlet can retrieve cookies using the getCookies() method of the HttpServletRequest object, and can examine cookie attributes using the accessor methods of the javax.servlet.http.Cookie objects.

URL Rewriting
An alternative to using cookies is URL rewriting, through the encodeURL() method of the response object. This is where the session ID is encoded into the URL path of a request.

The name of the path parameter is jsessionid, as in the following example:
http://<host><:port>/myapp/index.html?jsessionid=6789

Similarly to the functionality of cookies, the value of the rewritten URL is used by the server to look up session state information to pass to the servlet.

Source
https://docs.oracle.com/cd/A97688_16/generic.903/a97680/develop.htm#1005024


Wednesday, January 27, 2016

SOA installation ( 12c )

Steps to install SOA
1- Download then install jdk 8.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2- Download then install Jdeveloper 12.2.1
http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html

3- Download then install SOA 12c then choose the home path as Oracle_Home of the installed Jdeveloper.
http://www.oracle.com/technetwork/middleware/soasuite/downloads/index.html
Note that you should use jdk 8 to install it:
"C:\Program Files\Java\jdk1.8.0_65\bin\java.exe" -jar D:\fmw_12.2.1.0.0_soa_quickstart.jar

4- Download and install Oracle Database 12c and keep in mind the name of the pluggable database and the administrative password  created during installation ( default name is pdborcl).

5- Edit the file tnsnames.ora to add the created pluggable database as a service located at path
D:\app\YOUR_COMPUTER_USER_NAME\product\12.1.0\dbhome_1\NETWORK\ADMIN

PDBORCL=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL = TCP)
      (HOST = localhost)
      (PORT = 1522)
    )
    (CONNECT_DATA=
      (SERVER = DEDICATED)
      (SERVICE_NAME= pdborcl.YOUR_DOMAIN_NAME)
    )
  )

5- Open the RCU.exe as administrator from path
C:\Oracle\Middleware\Oracle_Home\oracle_common\bin
- UserName is sys.
- Password is the administrative password created during installing of Oracle Database
- Service name will be the name of your pluggable database + YOUR_DOAMIN_NAME
e.g. pdborcl.blogger.com.
- Role is SYSDBA

6- Open the config.cmd then create domain from path:
C:\Oracle\Middleware\Oracle_Home\oracle_common\common\bin click config.cmd

Notes:
1- To connect to your pluggable database, you can use the url:
jdbc:oracle:thin:@localhost:1522/pdborcl.YOUR_DOMAIN_NAME

2- If you got error as:
Status : Failure -Test failed: ORA-01033: ORACLE initialization or shutdown in progress
O[en the PLSQL command line and log as admin and execute the following two lines:
alter session set container = pdborcl;
alter system enable restricted session;

If not worked tr use the following:
alter database open
alter pluggable database pdb_name save state;



shutdown immediate
startup

3-To start the admin server
Open the cmd command line then go to path:
C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\bin
and write StartWeblogic.cmd

To start the managed server go to the same path 
and write StartManagedWeblogic.cmd soa_server1


4- To unlocck user:
alter user DEV_STB account unlock;


java - fill distinct objects in ArrayList

If you have a list that contains some objects that it is considered as duplication when two or three fields of these objects are equal. How ...