Search in sources :

Example 11 with OptionsResult

use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.

the class TemplateExecCommand method optionsLegacyFormat.

@OPTIONS
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ActionReportResult optionsLegacyFormat() {
    RestActionReporter ar = new RestActionReporter();
    ar.setExtraProperties(new Properties());
    ar.setActionDescription(commandDisplayName);
    OptionsResult optionsResult = new OptionsResult(resourceName);
    Map<String, MethodMetaData> mmd = new HashMap<String, MethodMetaData>();
    MethodMetaData methodMetaData = ResourceUtil.getMethodMetaData(commandName, getCommandParams(), locatorBridge.getRemoteLocator());
    optionsResult.putMethodMetaData(commandMethod, methodMetaData);
    mmd.put(commandMethod, methodMetaData);
    ResourceUtil.addMethodMetaData(ar, mmd);
    ActionReportResult ret = new ActionReportResult(ar, null, optionsResult);
    ret.setCommandDisplayName(commandDisplayName);
    return ret;
}
Also used : ActionReportResult(org.glassfish.admin.rest.results.ActionReportResult) RestActionReporter(org.glassfish.admin.rest.utils.xml.RestActionReporter) HashMap(java.util.HashMap) MethodMetaData(org.glassfish.admin.rest.provider.MethodMetaData) Properties(java.util.Properties) OptionsResult(org.glassfish.admin.rest.results.OptionsResult) Produces(javax.ws.rs.Produces) OPTIONS(javax.ws.rs.OPTIONS)

Example 12 with OptionsResult

use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.

the class FindHttpProtocolResource method get.

@GET
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_FORM_URLENCODED })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_FORM_URLENCODED })
public ActionReportResult get() {
    Dom dom = getEntity();
    NetworkListener nl = dom.createProxy(NetworkListener.class);
    Protocol p = nl.findHttpProtocol();
    RestActionReporter ar = new RestActionReporter();
    ar.setActionExitCode(ActionReport.ExitCode.SUCCESS);
    ar.getTopMessagePart().getProps().put("protocol", p.getName());
    ActionReportResult result = new ActionReportResult("find-http-protocol", ar, new OptionsResult());
    return result;
}
Also used : Dom(org.jvnet.hk2.config.Dom) ActionReportResult(org.glassfish.admin.rest.results.ActionReportResult) RestActionReporter(org.glassfish.admin.rest.utils.xml.RestActionReporter) Protocol(org.glassfish.grizzly.config.dom.Protocol) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener) OptionsResult(org.glassfish.admin.rest.results.OptionsResult) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes) GET(javax.ws.rs.GET)

Example 13 with OptionsResult

use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.

the class SystemPropertiesCliResource method deleteProperty.

protected Response deleteProperty(String parent, String propName) {
    ParameterMap pm = new ParameterMap();
    pm.add("DEFAULT", propName);
    pm.add("target", (parent == null) ? getParent(uriInfo) : parent);
    RestActionReporter actionReport = ResourceUtil.runCommand("delete-system-property", pm, getSubject());
    ActionReport.ExitCode exitCode = actionReport.getActionExitCode();
    ActionReportResult results = new ActionReportResult(commandName, actionReport, new OptionsResult());
    int status = HttpURLConnection.HTTP_OK;
    /*200 - ok*/
    if (exitCode == ActionReport.ExitCode.FAILURE) {
        status = HttpURLConnection.HTTP_INTERNAL_ERROR;
    }
    return Response.status(status).entity(results).build();
}
Also used : ActionReportResult(org.glassfish.admin.rest.results.ActionReportResult) RestActionReporter(org.glassfish.admin.rest.utils.xml.RestActionReporter) ParameterMap(org.glassfish.api.admin.ParameterMap) ActionReport(org.glassfish.api.ActionReport) OptionsResult(org.glassfish.admin.rest.results.OptionsResult)

Aggregations

ActionReportResult (org.glassfish.admin.rest.results.ActionReportResult)13 OptionsResult (org.glassfish.admin.rest.results.OptionsResult)13 RestActionReporter (org.glassfish.admin.rest.utils.xml.RestActionReporter)13 Produces (javax.ws.rs.Produces)5 MethodMetaData (org.glassfish.admin.rest.provider.MethodMetaData)5 GET (javax.ws.rs.GET)4 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 Consumes (javax.ws.rs.Consumes)2 ActionReport (org.glassfish.api.ActionReport)2 ParameterMap (org.glassfish.api.admin.ParameterMap)2 Dom (org.jvnet.hk2.config.Dom)2 Domain (com.sun.enterprise.config.serverbeans.Domain)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ValidationException (javax.validation.ValidationException)1 OPTIONS (javax.ws.rs.OPTIONS)1 PUT (javax.ws.rs.PUT)1 WebApplicationException (javax.ws.rs.WebApplicationException)1