cancel
Showing results for 
Search instead for 
Did you mean: 

Java Backed Web Script, Access Repository

baaka
Champ in-the-making
Champ in-the-making
Hello there,
I'm trying to build web script that stores file (eg. some.txt) within document library, everything is clear if I use javascript controller, but I've some troubles using java controller.

How can I access (authenticate?) repository via java controller and store file?
Can I use CMIS (within java controller) for authentication and file upload?
Any suggestions,examples?


Thanks in advance
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
You can use CMIS but the better option or rather I say suitable option is to use alfresco services. You can inject alfresco services inside your bean though dependency injection. Authentication is one of the service among them and you can use that service to authenticate with alfresco repo. though search service you can find the node, though filefolder service and nodeservice you can do most of your operations.
hope this will give you good starting point.

kaynezhang
World-Class Innovator
World-Class Innovator
If you don't want to  create a java-backed webscript that deal with login or ticket,You don't need to use AuthenticationService.
I guess you want to guarantee that only authenticated user can call your custom webscript ,if so what you have to do is just following:
     1.Create a java class that extends org.springframework.extensions.webscripts.DeclarativeWebScript and implements you upload operation.
     2.In your webscript  description document set  required level of authentication to user like this
    
 <authentication>user</authentication>

webscript framework will take care of all others for you.