mirror of
https://github.com/octoleo/plantuml-server.git
synced 2025-02-07 13:08:25 +00:00
Running PlantUML as ROOT.war
This commit is contained in:
parent
f37bbe9d41
commit
d7a8a7e698
@ -62,7 +62,7 @@ public class PlantUmlServlet extends HttpServlet {
|
|||||||
// Last part of the URL
|
// Last part of the URL
|
||||||
public static final Pattern URL_PATTERN = Pattern.compile("^.*[^a-zA-Z0-9\\-\\_]([a-zA-Z0-9\\-\\_]+)");
|
public static final Pattern URL_PATTERN = Pattern.compile("^.*[^a-zA-Z0-9\\-\\_]([a-zA-Z0-9\\-\\_]+)");
|
||||||
|
|
||||||
private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/\\w+/uml/(.*)");
|
private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/uml/(.*)");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
@ -131,7 +131,8 @@ public class PlantUmlServlet extends HttpServlet {
|
|||||||
|
|
||||||
private String getTextFromUrl(HttpServletRequest request, String text) throws IOException {
|
private String getTextFromUrl(HttpServletRequest request, String text) throws IOException {
|
||||||
String url = request.getParameter("url");
|
String url = request.getParameter("url");
|
||||||
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(request.getRequestURI());
|
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(request.getRequestURI().substring(
|
||||||
|
request.getContextPath().length()));
|
||||||
// the URL form has been submitted
|
// the URL form has been submitted
|
||||||
if (recoverUml.matches()) {
|
if (recoverUml.matches()) {
|
||||||
final String data = recoverUml.group(1);
|
final String data = recoverUml.group(1);
|
||||||
|
@ -45,7 +45,7 @@ public abstract class UmlDiagramService extends HttpServlet {
|
|||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
|
|
||||||
// build the UML source from the compressed request parameter
|
// build the UML source from the compressed request parameter
|
||||||
final String[] sourceAndIdx = getSourceAndIdx(request.getRequestURI());
|
final String[] sourceAndIdx = getSourceAndIdx(request);
|
||||||
final String uml;
|
final String uml;
|
||||||
try {
|
try {
|
||||||
uml = UmlExtractor.getUmlSource(sourceAndIdx[0]);
|
uml = UmlExtractor.getUmlSource(sourceAndIdx[0]);
|
||||||
@ -67,7 +67,7 @@ public abstract class UmlDiagramService extends HttpServlet {
|
|||||||
dr = null;
|
dr = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/\\w+/\\w+/(\\d+/)?(.*)");
|
private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/\\w+/(\\d+/)?(.*)");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the compressed UML source from the HTTP URI.
|
* Extracts the compressed UML source from the HTTP URI.
|
||||||
@ -76,8 +76,10 @@ public abstract class UmlDiagramService extends HttpServlet {
|
|||||||
* the complete URI as returned by request.getRequestURI()
|
* the complete URI as returned by request.getRequestURI()
|
||||||
* @return the compressed UML source
|
* @return the compressed UML source
|
||||||
*/
|
*/
|
||||||
public final String[] getSourceAndIdx(String uri) {
|
public final String[] getSourceAndIdx(HttpServletRequest request) {
|
||||||
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(uri);
|
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(
|
||||||
|
request.getRequestURI().substring(
|
||||||
|
request.getContextPath().length()));
|
||||||
// the URL form has been submitted
|
// the URL form has been submitted
|
||||||
if (recoverUml.matches()) {
|
if (recoverUml.matches()) {
|
||||||
final String data = recoverUml.group(2);
|
final String data = recoverUml.group(2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user