Class TemplateRestResource
- java.lang.Object
-
- org.glassfish.admin.rest.resources.AbstractResource
-
- org.glassfish.admin.rest.resources.TemplateRestResource
-
- All Implemented Interfaces:
OptionsCapable
- Direct Known Subclasses:
GlassFishDomainResource,PropertiesBagResource.PropertyResource
@Produces({"text/html","application/json","application/xml","application/x-www-form-urlencoded"}) @Consumes({"application/json","application/xml","application/x-www-form-urlencoded"}) public class TemplateRestResource extends AbstractResource implements OptionsCapable- Author:
- Ludovic Champenois ludo@java.net, Rajeshwar Patil
-
-
Field Summary
Fields Modifier and Type Field Description protected StringchildIDprotected ConfigModelchildModelprotected Domentitystatic LocalStringManagerImpllocalStringsprotected Domparentprotected StringtagName-
Fields inherited from class org.glassfish.admin.rest.resources.AbstractResource
locatorBridge, logger, requestHeaders, securityContext, serviceLocator, subjectRef, uriInfo
-
-
Constructor Summary
Constructors Constructor Description TemplateRestResource()Creates a new instance of xxxResource
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ActionReportResultbuildActionReportResult(boolean showEntityValues)static HashMap<String,String>createDataBasedOnForm(org.glassfish.jersey.media.multipart.FormDataMultiPart formData)allows for remote files to be put in a tmp area and we pass the local location of this file to the corresponding command instead of the content of the file * Yu need to add enctype="multipart/form-data" in the form for ex:jakarta.ws.rs.core.ResponsecreateOrUpdateEntity(HashMap<String,String> data)jakarta.ws.rs.core.ResponsecreateOrUpdateEntityLegacyFormat(HashMap<String,String> data)jakarta.ws.rs.core.Responsedelete(Map<String,String> data)protected RestActionReporterdoCreateOrUpdate(Map<String,String> data)This method performs the creation or updating of an entity, regardless of the request's mime type.protected ActionReport.ExitCodedoDelete(Map<String,String> data)protected String[][]getCommandResourcesPaths()protected StringgetDeleteCommand()DomgetEntity()Map<String,String>getEntity(int expandLevel)ActionReportResultgetEntityLegacyFormat(int expandLevel)jakarta.ws.rs.core.UriInfogetUriInfo()protected jakarta.ws.rs.core.ResponsehandleError(jakarta.ws.rs.core.Response.Status error, String message)RestResourceMetadataoptions()ActionReportResultoptionsLegacyFormat()Objectpost(org.glassfish.jersey.media.multipart.FormDataMultiPart formData)ObjectpostLegacyFormat(org.glassfish.jersey.media.multipart.FormDataMultiPart formData)allows for remote files to be put in a tmp area and we pass the local location of this file to the corresponding command instead of the content of the file * Yu need to add enctype="multipart/form-data" in the form for ex:<form action="http://localhost:4848/management/domain/applications/application" method="post" enctype="multipart/form-data">then any param of type="file" will be uploaded, stored locally and the param will use the local location on the server side (ie.protected voidremoveAttributesToBeSkipped(Map<String,String> data)voidsetBeanByKey(List<Dom> parentList, String id, String tag)voidsetEntity(Dom p)voidsetParentAndTagName(Dom parent, String tagName)voidsetUriInfo(jakarta.ws.rs.core.UriInfo uriInfo)protected voidthrowError(jakarta.ws.rs.core.Response.Status error, String message)-
Methods inherited from class org.glassfish.admin.rest.resources.AbstractResource
getAuthenticatedUser, getSubject
-
-
-
-
Field Detail
-
entity
protected Dom entity
-
parent
protected Dom parent
-
tagName
protected String tagName
-
childModel
protected ConfigModel childModel
-
childID
protected String childID
-
localStrings
public static final LocalStringManagerImpl localStrings
-
-
Method Detail
-
getEntityLegacyFormat
@GET public ActionReportResult getEntityLegacyFormat(@QueryParam("expandLevel") @DefaultValue("1") int expandLevel)
-
getEntity
@GET @Produces("application/vnd.oracle.glassfish+json") public Map<String,String> getEntity(@QueryParam("expandLevel") @DefaultValue("1") int expandLevel)
-
createOrUpdateEntityLegacyFormat
@POST public jakarta.ws.rs.core.Response createOrUpdateEntityLegacyFormat(HashMap<String,String> data)
-
createOrUpdateEntity
@POST @Produces("application/vnd.oracle.glassfish+json") public jakarta.ws.rs.core.Response createOrUpdateEntity(HashMap<String,String> data)
-
postLegacyFormat
@POST @Consumes("multipart/form-data") public Object postLegacyFormat(org.glassfish.jersey.media.multipart.FormDataMultiPart formData)allows for remote files to be put in a tmp area and we pass the local location of this file to the corresponding command instead of the content of the file * Yu need to add enctype="multipart/form-data" in the form for ex:<form action="http://localhost:4848/management/domain/applications/application" method="post" enctype="multipart/form-data">then any param of type="file" will be uploaded, stored locally and the param will use the local location on the server side (ie. just the path)
-
post
@POST @Consumes("multipart/form-data") @Produces("application/vnd.oracle.glassfish+json") public Object post(org.glassfish.jersey.media.multipart.FormDataMultiPart formData)
-
optionsLegacyFormat
@OPTIONS @Produces("application/json") public ActionReportResult optionsLegacyFormat()
-
options
@OPTIONS @Produces("application/vnd.oracle.glassfish+json") public RestResourceMetadata options()
-
doCreateOrUpdate
protected RestActionReporter doCreateOrUpdate(Map<String,String> data)
This method performs the creation or updating of an entity, regardless of the request's mime type. If an error occurs, aWebApplicationExceptionis thrown, so if the method returns, the create/update was successful.- Parameters:
data-- Returns:
-
doDelete
protected ActionReport.ExitCode doDelete(Map<String,String> data)
-
getUriInfo
public jakarta.ws.rs.core.UriInfo getUriInfo()
- Specified by:
getUriInfoin interfaceOptionsCapable
-
setUriInfo
public void setUriInfo(jakarta.ws.rs.core.UriInfo uriInfo)
- Specified by:
setUriInfoin interfaceOptionsCapable
-
setEntity
public void setEntity(Dom p)
-
getEntity
public Dom getEntity()
-
createDataBasedOnForm
public static HashMap<String,String> createDataBasedOnForm(org.glassfish.jersey.media.multipart.FormDataMultiPart formData)
allows for remote files to be put in a tmp area and we pass the local location of this file to the corresponding command instead of the content of the file * Yu need to add enctype="multipart/form-data" in the form for ex:
-
buildActionReportResult
protected ActionReportResult buildActionReportResult(boolean showEntityValues)
-
getCommandResourcesPaths
protected String[][] getCommandResourcesPaths()
-
getDeleteCommand
protected String getDeleteCommand()
-
throwError
protected void throwError(jakarta.ws.rs.core.Response.Status error, String message) throws jakarta.ws.rs.WebApplicationException- Throws:
jakarta.ws.rs.WebApplicationException
-
handleError
protected jakarta.ws.rs.core.Response handleError(jakarta.ws.rs.core.Response.Status error, String message) throws jakarta.ws.rs.WebApplicationException- Throws:
jakarta.ws.rs.WebApplicationException
-
-