Mitkees & Webcenter

Into the charm of Oracle Webcenter and ADF

Monthly Archives: October 2013

ADF:Disable/enable your application pages to be added as iFrame in other websites


While Implementing a solution i didn’t find a better way to add a feature to my application except an iframe include in my page , which i don’t prefer. Sometimes we use iframes as a point of integration between applications.

So how to enable/disable our pages in an application to be reused or restrict its re-use as for security requirements??
the problem appeared to me that i have developed 2 applications and i want to use a page from application 1 to be added in a page in application 2 as an iframe & the result was the iframe is empty in mozilla Firefox/chrome and “this content cannot be displayed in frame” for IE.

After a deep searching i have found that there is context parameter that is used in the web.xml which enable/disable this feature.

<context-param>
  <param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
  <param-value>never</param-value>
  </context-param>

The parameter values

  • always: The page will show an error and redirect whenever it attempts to run in a frame.
  • differentDomain: The page will show an error and redirect only when it attempts to run in a frame on a page that originates in a different domain (the default).
  • never: The page can run in any frame on any originating domain.

And for more reading check this link

Webcenter Imaging : Delete a tif page from a multi TIF page


One of the best use of Oracle IPM is to act as a front-end to your Webcenter content . but Unfortunately, it has limited capabilities on a content so  I will show you how to extend its capabilities  using IPM APIs.

We can edit the View ( and view only) of the IPM to add buttons that fire actions in different web applications you have created for the logic you need.

In this post will show you steps how to extend the IPM Viewer Features by adding a button to delete a page from the content of type multi TIF.

  1. create a web application
  2. Add imaging-client.jar to the project class path in order to be able to use IPM APIs
  3. create class that have the Delete tif page logic as follows
  4. 
    import com.sun.media.jai.codec.FileSeekableStream;
    import com.sun.media.jai.codec.ImageCodec;
    import com.sun.media.jai.codec.ImageDecoder;
    import com.sun.media.jai.codec.ImageEncoder;
    import com.sun.media.jai.codec.TIFFEncodeParam;
    
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import javax.media.jai.NullOpImage;
    import javax.media.jai.OpImage;
    import javax.media.jai.PlanarImage;
    
    public class TiffDeleterClass {
    public TiffDeleterClass() {
    super();
    }
    
    public String countPages(String DocumentID) throws IOException{
    String tempDirectory="D:\\Oracle\\Middleware\\user_projects\\domains\\MGRP_domain\\ucm\\cs\\vault\\~temp\\";
    String pagesCount="0";
    List images = new ArrayList();
    FileSeekableStream ss = new FileSeekableStream(tempDirectory+DocumentID);
    ImageDecoder dec = ImageCodec.createImageDecoder("tiff", ss, null);
    int count = dec.getNumPages();
    return ""+count;
    }
    public void deleteTifPage(String DocumentID,int pageNumber) throws IOException {
    String tempDirectory="c:\\ipm\\";
    int pageToBeDeleted = 1;
    List images = new ArrayList();
    FileSeekableStream ss = new FileSeekableStream(tempDirectory+DocumentID+".tif");
    ImageDecoder dec = ImageCodec.createImageDecoder("tiff", ss, null);
    int count = dec.getNumPages();
    // System.out.println(count);
    for (int i = 1; i <= count; i++) {
    if(i== pageToBeDeleted) continue;
    PlanarImage op = new NullOpImage(dec.decodeAsRenderedImage(i-1), null, null, OpImage.OP_IO_BOUND);
    images.add(op.getAsBufferedImage());
    }
    
    TIFFEncodeParam params = new TIFFEncodeParam();
    OutputStream out = new FileOutputStream(tempDirectory +"deleted\\"+DocumentID +".tif");
    ImageEncoder encoder = ImageCodec.createImageEncoder("tiff", out, params);
    List imageList = new ArrayList();
    for (int i = 1; i < images.size(); i++)
    {
    imageList.add((BufferedImage)images.get(i));
    }
    params.setExtraImages(imageList.iterator());
    params.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
    encoder.encode(images.get(0));
    out.close();
    }
    }
    
  5. create  a page or servlet that get the request with the page need to be deleted and the contentID and call the needed method in the previous class.
  6. deploy the application and test it using the browser
  7. customize the IPM and add a button and set the action to be the page/servlet and pass the required paramters
%d bloggers like this: