cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti diagram-viewer 403 forbidden

jcoveron
Champ in-the-making
Champ in-the-making
Greetings

I am trying to view the process instance diagram by using the url as it is explained in the following links:
* http://bpmn20inaction.blogspot.com.es/2013/02/process-diagrams-community-contribution.html
* http://activiti.org/userguide/index.html#_process_diagram

However, I am getting 403 - Forbidden error message.

If I start an activiti-explorer session, and try to open view a process diagram using the url, the diagram is correctly shown.

I am trying this with activiti version 5.18.0 and 5.19.0.

Many thanks in advance.
2 REPLIES 2

trademak
Star Contributor
Star Contributor
The Activiti Explorer application requires you to have a valid session for every sub url of /activiti-explorer .
You can just copy the diagram-viewer code to another application without authentication if that's what you are looking for.
You also need to include the activiti-diagram-rest module in that case.

Best regards,

jcoveron
Champ in-the-making
Champ in-the-making
Hi Tijs,
Thanks a lot for replying. In the end, I added the activiti-diagram-rest into the activiti-rest project. This allowed me to use the functions that I already had in combination with the diagram-viewer that is already implemented in the activiti-explorer.
Just in case anyone needs to to this, I will add the step I did. Hope they will be useful.

1) Downloaded the source code for activiti version 5.19. I downloaded this version as this is the one I am currently using.
2) Import the Maven project to Eclipse. I ended up importing the whole project and subprojects.
3) Opened the activiti-rest project as this is were the url and logic needs to be added.
4) Under src/main/java, I created a package called org.activiti.rest.service.api.diagram (I tried to follow the same naming convension as the rest of the code). Include the java files that are in the activiti-diagram-rest project. You have to include the four files.
5) Modify the file RestUrls.java under the package org.activiti.rest.service.api by including the following lines:

<code>
// this goes in the variable declaration section
public static final String SEGMENT_DEPLOYMENT_ARTIFACT_DIAGRAM = "diagram-layout";
public static final String SEGMENT_DIAGRAM_LAYOUT = "diagram-layout";
public static final String SEGMENT_DIAGRAM_HIGHLIGHTS = "highlights";

/**
   * URL template for the diagram resource of a single process definition: <i>repository/process-definitions/{0Smiley TonguerocessDefinitionId}/diagram-layout</i>
   */
  public static final String[] URL_PROCESS_DEFINITION_DIAGRAM_LAYOUT = {SEGMENT_REPOSITORY_RESOURCES, SEGMENT_PROCESS_DEFINITION_RESOURCE,
   "{0}", SEGMENT_DEPLOYMENT_ARTIFACT_DIAGRAM};

  /**
   * URL template for the diagram layout for a single process instance: <i>runtime/process-instances/{0Smiley TonguerocessInstanceId}/diagram-layout</i>
   */
  public static final String[] URL_PROCESS_INSTANCE_DIAGRAM_LAYOUT = {SEGMENT_RUNTIME_RESOURCES, SEGMENT_PROCESS_INSTANCE_RESOURCE, "{0}", SEGMENT_DIAGRAM_LAYOUT};

  /**
   * URL template for the diagram highlights for a single process instance: <i>runtime/process-instances/{0Smiley TonguerocessInstanceId}/highlights</i>
   */
  public static final String[] URL_PROCESS_INSTANCE_DIAGRAM_HIGHLIGHTS = {SEGMENT_RUNTIME_RESOURCES, SEGMENT_PROCESS_INSTANCE_RESOURCE, "{0}", SEGMENT_DIAGRAM_HIGHLIGHTS};
</code>

6) Do a mvn clean install from a command line or directly from Eclispse.
7) Copy the newly created jar to the lib folder under the activiti-rest webapp in your Tomcat, and reboot it.

With it, you will be able to get the diagram layout and highlighted tasks as if you were doing a regular rest call to Activiti's rest API.

Hope this is helpfull.