Running PlantUML as ROOT.war

This commit is contained in:
Arnaud Roques
2017-04-21 22:38:08 +02:00
parent f37bbe9d41
commit d7a8a7e698
2 changed files with 9 additions and 6 deletions

View File

@@ -45,7 +45,7 @@ public abstract class UmlDiagramService extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// build the UML source from the compressed request parameter
final String[] sourceAndIdx = getSourceAndIdx(request.getRequestURI());
final String[] sourceAndIdx = getSourceAndIdx(request);
final String uml;
try {
uml = UmlExtractor.getUmlSource(sourceAndIdx[0]);
@@ -67,7 +67,7 @@ public abstract class UmlDiagramService extends HttpServlet {
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.
@@ -76,8 +76,10 @@ public abstract class UmlDiagramService extends HttpServlet {
* the complete URI as returned by request.getRequestURI()
* @return the compressed UML source
*/
public final String[] getSourceAndIdx(String uri) {
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(uri);
public final String[] getSourceAndIdx(HttpServletRequest request) {
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(
request.getRequestURI().substring(
request.getContextPath().length()));
// the URL form has been submitted
if (recoverUml.matches()) {
final String data = recoverUml.group(2);