jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajJackRabbit <kiran.training.0...@gmail.com>
Subject PROPFINDMethod using jackRabbit is redirecting me to siteminder Login.fcc
Date Sat, 01 Dec 2012 04:52:42 GMT
My application ( basically a product..) is configured with Siteminder policy
server and has a SM cookie.I would like to implement the HTTPClient to
connect to WebDav .

I am using the JAckRabbit 1.5.2/common-http-client 3.0.( these versions
)comes with our appilication

Using the Httpclient,

While i do the POSTMethod call,i got the '302 Found' error which redirecting
to the ../loing/Login.fcc page(Siteminder protected URL's give this page...)
and i used the SMSession which i got from this http response and 
called the GET method on the target URL,so that i am able to get the 200

Iam good untill this point.

On the same lines,i am trying to make a call to the PROPFIND method and
again got i the '302 Fond' error which is redirecting it to the
login/Login.fcc as above.

Iam looking to do some auto forwarding when i call the PROFIND method.Please
let me know if somebody can help..
Please find the code as below and let me know if iam doing any thing
worng..suggest how ican modify the PROPFINDMethod so that i can sucessfully
connected to the WebDav url with PROPFINDMethod to get the Multistutus(which
is basically an XML with the resource properties..)

I also tried overriding the  PROPFINDMethod's setFollowRedirect() and
getFollowRedirect() .But i end up doing the PROPFIND on the login/Login.fcc
page.and giving me the 500 Interserver error.

		String strURL = "https://myapp.dev.net/login/Login.fcc";
		String user = "myuser";
		String pass = "mypwd";
		String target = "https://myapp.dev.net/WebDav/Library Root";
		String csisessionCookie =null;
		// Get HTTP client instance
		HttpClient httpclient = new HttpClient();		
		//set the credentials..
		httpclient.getState().setCredentials(AuthScope.ANY, new
		Protocol easyhttps = new Protocol("https", new SSLProtocolSocketFactory(),
		httpclient.getHostConfiguration().setHost(strURL, 443, easyhttps);
		PostMethod httppost = new PostMethod(strURL);
		httppost.addParameter("TARGET", "$SM$"+target);
		httppost.addParameter("USERID", user);
		httppost.addParameter("PASSWORD", pass);
		int statuscode =0;		
		//keep the connection alive after the request
		//httppost.setRequestHeader("Connection", "keep-alive");
		statuscode = httpclient.executeMethod(httppost);
	    	//get SM session cookie	
		csisessionCookie = getCSISESSION(httppost);
		System.out.println("Got the CSISESSION First time : "+csisessionCookie); 

		//Use the SM session (CSISESSION)to login with GEtmethod...
		// Login -- starts
		GetMethod httpget =null;    
		httpget = new GetMethod(URIUtil.encodePathQuery(target));
		    		new DefaultHttpMethodRetryHandler(3, false));
		httpget.setRequestHeader("CSISESSION", csisessionCookie);
		// keep the connection alive after the request....
		//httpget.setRequestHeader("Connection", "keep-alive");
		//check the content for the getMethod header
		  Header[] head5 = httpget.getRequestHeaders();
		  System.out.println("getRequest header details"+Arrays.toString(head5));
		int getStatus=0;
		getStatus = httpclient.executeMethod(httpget);
		System.out.println("Login completes.. "+getStatus);
		//Login completes...

		//From here on we should be free to access SM protected url using the
		 DavPropertyNameSet propSet = new DavPropertyNameSet();
	   	 PropFindMethod pFind= new
PropFindMethod(URIUtil.encodePathQuery(target+"/Templates"), propSet,

	    		new DefaultHttpMethodRetryHandler(3, true));	
	         //follow redirects is false..otherwise we get an error like user
intervention is required error
		 int proresult= httpclient.executeMethod(pFind);
                 System.out.println("propresult"+proresult); //End up with
status as 302

		 MultiStatus multiStatus = pFind.getResponseBodyAsMultiStatus();//This
gives 302 Found error
		 MultiStatusResponse[] responses = multiStatus.getResponses();

View this message in context: http://jackrabbit.510166.n4.nabble.com/PROPFINDMethod-using-jackRabbit-is-redirecting-me-to-siteminder-Login-fcc-tp4657123.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

View raw message