Hi JC,

see my answers inline:

[EMAIL PROTECTED] wrote:
hi Jeroen,


After many unsuccessful attempts, I have some questions: - I am in a frontend project : why should I be authenticated to access files in my generator ? When I launch a "simple" request to display content, I have no problem to retrieve it.

I need a bit more information on what you mean with a front-end project. All requests to the repository should be made with a valid session. (it needs to be authenticated to the repository).

What do you mean with "simple" request? Could you perhaps post an example of such a request?


The session has no attributes, no user setted, no password, no host, etc etc... So If I want to reflect the treegenerator its already missed.


You are authenticated in your front-end with the repository right? If you request a normal document from the repository over webdav you get the document. (BTW are you using hippo-cocoon?)


- Is it possible to use a generator in a front-end project ? (outside, the generator works perfectly)

Sure it is possible. The CMS is also a 'front-end' project.




Just pieces of codes :

How I retrieve the session (Contextualize ok):
 // bug 401 encore et toujours...
        Request request = ContextHelper.getRequest(m_context);
        Session session = request.getSession();


Here's the method getBody Ive made:

private InputStream getBody(String inUri) {

        InputStream body = null;

        System.out.println("[][][][]"+inUri);
GetMethod get = new GetMethod(inUri);
        get.setDoAuthentication(true);

        try {
            int getResult = client.executeMethod(get);

            //if (getResult / 100 == 2) {
                body = get.getResponseBodyAsStream();
System.out.println("[][][][][]"+get.getResponseBodyAsString());
            //}
        } catch (HttpException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (get != null) {
                get.releaseConnection();
            }
        }

        return body;

    }

getBody call :

            String path1 = xml1.getURI();
            String path2 = xml2.getURI();

==> here's many attempts to "force" values with something likes : path = http:dav://atuin:9990/fotwerk/files/fotwerk.history/content/citizen/general/testDIFF1/0.1.xml

or atuin:9990/fotwerk/files/fotwerk.history/content/citizen/general/testDIFF1/0.1.xml

or ...
/fotwerk/files/fotwerk.history/content/citizen/general/testDIFF1/0.1.xml

A request to the repository should always contain the full url. What happens if you try with webdav://fotwerk/files/fotwerk.history/content/citizen/general/testDIFF1/0.1.xml





            String longPath1 = "dav:" + "http:" + "" +path1;

            String longPath2 = path2;
InputStream oldStream = getBody(longPath1);
            InputStream newStream = getBody(longPath2);


Many thx for your help and good week-end in advance.

Sure no problem. Same too you.

Regards,

Jeroen



_______________
JC Duchaussee WCMTech
          PI 716
--------------------------
______________________________________________________________________________________________
Smals sluit elke aansprakelijkheid uit in verband met de juistheid, de volledigheid of het tijdig toekomen van de informatie in deze e-mail. Aan deze e-mail kunnen geen rechten worden ontleend en deze e-mail houdt in geen geval een erkenning van welkdanige aansprakelijkheid in. Dit bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden en het bericht te vernietigen.

Smals décline toute responsabilité quant à l'exactitude, à l'exhaustivité et au délai de transmission des informations contenues dans cet e-mail. Aucun droit ne peut être revendiqué sur cet e-mail et cet e-mail n'implique en aucun cas une reconnaissance de responsabilité, quelle qu'elle soit. Ce message s'adresse uniquement au destinataire. Si ce message ne vous est pas destiné, nous vous prions de nous le signaler immédiatement et de détruire le message.


Jeroen Reijn <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED]
16/11/2007 11:06
Please respond to
Hippo CMS development public mailinglist <[email protected]>





To
Hippo CMS development public mailinglist <[email protected]>
cc
[EMAIL PROTECTED]
Subject
RE: [HippoCMS-dev] Error 401 and dynamic parameter value






Hi JC,

The problem is that you do not have a valid connection to the repository. You are not authenticated, that is what is causing the 401 (Unauthorized).

Try to create an http connection first with the correct credentials. That should solve your problem.

Have a look at the nl.hippo.tree.generation.TreeGenerator which is in the CMS. I gets the valid connection from the session, but in your case you can create your own if you want.

Kind regards,

Jeroen Reijn

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, November 16, 2007 10:57 AM
To: Hippo CMS development public mailinglist
Cc: [EMAIL PROTECTED]
Subject: [HippoCMS-dev] Error 401 and dynamic parameter value

Hello all !

I m working on a generator that's need url to retrieve xml content, to parse it, etc...

My problem is, when I try to get content from repository I get an "error 401" at this line : InputStream oldStream = xml1.getInputStream();

(that's works fine with files from my local filesystem).

Then I decide to give content directly to the generator but how to make the value of a paramater to be the result of a cocoon call ? The generator
needs parameters, its the only way.


Is there a solution to avoid error 401 in java code ?

or

How to make parameters dynamics ?

Thank you for your help !


_______________
JC Duchaussee WCMTech
          PI 716
--------------------------
______________________________________________________________________________________________
Smals sluit elke aansprakelijkheid uit in verband met de juistheid, de volledigheid of het tijdig toekomen van de informatie in deze e-mail. Aan deze e-mail kunnen geen rechten worden ontleend en deze e-mail houdt in geen geval een erkenning van welkdanige aansprakelijkheid in. Dit bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden
en het bericht te vernietigen.

Smals décline toute responsabilité quant à l'exactitude, à l'exhaustivité et au délai de transmission des informations contenues dans cet e-mail. Aucun droit ne peut être revendiqué sur cet e-mail et cet e-mail n'implique en aucun cas une reconnaissance de responsabilité, quelle qu'elle soit. Ce message s'adresse uniquement au destinataire. Si ce message ne vous est pas destiné, nous vous prions de nous le signaler immédiatement et de détruire le message. ********************************************
Hippocms-dev: Hippo CMS development public mailinglist
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

--
Met vriendelijke groet,
Kind regards,

Jeroen Reijn

Hippo

Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Reply via email to