Skip to content

Commit

Permalink
Fallback to extract POST params
Browse files Browse the repository at this point in the history
  • Loading branch information
imsandli committed Jul 29, 2022
1 parent 254c172 commit 646672b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/jminix/console/resource/OperationResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
package org.jminix.console.resource;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.StreamSupport;

import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
Expand All @@ -39,6 +41,7 @@
import org.restlet.data.Form;
import org.restlet.data.Language;
import org.restlet.data.MediaType;
import org.restlet.ext.servlet.ServletUtils;
import org.restlet.representation.InputRepresentation;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
Expand Down Expand Up @@ -77,7 +80,10 @@ public Map<String, Object> getModel()
public Representation execute(Representation entity) throws ResourceException
{
String[] stringParams = new Form(entity).getValuesArray("param");


if(stringParams != null && isAllNulls(Arrays.asList(stringParams))) {
stringParams = (String[]) ServletUtils.getRequest(getRequest()).getParameterMap().get("param");
}

String domain = unescape(getDecodedAttribute("domain"));

Expand Down Expand Up @@ -214,5 +220,8 @@ private MBeanOperationInfo getOperation(MBeanServerConnection server, String dom
throw new RuntimeException(e);
}
}


private boolean isAllNulls(Iterable<?> array) {
return StreamSupport.stream(array.spliterator(), true).allMatch(o -> o == null);
}
}

0 comments on commit 646672b

Please sign in to comment.