AdobeSignConfigurationServlet.java
3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.aemds.guide.utils.GuidePropertyProviderUtils
* javax.jcr.RepositoryException
* javax.servlet.Servlet
* javax.servlet.ServletException
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Properties
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Reference
* org.apache.felix.scr.annotations.Service
* org.apache.sling.api.SlingHttpServletRequest
* org.apache.sling.api.SlingHttpServletResponse
* org.apache.sling.api.servlets.SlingAllMethodsServlet
* org.apache.sling.commons.json.JSONArray
* org.apache.sling.commons.json.JSONException
* org.osgi.service.component.ComponentContext
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.fd.workflow.adobesign.impl;
import com.adobe.aemds.guide.utils.GuidePropertyProviderUtils;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import javax.jcr.RepositoryException;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(metatype=0)
@Service(value={Servlet.class})
@Properties(value={@Property(name="sling.servlet.resourceTypes", value={"fd/workflow/components/esign_cloudservice_configurations"}), @Property(name="sling.servlet.extensions", value={"json"}), @Property(name="sling.servlet.selector", value={"list"}), @Property(name="sling.servlet.methods", value={"GET"}), @Property(name="service.description", value={"Adobe Sign Cloud Service Configurations List"})})
public class AdobeSignConfigurationServlet
extends SlingAllMethodsServlet {
private static final long serialVersionUID = -780464494271946961L;
private final Logger log = LoggerFactory.getLogger(AdobeSignConfigurationServlet.class);
private ComponentContext context;
private static final String ROOT_PATH = "/etc/cloudservices/echosign";
@Reference
private GuidePropertyProviderUtils guidePropertyProviderUtils;
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
PrintWriter writer = response.getWriter();
try {
JSONArray esignCloudConfigurationArray = this.guidePropertyProviderUtils.fetchEsignCloudServiceConfiguration("/etc/cloudservices/echosign");
if (esignCloudConfigurationArray == null) {
esignCloudConfigurationArray = new JSONArray();
}
esignCloudConfigurationArray.write((Writer)writer);
}
catch (JSONException e) {
throw new ServletException("Error", (Throwable)e);
}
}
protected void activate(ComponentContext context) throws RepositoryException {
this.context = context;
}
protected void bindGuidePropertyProviderUtils(GuidePropertyProviderUtils guidePropertyProviderUtils) {
this.guidePropertyProviderUtils = guidePropertyProviderUtils;
}
protected void unbindGuidePropertyProviderUtils(GuidePropertyProviderUtils guidePropertyProviderUtils) {
if (this.guidePropertyProviderUtils == guidePropertyProviderUtils) {
this.guidePropertyProviderUtils = null;
}
}
}