Removed servlets
This commit is contained in:
parent
6f0795b027
commit
cfdac3be4d
2 changed files with 0 additions and 115 deletions
|
@ -1,62 +0,0 @@
|
|||
package com.mxgraph.online;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* Implements returning a 301 for the connect image placeholder to point
|
||||
* at the relative PNG attachment of the diagram
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ConnectImageServlet extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3143318789617797083L;
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
String redirect = "https://www.draw.io/images/logo-flat.png";
|
||||
String diagramName = request.getParameter("diagramName");
|
||||
String baseUrl = request.getParameter("baseUrl");
|
||||
String pageId = request.getParameter("pageId");
|
||||
String revision = request.getParameter("revision");
|
||||
|
||||
if (pageId != null && baseUrl != null && diagramName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
redirect = baseUrl + "/download/attachments/" + pageId + "/"
|
||||
+ URLEncoder.encode(diagramName, "UTF-8")
|
||||
.replaceAll("\\+", "%20")
|
||||
+ ".png?api=v2" + (revision != null ? "&version=" + revision : "");
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
||||
response.setHeader("Location", redirect);
|
||||
|
||||
try
|
||||
{
|
||||
response.getOutputStream().flush();
|
||||
response.getOutputStream().close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package com.mxgraph.online;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns XHTML in Confluence Storage Format indicating to display the PNG
|
||||
* attachment of the diagram
|
||||
*
|
||||
*/
|
||||
public class ConnectRenderServlet extends HttpServlet
|
||||
{
|
||||
private static final long serialVersionUID = 161100757439732089L;
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
String pageId = request.getParameter("pageId");
|
||||
String diagramName = request.getParameter("diagramName");
|
||||
String filenameIntact = request.getParameter("filenameIntact");
|
||||
|
||||
try
|
||||
{
|
||||
diagramName = URLEncoder.encode(diagramName, "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
String fileSuffix = filenameIntact != null ? "" : ".png";
|
||||
String staticMacro = "<ac:image><ri:url ri:value=\"/download/attachments/" + pageId + "/" + diagramName + fileSuffix + "?api=v2\"/></ac:image>";
|
||||
|
||||
try
|
||||
{
|
||||
byte[] data = staticMacro.getBytes("UTF-8");
|
||||
OutputStream out = response.getOutputStream();
|
||||
out.write(data);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue