X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.22.2a (ClamAV engine v0.102.2) X-Junk-Score: 0 [] X-KAS-Score: 0 [] From: "Peer Sandtner" Received: from www273.your-server.de ([188.40.28.173] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.3) with ESMTPS id 25355158 for webobjects-dev@wocommunity.org; Wed, 03 Feb 2021 09:17:36 +0100 Received-SPF: none receiver=post.selbstdenker.com; client-ip=188.40.28.173; envelope-from=peer@peersandtner.de Received: from sslproxy01.your-server.de ([78.46.139.224]) by www273.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1l7DLg-0003sy-8c for webobjects-dev@wocommunity.org; Wed, 03 Feb 2021 09:17:16 +0100 Received: from [95.116.59.143] (helo=aloha.fritz.box) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1l7DLg-0000SQ-3i for webobjects-dev@wocommunity.org; Wed, 03 Feb 2021 09:17:16 +0100 Content-Type: multipart/alternative; boundary="Apple-Mail=_C6079A29-E4E0-4DAD-AE08-4BDF5766F712" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: [WO-DEV] ERRest PUT not functioning Date: Wed, 3 Feb 2021 09:17:15 +0100 References: To: WebObjects & WOnder Development In-Reply-To: Message-Id: <1001F723-210F-49A0-BEEC-0C55A3D5C7B4@peersandtner.de> X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Authenticated-Sender: peer@peersandtner.de X-Virus-Scanned: Clear (ClamAV 0.102.4/26068/Tue Feb 2 13:21:02 2021) --Apple-Mail=_C6079A29-E4E0-4DAD-AE08-4BDF5766F712 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello Don, are you using an Apache? In my case I had to modify webobjects.conf: # Specific to Apache 2.4 Require all granted Require all denied =20 Peer > Am 03.02.2021 um 07:21 schrieb Don Lindsay = : >=20 > Hello; >=20 > I have a ERRest project. Everything seems to be working except for = when I update an entity the updateAction never gets called. I put = breakpoints in the source code on createAction, updateAction, = indexAction, showAction. The method that gets called for PUT is = indexAction. Am I doing something wrong with the code, I took a look at = the example apps in Project Wonder and used them to create my = boilerplate. > =20 > Thanks, >=20 > Don >=20 >=20 > The request from the developer tools in the browser: >=20 > >=20 >=20 > How the data is being sent: >=20 > $.ajax({ > url: '/cgi-bin/WebObjects/xxxxxx.woa/ra/TileV2', > type: =E2=80=98PUT', > data: workingObject, > dataType: 'json', > contentType: 'application/json', > success: function (data) { > comp._currentTile =3D data; > console.log(JSON.stringify(data)) > bootbox.alert({ > title: "Tile Save", > message: "Tile saved successfully", > centerVertical: true > }); > comp.resetDirty(); > comp.initialize(window.connectorsjson, window.tilejson);; > }, > error: function (data) { > bootbox.alert({ > title: "Tile Save", > message: "Saving the tile failed, please try again later", > centerVertical: true > }); > } > }); >=20 >=20 >=20 > TileV2Controller.java >=20 > public class TileV2Controller extends BaseRestController { >=20 > public TileV2Controller(WORequest request) { > super(request); > // TODO Auto-generated constructor stub > } >=20 > @Override > public WOActionResults createAction() throws Throwable { > TileV2 tilev2 =3D create(createInFilter()); > editingContext().saveChanges(); > return response(tilev2,outFilter()); > } >=20 > public ERXKeyFilter createInFilter() { > return ERXKeyFilter.filterWithAttributes(); > } >=20 > public ERXKeyFilter outFilter() { > ERXKeyFilter out =3D createInFilter(); > return out; > } >=20 >=20 >=20 > /** > * Returns the value of the "tile" variable from the route. > * @return > */ > public TileV2 tilev2() { > TileV2 tilev2 =3D routeObjectForKey("tileV2"); > = tilev2.setTenant(((com.mozaic.app.Session)session()).getTenant()); > return tilev2; > } >=20 > /** > * The query filter is used in indexAction to control what = attributes and relationships > * you expose to qualifiers through query parameters > *=20 > * @return > */ > public static ERXKeyFilter queryFilter() { > ERXKeyFilter filter =3D = ERXKeyFilter.filterWithAllRecursive(); > filter.includeAll(); > return filter; > } >=20 > /** > * This showFilter is used by indexAction and showAction and = says to return all attributes > * of an TileV2, and for the owner, include all of its = attributes.=20 > */ > public static ERXKeyFilter showFilter() { > ERXKeyFilter filter =3D = ERXKeyFilter.filterWithAttributes(); > return filter; > } >=20 > /** > * The updateFilter is used by updateAction and createAction and = says to allow updating any attributes of an > * TileV2. > * @return > */ > public static ERXKeyFilter updateFilter() { > ERXKeyFilter filter =3D = ERXKeyFilter.filterWithAttributes(); > return filter; > } >=20 > @Override > public WOActionResults updateAction() { > TileV2 tilev2 =3D tilev2(); > update(tilev2, updateFilter()); > editingContext().saveChanges(); > return response(tilev2, showFilter()); > } >=20 > @Override > public WOActionResults destroyAction() throws Throwable { > TileV2 tilev2 =3D tilev2(); > tilev2.delete(); > editingContext().saveChanges(); > return response(tilev2, showFilter()); > } >=20 > @Override > public WOActionResults newAction() throws Throwable { > TileV2 tilev2 =3D TileV2.createTileV2(editingContext(), = "New Description", null, "New Tile", = ((com.mozaic.app.Session)session()).getTenant()); > return response(tilev2, showFilter()); > } >=20 > @Override > public WOActionResults showAction() { > return response(tilev2(), showFilter()); > } >=20 > /** > * indexAction uses an ERXRestFetchSpecification, which = optionally allows you to expose sorting, qualifying, and batching in = query parameters=20 > */ > @Override > public WOActionResults indexAction() { > if (isSchemaRequest()) { > return schemaResponse(showFilter()); > } > ERXRestFetchSpecification fetchSpec =3D new = ERXRestFetchSpecification<>(TileV2.ENTITY_NAME, null, null, = queryFilter(), TileV2.NAME.ascs(), 25); > return response(fetchSpec, showFilter()); > } >=20 >=20 > } >=20 --Apple-Mail=_C6079A29-E4E0-4DAD-AE08-4BDF5766F712 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello= Don,

are you using = an Apache? In my case I had to modify webobjects.conf:

# Specific to Apache = 2.4
<Location /cgi-bin/WebObjects/>
  =   <Limit GET POST PUT OPTIONS >
  =     Require all granted
    </Limit>
    Require all = denied
</Location>   

Peer



Am 03.02.2021 um 07:21 schrieb = Don Lindsay <webobjects-dev@wocommunity.org>:

Hello;

I have a ERRest project. = Everything seems to be working except for when I update an entity the = updateAction never gets called.  I put breakpoints in the source = code on createAction, updateAction, indexAction, showAction. The method = that gets called for PUT is indexAction.  Am I doing something = wrong with the code, I took a look at the example apps in Project Wonder = and used them to create my boilerplate.
  
Thanks,

Don


The request from the developer tools in the = browser:

<PastedGraphic-1.png>= ;


How the data is being sent:

$.ajax({
url: '/cgi-bin/WebObjects/xxxxxx.woa/ra/TileV2',
= type: =E2=80=98PUT',
data: workingObject,
dataType: 'json',
= contentType: 'application/json',
success: function (data) = {
comp._currentTile =3D data;
console.log(JSON.stringify(data))
bootbox.alert({
= title: "Tile Save",
message: "Tile saved successfully",
centerVertical: = true
= });
comp.resetDirty();
comp.initialize(window.connectorsjson, window.tilejson);;
},
error: function (data) {
bootbox.alert({
= title: "Tile Save",
message: "Saving the tile failed, please try again = later",
= centerVertical: true
});
}
});



TileV2Controller.java

public class TileV2Controller extends BaseRestController = {

public = TileV2Controller(WORequest request) {
= super(request);
= // TODO Auto-generated constructor stub
}

= @Override
public = WOActionResults createAction() throws Throwable {
TileV2 tilev2 =3D = create(createInFilter());
= editingContext().saveChanges();
= return response(tilev2,outFilter());
= }
public = ERXKeyFilter createInFilter() {
= return ERXKeyFilter.filterWithAttributes();
= }
public = ERXKeyFilter outFilter() {
= ERXKeyFilter out = =3D createInFilter();
= return = out;
= }
/**
* = Returns the value of the "tile" variable from the route.
* @return
*/
= public TileV2 tilev2() {
= TileV2 tilev2 =3D routeObjectForKey("tileV2");
= tilev2.setTenant(((com.mozaic.app.Session)session()).get= Tenant());
return tilev2;
= }
/**
* The = query filter is used in indexAction to control what attributes and = relationships
= * you expose to qualifiers through query parameters
= * 
* = @return
*/
= public static ERXKeyFilter queryFilter() {
ERXKeyFilter filter =3D ERXKeyFilter.filterWithAllRecursive();
= filter.includeAll();
= return = filter;
= }
/**
* This = showFilter is used by indexAction and showAction and says to return all = attributes
= * of an TileV2, and for the owner, include all of its = attributes. 
= */
public = static = ERXKeyFilter showFilter() {
= ERXKeyFilter filter =3D ERXKeyFilter.filterWithAttributes();
= return = filter;
= }
/**
* The = updateFilter is used by updateAction and createAction and says to allow = updating any attributes of an
* TileV2.
* @return
*/
= public static ERXKeyFilter updateFilter() {
ERXKeyFilter = filter =3D = ERXKeyFilter.filterWithAttributes();
= return= filter;
= }
@Override
public WOActionResults = updateAction() {
= TileV2 tilev2 =3D = tilev2();
= update(tilev2, = updateFilter());
= editingContext().saveChanges();
= return response(tilev2, showFilter());
}

= @Override
public = WOActionResults destroyAction() throws Throwable {
TileV2 tilev2 =3D = tilev2();
= tilev2.delete();
= editingContext().saveChanges();
= return response(tilev2, showFilter());
}

= @Override
public = WOActionResults newAction() throws Throwable {
= TileV2 tilev2 =3D = TileV2.createTileV2(editingContext(), "New Description", null, "New Tile",  = ((com.mozaic.app.Session)session()).getTenant());
return response(tilev2, showFilter());
= }
@Override
public WOActionResults showAction() = {
return response(tilev2(), = showFilter());
= }
/**
* = indexAction uses an ERXRestFetchSpecification, which optionally allows = you to expose sorting, qualifying, and batching in query = parameters 
= */
@Override
public WOActionResults indexAction() = {
if (isSchemaRequest()) = {
return = schemaResponse(showFilter());
= }
= ERXRestFetchSpecification<TileV2> fetchSpec =3D new = ERXRestFetchSpecification<>(TileV2.ENTITY_NAME, null, null, queryFilter(), TileV2.NAME.ascs(), = 25);
return response(fetchSpec, showFilter());
= }
}


= --Apple-Mail=_C6079A29-E4E0-4DAD-AE08-4BDF5766F712--