How to get an overview of a document within the framework in my application

Hello

I have an ADF project that integrates with Cloud Computing service for the oracle document

I can download, download, create folder, delete the folder and file list version using my ADF application.

My problem is one which is how can I preview the document on cloud of in my adf page. I don't want to download the file, I want to see it.

I tried to accomplish this task, but I faced this error

but this error occurs

java.lang.RuntimeException: failed: HTTP error code: 400

State Info: Bad Request


What follows is the source of the page

  <af:panelStretchLayout id="psl1" binding="#{backingBeanScope.backing_WEBINF_fragments_previewDoc.psl1}"
                           dimensionsFrom="parent" topHeight="250px" endWidth="50px">
        <f:facet name="center">
            <af:panelBox text="Preview Area" id="pb4"
                         binding="#{backingBeanScope.backing_WEBINF_fragments_previewDoc.pb4}" type="stretch"
                         styleClass="AFStretchWidth">
                <f:facet name="toolbar"/>
                <af:inlineFrame id="if1" source="#{cloud.frameSource}" partialTriggers="b1"/>
              
               
            </af:panelBox>
        </f:facet>
        <f:facet name="top">
    <af:panelBox text="Preview Uploaded File By File ID" id="pb2">
                    <f:facet name="toolbar"/>
                        <af:inputText label="Enter File Id" id="it1"                                     
                                      value="#{cloud.fileId}" placeholder="Copy and paste the file id here"/>
                        <af:button text="Preview" id="b1"                                 
                                   action="#{cloud.viewFileAction}"/>
                   
                </af:panelBox>
            </af:panelGroupLayout>

When the user click on the Preview button, the document should be included as part of the line

It is the method that returns the string url of the document. To be honest, as this method is not mine, I took this post How to integrate oracle doucument cloud service at my request

And I add a few modifications to this

public String getFileUrl() {


        //Read properties file to get host, port, contextroot, username, password
        try {
            m_protocol = SamplesUtils.readConfigFileValue("protocol", m_cfgFilePath);
            m_host = SamplesUtils.readConfigFileValue("host", m_cfgFilePath);
            m_username = SamplesUtils.readConfigFileValue("username", m_cfgFilePath);
            m_password = SamplesUtils.readConfigFileValue("password", m_cfgFilePath);
            m_contextroot = SamplesUtils.readConfigFileValue("contextroot", m_cfgFilePath);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
            return;
        }


        try {
            Client client = SamplesUtils.getClient();
            String resourceStr = m_protocol + "://" + m_host + "/" + m_contextroot;
            System.out.println("Calling GET on " + resourceStr + m_restresource);
            WebResource webResource = client.resource(resourceStr + m_restresource);
            String authString = m_username + ":" + m_password;


            try {
                authString = DatatypeConverter.printBase64Binary(authString.getBytes("UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }


            ClientResponse response =
                webResource.header("Authorization", "Basic " + authString).post(ClientResponse.class);         
          
            if (response.getStatus() != 200) {
                throw new RuntimeException("Failed : HTTP error code: " + response.getStatus() + "\nStatus Info: " +
                                           response.getStatusInfo());
            }         
            Item item = response.getEntity(Item.class);


            //To print out all folder and item info, just call toString on the Object. A little verbose, however.
            System.out.println(item);


            //Print out individual top level variables of FolderItems object
            System.out.println("*************************************************************************");
            System.out.println("Name: " + item.getName());
            System.out.println("Owned by: " + item.getOwnedBy().getDisplayName());
            System.out.println("Created by: " + item.getCreatedBy().getDisplayName());
            System.out.println("Modified time: " + item.getModifiedTime());
            System.out.println("Id: " + item.getId());
            System.out.println("Parent Id: " + item.getParentID());
            System.out.println("ErrorCode: " + item.getErrorCode());
            System.out.println("Size in bytes: " + item.getSize());
            System.out.println("Version: " + item.getVersion());
            System.out.println("*************************************************************************");




        } catch (Exception e) {
            e.printStackTrace();
        }
  return resourceStr+"applinks/file/"+item.getId()
    }

You have a bad request. You are not passing in the attributes assignerUser and role on the URL that is required to create Applink. You pass to one these two parameters in like a load of JSON or URL params.

JsonPayload String = "{\"assignedUser\":\. "" + m_assignedUser + "\",\"role\":\ " » » + m_role + « \ »} » ;

Or on the URL:

/API/1.1/applinks/file/DCA4BBA0908AE2F497832BC2T0000DEFAULT00000000?assignedUser=someusername&role=Downloader

Example below shows passing as a string in JSON format.  I also atrtached the POJO AppLink.java I use entitled it the answer, so the values are accessed.


/* ********************************************************************************************************************
 * Sample class to create an AppLink using POST against document cloud using the Jersey API.
 * Tested on JDeveloper 12c, with libraries JAX-RS Jersey (Bundled) and JAX-RS Jackson (Bundled) attached to project. JDK 1.7.
 *
 * Compile jar list includes:
 * javac -classpath C:\JDeveloper\mywork\JerseyRestClient\Project1\classes;C:\jdev12\oracle_common\modules\asm-3.1.jar;C:\jdev12\oracle_common\modules\jersey-core-1.18.jar;C:\jdev12\oracle_common\modules\jersey-server-1.18.jar;C:\jdev12\oracle_common\modules\jersey-servlet-1.18.jar;C:\jdev12\oracle_common\modules\jersey-json-1.18.jar;C:\jdev12\oracle_common\modules\jersey-client-1.18.jar;D:\JerseySamples\modules\jersey-multipart-1.12.jar C:\JDeveloper\mywork\JerseyRestClient\Project1\src\project1\DCJerseyClientTestGet.java
 *
 * Update the config.properties file for the POST request to run the desired Documents Cloud service.
 * Update the m_assignedUser to any user id. User can be a provisioned user id, or a non-provisioned ad-hoc value.
 * Update the role to be viewer, downloader, or contributor
 *********************************************************************************************************************/

package documents.cloud.restsamples;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;

import documents.cloud.pojos.AppLink;

import java.io.UnsupportedEncodingException;

import javax.xml.bind.DatatypeConverter;

public class CreateFileAppLink {
    // Configuration values. May need to change m_cfgFilePath to point to properties file if at a different location.
    static public String m_cfgFilePath = "src/documents/cloud/restsamples/config.properties";
    static public String m_protocol, m_host, m_username, m_password, m_contextroot = null;
    //Rest resource needs a valid GUID for the file to copy
    static public String m_restresource = "/api/1.1/applinks/file/DCA4BBA0908AE2F497832BC2T0000DEFAULT00000000";
    //Payload parameters needed for POST
    static public String m_assignedUser = "MyTestUser";
    static public String m_role = "viewer";

    @SuppressWarnings("oracle.jdeveloper.java.semantic-warning")
    public static void main(String[] args) {

        //Read properties file to get host, port, contextroot, username, password
        try {
            m_protocol = SamplesUtils.readConfigFileValue("protocol", m_cfgFilePath);
            m_host = SamplesUtils.readConfigFileValue("host", m_cfgFilePath);
            m_username = SamplesUtils.readConfigFileValue("username", m_cfgFilePath);
            m_password = SamplesUtils.readConfigFileValue("password", m_cfgFilePath);
            m_contextroot = SamplesUtils.readConfigFileValue("contextroot", m_cfgFilePath);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
            return;
        }

        try {
            //POST needs a json payload with parameters for new applink
            String jsonPayload = "{\"assignedUser\":\"" + m_assignedUser + "\",\"role\":\"" + m_role + "\"}";
            //Call static method to get client object for calling rest
            Client client = SamplesUtils.getClient();
            String resourceStr = m_protocol + "://" + m_host + "/" + m_contextroot;
            System.out.println("Calling POST on " + resourceStr + m_restresource + " with payload " + jsonPayload);
            WebResource webResource = client.resource(resourceStr + m_restresource);
            String authString = m_username + ":" + m_password;

            try {
                authString = DatatypeConverter.printBase64Binary(authString.getBytes("UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }

            ClientResponse response =
                webResource.header("Authorization", "Basic " + authString).header("Content-Type",
                                                                                  "application/json").post(ClientResponse.class,
                                                                                                           jsonPayload);

            //Check for success, otherwise exit.
            if (response.getStatus() != 200) {
                throw new RuntimeException("Failed : HTTP error code: " + response.getStatus() + "\nStatus Info: " +
                                           response.getStatusInfo());
            }

            //If pure json response is needed, use String.class to get the response.
            //String output = response.getEntity(String.class);
            //System.out.println(output);

            //Declare object that JSON string will be mapped into, then get the response into that object
            AppLink al = response.getEntity(AppLink.class);

            //To print out all applink info, just call toString on the Object.
            System.out.println(al);

            //Print out individual top level variables of file applink object
            System.out.println("*************************************************************************");
            System.out.println("URL: " + al.getAppLinkUrl());
            System.out.println("Access Token: " + al.getAccessToken());
            System.out.println("AppLink ID: " + al.getAppLinkID());
            System.out.println("Refresh Token: " + al.getRefreshToken());
            System.out.println("Error Code: " + al.getErrorCode());
            System.out.println("ID: " + al.getId());
            System.out.println("*************************************************************************");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Tags: Cloud Computing

Similar Questions

  • How fix/get rid of controls hidden out of the framework of a structure?

    Recently, I shrunk a case structure once again once it has automatically been extended several times.

    I didn't recognize any problem, because I looked again at the case of output which is the only one where a constant true

    is connected to stop the loop outside while.

    First the wire was not visible at all so I thought I've forgotten over the constant true.

    Then I created a new constant that is not on the BD and so I created another one and another one...

    When the terminal I could clean the original right-click thread which then appeared again how much noted above.

    Now I wonder where all the constants is spent and how can I make it appear again.

    Any clue?

    crossrulz wrote:

    It is an argument for the use of structures Auto Grow

    I do the same...

    move the constant and quickly UN - do the setting auto-exploser.

    (smiley-wink)

    Ben

  • How to get an overview of my work in Dreamweaver on the page aside?

    How to get an overview of my work in Dreamweaver on the page aside?

    Split.

    Go to view > split vertically & uncheck the design view on the left.

    Nancy O.

  • I need someone to walk me through how to get Photoshop to recognize cc I downloaded the plug 9.1 raw in.  I thought that this would happen automatically, but it has not changed in photoshop.

    I need someone to walk me through how to get Photoshop to recognize cc I downloaded the plug 9.1 raw in.  I thought that this would happen automatically, but it has not changed in photoshop.  I ran the installer for the plug in but it didn't ask me what to do next.  The responses I get are all over the map on this so I'm writing again. the wording of the question differently.

    There was some problems with loading 2015 ACR 8. You may need to reinstall Photoshop. Which seem to help a lot of people.

  • How to rotate view while in a document on the mobile app?

    How to rotate view while in a document on the mobile app?

    As indicated for the application mobile you would need to buy the functionality of the application.

    Drive on a computer can turn pages in a PDF document by 90-degree increments, but cannot save the changes.

    Acrobat Professional or Standard can rotate individual pages and save the results.

  • I bought acrobat Pro DC a few months ago, but now I replaced my computer for a new. How to get back my acrobat Pro DC on the new computer?

    I bought acrobat Pro DC a few months ago, but now I replaced my computer for a new. How to get back my acrobat Pro DC on the new computer?

    Hi turbomail,.

    I see that you have an active subscription Acrobat Pro. Please try to download and install from this page: https://cloud.acrobat.com/acrobat. Please see Acrobat DC subscription | Download and install for more information.

    Let us know how it goes!

    Best,

    Sara

  • Get an overview of Livecycle PDf in the Windows 7 preview pane

    Is there a way to get an overview of Livecycle PDF in the Windows 7 preview pane?

    Hello

    the preview of Windows Explorer will only see the PDF of an XFA form markup.

    You may know it as the Please wait"" message.

  • How to get a CMYK color RGB values in the DOM (CS5)

    (CS5, Actionscript)

    Hi all

    I have an InDesign document containing the frameworks for related texts that border colors are specified in the form of a CMYK picture.

    I wish I could get her color specification its closest equivalent RGB.

    The InDesign DOM contains a method to do it automatically for me?  If not, are there workarounds?

    TIA,

    mlavie

    Change ColorSpace.CMYK to ColorSpace.RGB color space, and ID will do the conversion for you.

    Of course, this changes the color applied, so don't forget to reset on CMYK when you have finished reading.

  • Hyperlinks to excel in specific documents within the portfolio.

    Hi, I would like you to click on a link to excel that would open a specific document within the portfolio. Is this possible? Currently, we use a code that is 'filename.pdf #page = X' in the hyperlink in excel. ThanksHyoer

    Hi pas7a

    No, it is not possible, you can link to a file specific pdf to excel, but you cannot link Excel to PDF in a pdf portfolio.

    Kind regards

    Rahul

  • How to get an overview of Lumetri looks like

    In Lumetri under Creative color Panel, there is the drop of looks. Is it possible to do 1 of 2 things. Either get an overview of how the look apply to your clip (in the small window to preview a little as presets Lightroom work) or if not possible the arrow pointing upwards and downwards to see how would apply each glance at your image type in the same way you can arrow through fonts when you perform the text?

    When you select a glance, she who applies... apply to any another look, he automatically UN-applies to the previous and most recent. You can also click the arrows on the edges left & right of the fair bit monitor window underneath of the bar selection of Looks, and it will scroll the looks available in the directory you are in. Then click on the one you want, and that applies to the element.

    Neil

  • How to get an overview of the effects of the question slide?

    Captivate 5
    Win XPSP3


    Problem: how to have an overview of the effects (such as drop shadow) applied to the objects (jpg) on a question slide.

    Situation: Quiz to tell 5 random questions drawn from a pool of 50 questions multiple choice.


    Questions pool Panel:
    I'm building the Quizzing question slides workspace.
    I can view the slide and add questions and answers + jpg images that may be necessary.

    If I want to add a shadow to an image, I select the object (img) and place you in the effect controls panel.
    I add a drop shadow and can make adjustments, BUT the effect is not visible on the slide.


    The Live Preview button is grayed out and unavailable.


    Overview of the toolbar options are...
    F3 slide... Does not show the effect.
    F4 project... would take too long AND would be not safe to view the slide at which I had added the image effect.
    F12 browser... shows the entire project with 5 random questions but not necessarily the specific slide.

    Am I on the Filmstip Panel:
    There are several options preview...
    F8 this slide... If I select a blank Question slide at random, it shoots a question of the pool of 50, but not necessarily that I'm working on.
    F10 then 5 slides... same problem as F8

    Unacceptable workaround solution:
    I can create another pool 'test', containing one question.
    Copy slides edited to "test the pool and the preview with F8 or F10.
    A lot of extra work...

    Then the effect works and would weigh on the finished quiz... BUT... I can't (without a lot of P'ing on) Preview and adjust effects applied to a question slide.

    Someone at - it ideas?

    Concerning

    Frank

    If you want to test the effects on a particular slide of your pool of the Question, and you don't want to publish all slides to see it, just click with the right button on the slide in the question pool and select move Question to > the project main.

    Then, you will be able to preview the effects as with any other slide.  When you know that the slide is over, just get him back in the Question pool.

  • How to get an overview of the reports of the CF generator?

    Hello

    I built a report and gave the CF Report Builder: http://localhost/feedbacks/index.cfm as the page I want it to use.

    However, when I hit "Preview", I get a blank page.

    What is the best way to get a report on the screen?

    Thank you

    Ben

    Hello.

    I managed to do work by adding the tag cfreport to the preview of a file.

    THX,

    Ben

  • How to get inDesign CC after you have installed the version CC 2014?

    So, here's the thing, after the release of CC 2014, of course I downloaded it and then I deleted all my computer CC versions. The thing is that an external software that we use for the material of brand management does not work with inDesign documents CC 2014 so I need the CC back version. The thing is that on the creative cloud there is no more the CC Versions just CC 2014, any ideas on how to get the previous version

    Hi DobsTotev,

    How to download/install version previous to see the screenshot below in order.

    1. click on drop down Filters & Versions

    2. click on the 'install' dropdown button for desire application and select CC with the original basic version.

    I hope this helps.

    Thank you and best regards,

    Sumit Singh

  • extend ListField, how to get a valid result of getSelectedIndex inside the method object?

    Hi all

    I have replace the method object to extend ListField to create my own color ListField.

    I need to avoid the double drawRow between the method object

    and the drawFocus() method.

    inside the method object, I always get the 'bad' selectedIndex (previous)

    (or rectangular previous on getFocusRect()).

    my questions are:

    1. how to get current selectedIndex (or FocusRect) inside the method object when we extend ListField?

    2. is there any other method called before object, the method which returns SelectedIndex valid?

    3. how to avoid the double drawing between object and drawFocus()?

    Thank you.

    If everything you do is add your own color, and then you can do this by using a fillRect in the drawListRow method.  In there.  I have the code that did this, but only for lines not targeted, as it detects with:

    If (listField.getSelectedIndex ()! = index) {}

    //

    }

  • How to get a form empty when we run the page?

    Hi all!

    Hope you are well

    My question is, How to get empty a form at run time? means that when we run the page, text fields is filled with white... Could someone please help me with this...

    Thanks in advance,

    Nanda.

    Hi Nanda,

    Just follow these steps:

    (1) create a stubborn taskflow (uncheck create with fragments box)

    (2) drag the CreateInsert operation on your narrow-minded taskflow and mark it as the default activity

    (3) drag a view and the CreateInsert a link to the component view using a case of control flow

    (4) double click on the view to create the page

    (5) slide the view object in the page as a form of ADF

    6) back to your narrow-minded taskflow and the general tab make sure you under visibitliy you select "url-invoke-enabled.

    You run tasfklow and your form will be rendered in insert mode.

    Concerning

    Antonis

Maybe you are looking for

  • Beachball constantly present in Safari

    Whenever I use Safari, I get the spinning beachball.  I ran Etrecheck and this is the result of this.  Any help is appreciated. EtreCheck version: 2.9.12 (265) Report generated 2016-05-23 13:53:59 Download EtreCheck from https://etrecheck.com Time 03

  • Equium M40X: WLan card drivers do not work

    Hello I just installed fresh WXP and I can't find the drivers wireless Internet. I found 3 or 4 drivers, but the device still does not work. No idea where to look or what to do? See you soon,. Bilas

  • Wired NETWORK card drivers for Elitebook 8540p

    Hello I am trying to load the NIC drivers of (non - wireless) on my HP Elitebook 8540p; It has Windows XP x 32. I'm looking here: http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang=en&cc=us&prodNameId=4096173&... I have tried eve

  • Windows 7 Media streaming running does not on

    When I try to transform wmplayer streaming media or the Control Panel, it is said that it is not enabled because it depends on a service failed to start

  • My photosmart C5180 printer blocked to come fully to the start screen

    Out of the blue, my printer blocked to come fully to the HP splash screen. He just keep going through this thing 'Hourglass' loading, over and over again. I tried the printer and then turn it on again, with no luck. I also tried to unplug it and by h