Monday, August 29, 2011

Call multiple URLs on single click of af:goLink in Oracle ADF

Hi,

Last week i experienced a challenging task to forcefully logout from UCM when user logouts from WebCenter application without using Single Sign-on solution.

Note that the application was Extended WebCenter Spaces 11g PS2 so there was no other alternate solution for current environment. i will cover the whole topic in different post sometime soon.

In this post i will cover a simple tip how to call multiple URLs on a single click of af:goLink component in Oracle ADF.

Solution:

I created a simple JavaScript function to call a URL

   1: <af:resource type="javascript">
   2:     function LogoutFromUCM(){    
   3:       hostname = window.location.hostname;
   4:       document.location.href="http://"+ hostname + "/cs/logout.htm";
   5: </af:resource> 

Later call that JavaScript method on af:goLink using af:clientListener



   1: <af:goLink text="Logout"
   2:            id="logoutLink" 
   3:            inlineStyle="white-space:nowrap"
   4:            rendered="#{security.authenticated}"
   5:            shortDesc="Click here to logout"
   6:            destination="/adfAuthentication?logout=true&amp;end_url=/webcenter/faces/custom/oracle/webcenter/webcenterapp/view/templates/LogoutPage.jspx">
   7:   <af:clientListener method="LogoutFromUCM" type="mouseUp"/>
   8: </af:goLink>
The Destination attribute of af:goLink is calling a logout for WebCenter application and method attribute in af:clientListener is calling a JavaScript function to perform logout from UCM.



Using similar technique you can open any URL in a popup as well.


Hope you like this,


Zeeshan Baig

Tuesday, August 23, 2011

List of Common HTML / HTTP Error Codes

Hi,
I found a good list of HTML / HTTP error codes. This will definitely help you to debug ADF/ WebCenter / APEX or in general Web application issues.

Source = Indiana university



Code Description Comment
100 Continue
101 Switching Protocols
200 OK Action completed successfully
201 Created Success following a POST command
202 Accepted The request has been accepted for processing, but the processing has not been completed.
203 Partial Information Response to a GET command, indicates that the returned meta information is from a private overlaid web.
204 No Content Server has received the request but there is no information to send back.
205 Reset Content
206 Partial Content The requested file was partially sent.   Usually caused by stopping or refreshing a web page.
300 Multiple Choices
301 Moved Permanently Requested a directory instead of a specific file.   The web server added the filename index.html, index.htm, home.html, or home.htm to the URL.
302 Moved Temporarily
303 See Other
304 Not Modified The cached version of the requested file is the same as the file to be sent.
305 Use Proxy
400 Bad Request The request had bad syntax or was impossible to be satisified.
401 Unauthorized User failed to provide a valid user name / password required for access to file / directory.
402 Payment Required
403 Forbidden The request does not specify the file name. Or the directory or the file does not have the permission that allows the pages to be viewed from the web.
404 Not Found The requested file was not found.
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Time-Out
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URL Too Large
415 Unsupported Media Type
500 Server Error In most cases, this error is a result of a problem with the code or program you are calling rather than with the web server itself.
501 Not Implemented The server does not support the facility required.
502 Bad Gateway
503 Out of Resources The server cannot process the request due to a system overload.  This should be a temporary condition.
504 Gateway Time-Out The service did not respond within the time frame that the gateway was willing to wait.
505 HTTP Version not supported

Have a nice day,
Zeeshan Baig

Some Tips on IIS server Configuration for Oracle Webcenter11g

Hi,

Last week i faced some challenging issues with Microsoft IIS server configuration which was the entry point for a Oracle WebCenter application.

After configuring IIS as per Oracle docs and our environment we were facing  issue with only one specific Portlet in the environment.

Issue:
When i click on the Radio button in the portlet we experienced following error message
“A connection to the server has failed”
clip_image001

When i access application by skipping IIS server i.e. directly accessing the weblogic server address then portlet works normal. (This action could work for you as debug step no 1 )

Findings:

We had some tuning parameters in IIS server’s windows registry as shown in the slide

Location: HKEY_LOCAL_MACHINE / System / CurrentControlSet / Services / HTTP / Parameters

 image

I used HTTP watch to debug the issue. When i clicked on Radio button I got HTTP error code 400 which is Bad Request. Here is the list of common http error codes

The URL was generating in the background had bigger length then it the IIS registry setting parameter UrlSegmentMaxLength which was set to 800 characters and the resulted URL was coming approx 1500.

 httpwatch

Solution:

Increasing this parameter UrlSegmentMaxLength from 800 (value 320) to 2000 (value 7d0)  fixed the issues.
 registry

Hope you like this,
Zeeshan Baig

Sunday, August 14, 2011

Writing Custom JSF validator in Oracle ADF

Hi,

In this post we will see how to write custom JSF validator in ADF as well as how to validate the user input from Model layer.

Download the sample code

Watch this video for detail



Happy Jdeveloping,
Zeeshan Baig

Thursday, August 11, 2011

Share ideas for ADF related tutorials

Hi,

Just wanted to ask you guys that if you want me to write for any specific topic then feel free to let me know using contact me page. I would be more than happy to post ADF related tutorials of your choice on this blog.

I have couple of request for calendar application in ADF so i would be posting that very soon.

Happy Jdeveloping,
Zeeshan Baig

Tuesday, August 2, 2011

How to edit web.xml file for WebCenter Spaces11g

Hi,

You might be aware of how to configure session timeout setting in ADF application which resides in web.xml file (in case you don’t then check this post). Then you might be wondering why this guy keep talking about session timeout these days? :)

Well the reason for this is if you are working with ADF application or WebCenter portal application the location of web is /META-INF folder of your application. But if you are extending webcenter spaces application (like we do) then the location of web.xml file for webcenter spaces is packed in webcenter.ear file on weblogic server.

In order to make any change to this file you have to follow these steps as described in the documentation.

Note: These steps are also eligible for webcenter portal application In case you don't want to change settings at design time.

All you need to do is

  1. Open webcenter spaces ear file.
  2. edit web.xml
  3. re-pack the .ear file and the steps are as follows

Steps (Copied from docs):

1. Navigate to your WebCenter Oracle home directory.

2. Open the WebCenter Spaces .EAR file:

$ mkdir -p /tmp/my_ear

$ cd /tmp/my_ear

$ jar -xvf $WEBCENTER_HOME/archive/applications/webcenter.ear

$ mkdir war

$ cd war

$ jar -xvf ../spaces.war

3. Edit WEB-INF/web.xml and save the changes.

4. Create a modified .EAR file with the required web.xml properties

$ cd /tmp/my_ear/war

$ jar -cvf ../spaces.war *

$ cd ..

$ rm -rf war

$ jar -cvf ../webcenter.ear *

5. Copy /tmp/webcenter.ear to $WEBCENTER_HOME/archive/applications/webcenter.ear.

6. Restart the WC_Spaces managed server.

At startup, this automatically deploys the newer application with the modified web.xml.

Hope you find this useful,

Zeeshan Baig