Hello Bart,

"Strange" uris are just for example, of course I began tests with classics 
uri. :)

I have checked my uri (http://...:9990/files/ etc...) and that's work 
well. I have a login prompt just before view the content.



I' ve just tried this :

(In the setup method)

client = new HttpClient(new MultiThreadedHttpConnectionManager());
client.getState().setCredentials(null, "atuin",new 
UsernamePasswordCredentials("root", "password"));
client.getState().setAuthenticationPreemptive(true);


With correct username and pass (for the repository) and that's works now. 
I have just a little problem with the fact that username and passwords are 
"hardcoded".


Thank you  Bart, have a nice week-end ! 





_______________
  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. 



Bart van der Schans <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
16/11/2007 15:53
Please respond to
Hippo CMS development public mailinglist <[email protected]>





To
Hippo CMS development public mailinglist <[email protected]>
cc

Subject
Re: [HippoCMS-dev] Error 401 and dynamic parameter value






Hi,

I'm not entirely sure what you are trying to do, but your uri's look a
bit strange to me.

If you initialize your httpClient with:

client = new HttpClient(new MultiThreadedHttpConnectionManager());
client.getState().setCredentials(null, host,
                  new(UsernamePasswordCredentials("user", "pass"));
client.getState().setAuthenticationPreemptive(true);

And fill in a correct username and password, you should be fine.

To check the validity or your uri's you can copy/paste them in your
browser and check if you can see the content. Also make sure your uri's
start with "http://"; and not something like "http:dav://".

Regards,
Bart


[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.
> 
> 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.
> 
> 
> - Is it possible to use a generator in a front-end project ? (outside, 
the 
> generator works perfectly)
> 
> 
> 
> 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
> 
> 
> 
> 
>             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.
> 
> 
> 
> _______________
>   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


-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / http://www.hippo.nl
--------------------------------------------------------------
********************************************
Hippocms-dev: Hippo CMS development public mailinglist


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

Reply via email to