You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by kranthi kumar <kr...@gmail.com> on 2008/11/10 09:52:05 UTC

inserting the user details from external application

Hi,
    How can i insert the user registration details from an external
application. I have gone through the forum's previous questions and found
something called groovy. If groovy can be useful for this task ..please
suggest me how to use it.....
Thanks
Kranthi
-- 
View this message in context: http://www.nabble.com/inserting-the-user-details-from-external-application-tp20416391s12275p20416391.html
Sent from the Roller - Dev mailing list archive at Nabble.com.


Re: inserting the user details from external application

Posted by kranthi kumar <kr...@gmail.com>.
Thanks Dave ...It worked.

Dave Johnson-8 wrote:
> 
> On Tue, Nov 11, 2008 at 7:25 AM, kranthi kumar
> <kr...@gmail.com> wrote:
>> Probably i didin't explain my problem clearly....
>> I am having my project and roller as separate applications in webapps of
>> tomcat. Now whenever a user registers for my site i need to insert the
>> same
>> user credentials into roller database(rolleruser table). Is there any way
>> of
>> doing this???
> 
> There are at least two ways to do this that I am aware of.
> 
> 1) The Roller Admin API - a simple web service for creating users and
> blogs
> 2) The Roller Java API - just call the Roller Java classes directly
> 
> There are README files and examples of how to use these options from
> the Groovy language at the link below.
>   
> http://svn.apache.org/viewvc/roller/trunk/sandbox/scripting/groovy/examples/
> 
> Here the Roller Java API createuser.gy example:
>    http://tinyurl.com/3cwy9j
> 
> Here's the Roller Admin API createuser.gy example:
>    http://tinyurl.com/5zxzbv
> 
> - Dave
> 
> 

-- 
View this message in context: http://www.nabble.com/inserting-the-user-details-from-external-application-tp20416391s12275p20476164.html
Sent from the Roller - Dev mailing list archive at Nabble.com.


Re: inserting the user details from external application

Posted by Dave <sn...@gmail.com>.
On Tue, Nov 11, 2008 at 7:25 AM, kranthi kumar
<kr...@gmail.com> wrote:
> Probably i didin't explain my problem clearly....
> I am having my project and roller as separate applications in webapps of
> tomcat. Now whenever a user registers for my site i need to insert the same
> user credentials into roller database(rolleruser table). Is there any way of
> doing this???

There are at least two ways to do this that I am aware of.

1) The Roller Admin API - a simple web service for creating users and blogs
2) The Roller Java API - just call the Roller Java classes directly

There are README files and examples of how to use these options from
the Groovy language at the link below.
   http://svn.apache.org/viewvc/roller/trunk/sandbox/scripting/groovy/examples/

Here the Roller Java API createuser.gy example:
   http://tinyurl.com/3cwy9j

Here's the Roller Admin API createuser.gy example:
   http://tinyurl.com/5zxzbv

- Dave

Re: inserting the user details from external application

Posted by kranthi kumar <kr...@gmail.com>.
Probably i didin't explain my problem clearly....
I am having my project and roller as separate applications in webapps of
tomcat. Now whenever a user registers for my site i need to insert the same
user credentials into roller database(rolleruser table). Is there any way of
doing this??? I am trying to do it by creating a new method in Register.java
of org.apache.roller.weblogger.ui.struts2.core package. I am planning to
call that method by using URL,URLConnection of java.net package in the
following way
String data = URLEncoder.encode("username", "UTF-8") + "=" +
URLEncoder.encode("somex", "UTF-8");
        data += "&" + URLEncoder.encode("password", "UTF-8") + "=" +
URLEncoder.encode("somex", "UTF-8");
        data += "&" + URLEncoder.encode("fullName", "UTF-8") + "=" +
URLEncoder.encode("somex", "UTF-8");
		data += "&" + URLEncoder.encode("email", "UTF-8") + "=" +
URLEncoder.encode("somex@somey.com", "UTF-8");
		data += "&" + URLEncoder.encode("locale", "UTF-8") + "=" +
URLEncoder.encode("English(United States)", "UTF-8");
        data += "&" + URLEncoder.encode("timeZone", "UTF-8") + "=" +
URLEncoder.encode("America/Jamaica", "UTF-8");
        // Send data
        URL url=new
URL("http://localhost:8080/roller/roller-ui/register!custom.rol");
		URLConnection conn = url.openConnection();
	    conn.setDoOutput(true);
        OutputStreamWriter wr = new
OutputStreamWriter(conn.getOutputStream());
		wr.write(data);
        wr.flush();
In that method i will be getting the parameters from the url using
request.getParameter() ,creating a User object and setting the required
fields with the obtained values from url then call the addUser() of
UserManager passing the User object as parameter. Is this the right way to
do??? or is there any easy way of doing this. Please advise me...
Thanks
Kranthi

Hi,
    How can i insert the user registration details from an external
application. I have gone through the forum's previous questions and found
something called groovy. If groovy can be useful for this task ..please
suggest me how to use it.....
Thanks
Kranthi

kranthi kumar wrote:
> 
> Hi,
>     How can i insert the user registration details from an external
> application. I have gone through the forum's previous questions and found
> something called groovy. If groovy can be useful for this task ..please
> suggest me how to use it.....
> Thanks
> Kranthi
> 

-- 
View this message in context: http://www.nabble.com/inserting-the-user-details-from-external-application-tp20416391s12275p20438485.html
Sent from the Roller - Dev mailing list archive at Nabble.com.