-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from dotCMS/release-5.2
Release 5.2
- Loading branch information
Showing
22 changed files
with
50 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 17 additions & 36 deletions
53
OSGi/com.dotcms.aop/src/main/java/com/dotcms/plugin/aop/rest/MyContentResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,62 @@ | ||
package com.dotcms.plugin.aop.rest; | ||
|
||
import com.dotcms.repackage.javax.ws.rs.*; | ||
import com.dotcms.repackage.javax.ws.rs.core.Context; | ||
import com.dotcms.repackage.javax.ws.rs.core.MediaType; | ||
import com.dotcms.repackage.javax.ws.rs.core.Response; | ||
import com.dotcms.repackage.org.glassfish.jersey.server.JSONP; | ||
import com.dotcms.rest.InitDataObject; | ||
import com.dotcms.rest.ResponseEntityView; | ||
import com.dotcms.rest.WebResource; | ||
import com.dotcms.rest.annotation.NoCache; | ||
import com.dotcms.rest.exception.mapper.ExceptionMapperUtil; | ||
import com.dotcms.util.LogTime; | ||
import com.dotcms.vanityurl.business.VanityUrlAPI; | ||
import com.dotmarketing.business.APILocator; | ||
import com.dotmarketing.exception.DotDataException; | ||
import com.dotmarketing.exception.DotSecurityException; | ||
import com.dotmarketing.portlets.contentlet.business.ContentletAPI; | ||
import com.dotmarketing.portlets.contentlet.model.Contentlet; | ||
import com.liferay.portal.model.User; | ||
import org.glassfish.jersey.server.JSONP; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.Context; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
@Path("/v1/custom/content") | ||
public class MyContentResource { | ||
|
||
private final WebResource webResource = new WebResource(); | ||
private final MyContentService contentService = new MyContentService(); | ||
private final ContentletAPI contentletAPI = APILocator.getContentletAPI(); | ||
private final VanityUrlAPI vanityUrlAPI = APILocator.getVanityUrlAPI(); | ||
|
||
@GET | ||
@Path("/inode/{inode}") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@LogTime | ||
public Response getContentByInode(@Context final HttpServletRequest request, | ||
@PathParam("inode") final String inode) { | ||
@Context final HttpServletResponse response, | ||
@PathParam("inode") final String inode) throws DotSecurityException, DotDataException { | ||
|
||
final InitDataObject initData = this.webResource.init | ||
(null, true, request, false, null); | ||
(request, response, false); | ||
final User user = initData.getUser(); | ||
Contentlet contentlet = null; | ||
Response response = null; | ||
|
||
try { | ||
|
||
contentlet = this.contentService.hydrateContentLet | ||
final Contentlet contentlet = this.contentService.hydrateContentLet | ||
(this.contentletAPI.find(inode, user, true)); | ||
|
||
response = Response.ok(new ResponseEntityView (contentlet)).build(); | ||
} catch (Exception e) { | ||
return Response.ok(new ResponseEntityView (contentlet)).build(); | ||
|
||
response = ExceptionMapperUtil.createResponse | ||
(e, Response.Status.INTERNAL_SERVER_ERROR); | ||
} | ||
|
||
return response; | ||
} | ||
|
||
@Path("/lastMonth") | ||
@DELETE | ||
@JSONP | ||
@NoCache | ||
@Produces({MediaType.APPLICATION_JSON, "application/javascript"}) | ||
public Response deleteLastMonthContent(@Context final HttpServletRequest request) { | ||
public Response deleteLastMonthContent(@Context final HttpServletRequest request, | ||
@Context final HttpServletResponse response) throws DotDataException { | ||
|
||
final InitDataObject initData = this.webResource.init | ||
(null, true, request, true, null); | ||
Response response = null; | ||
|
||
try { | ||
|
||
response = Response.ok(new ResponseEntityView | ||
this.webResource.init | ||
(request, response, false); | ||
return Response.ok(new ResponseEntityView | ||
(this.contentService.deleteLastMonthContent())).build(); | ||
} catch (DotDataException e) { | ||
response = ExceptionMapperUtil.createResponse | ||
(e, Response.Status.INTERNAL_SERVER_ERROR); | ||
} | ||
|
||
return response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters