cancel
Showing results for 
Search instead for 
Did you mean: 

Command Processors

anfy2002us
Champ in-the-making
Champ in-the-making
I use custom class that implements org.alfresco.web.app.servlet.command.CommandProcessor, i wrote validateArguments method that returns true and I added in the web-client-config.xml the command-processor, then i put the jar with the my class in the lib directory, that's ok, but when i tried to call the servlet
with http://localhost:8080/alfresco/command/rade/command where rade is the name of the command-processor it throws an exception

org.alfresco.error.AlfrescoRuntimeException: Error during command servlet processing: custom.Hello.validateArguments(Lorg/alfresco/service/ServiceRegistry;Ljava/lang/String;[Ljava/lang/StringSmiley WinkZ
   org.alfresco.web.app.servlet.CommandServlet.doGet(CommandServlet.java:164)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

I think that i don't do something right, can you tell me my mistake.

Thanks
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
Do you have the correct version of the interface from the SDK for your installed Alfresco version? I'm asking because currently the method signature on the interface looks like this:

   /**
    * Pass and validate URL arguments for the command processor. Validate if the command can be
    * executed given the arguments supplied. Generally at this post a Command Processor will
    * convert the supplied arguments to the objects it expects, and also check any permissions
    * that are required by the current user to execute the command.
    *
    * @param sc               ServletContext, can be used to retrieve ServiceRegistry instance
    *                         from the Repository bean.
    * @param command          Name of the command the arguments are for
    * @param args             Map of URL args passed to the command servlet
    * @param urlElements      String[] of the remaining URL arguments to the command servlet
    *
    * @return true if the command can be executed by the current user given the supplied args.
    */
   public boolean validateArguments(ServletContext sc, String command, Map<String, String> args, String[] urlElements);

And the exception you have does not look like the same method signature:
validateArguments(Lorg/alfresco/service/ServiceRegistry;Ljava/lang/String;[Ljava/lang/StringSmiley WinkZ
org.alfresco.web.app.servlet.CommandServlet.doGet(CommandServlet.java:164)

Thanks,

Kevin

anfy2002us
Champ in-the-making
Champ in-the-making
sorry Smiley Surprisedops:  I was using alfresco 1.3, and now in 1.4 is no problem.
Thanks