404 page not found for an unpublished detail page

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

404 page not found for an unpublished detail page

Yasin
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Chris Falzone-2
You can preview in preview mode in the editor.  it changes the +live:true to +working:true. 

On Wed, Dec 6, 2017 at 3:26 AM Yasin <[hidden email]> wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAMAbHgUwtsGKzQb5%3DnDyJdq3Y9Hwhc3B%3DwTX9%2BkD40M8CsmrMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
Indeed, it works on the demo site. Will have a closer look to our dotCMS instance.

Thank you!

Op woensdag 6 december 2017 15:51:43 UTC+1 schreef Chris Falzone:
You can preview in preview mode in the editor.  it changes the +live:true to +working:true. 

On Wed, Dec 6, 2017 at 3:26 AM Yasin <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="S46a6LWKCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dile...@...> wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
<a href="http://dotcms.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdotcms.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGFT4ej1MQxQ2vu3iAUqYQgS59efw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdotcms.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGFT4ej1MQxQ2vu3iAUqYQgS59efw&#39;;return true;">http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="S46a6LWKCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dotcms+un...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="S46a6LWKCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dot...@....
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/fc97267e-71c9-45a8-b690-af89493c0c74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
In reply to this post by Chris Falzone-2
Just tested this on the demo site and it doesn't work (tried it in edit, preview and live mode)



Op woensdag 6 december 2017 15:51:43 UTC+1 schreef Chris Falzone:
You can preview in preview mode in the editor.  it changes the +live:true to +working:true. 

On Wed, Dec 6, 2017 at 3:26 AM Yasin <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="S46a6LWKCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dile...@...> wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
<a href="http://dotcms.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdotcms.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGFT4ej1MQxQ2vu3iAUqYQgS59efw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdotcms.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGFT4ej1MQxQ2vu3iAUqYQgS59efw&#39;;return true;">http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="S46a6LWKCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dotcms+un...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="S46a6LWKCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dot...@....
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/bfaeb9d9-d045-4213-a071-44072e6f7d47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
Anyone?

Op woensdag 6 december 2017 17:38:09 UTC+1 schreef Yasin:
Just tested this on the demo site and it doesn't work (tried it in edit, preview and live mode)

<a href="https://i.imgur.com/NDMq6uY.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fi.imgur.com%2FNDMq6uY.png\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEKAm2ebgkscee0PCzYUu0XiF5g_g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fi.imgur.com%2FNDMq6uY.png\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEKAm2ebgkscee0PCzYUu0XiF5g_g&#39;;return true;">



Op woensdag 6 december 2017 15:51:43 UTC+1 schreef Chris Falzone:
You can preview in preview mode in the editor.  it changes the +live:true to +working:true. 

On Wed, Dec 6, 2017 at 3:26 AM Yasin <[hidden email]> wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
<a href="http://dotcms.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdotcms.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGFT4ej1MQxQ2vu3iAUqYQgS59efw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdotcms.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGFT4ej1MQxQ2vu3iAUqYQgS59efw&#39;;return true;">http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/dotcms/72997804-14b3-47e2-870b-966d7b2a674d%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/3a530e6b-643a-42c2-a2c6-9deab063d4c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

John Michael Thomas
In reply to this post by Yasin
I don't quite understand what you're trying to do.

If you view a page in the Preview mode in the page editor, it will show you what it's going to look like if you publish it (before it's published).  I just double-checked this on demo, and it's working fine for me - when I saved changes to a piece of content on the page in draft form, or added a new content item to a container on the page, the Preview mode showed both of those changes while the Live mode did not.

So can you be more specific about what you're doing?  For example, could you post a step-by-step on how you were able to reproduce your problem on demo?


This assumes you're accessing the page without any URL parameters, but from your post it sounds like somehow you're trying to pass a URL parameter (though I'm not sure how you would do that within the page editor).

On Wednesday, December 6, 2017 at 12:26:36 AM UTC-8, Yasin wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/34c6927c-02c1-49ef-9532-444854c46fcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
1. Login to demo.dotcms.com
2. Go to Content -> Search
3. Select content type "News" from the dropdownlist
4. Select all items and unpublish those
5. Go to Site -> Browser
6. Open index in news-events/news/
7. Click on of the news items in the listing (these are unpublished in step 4)
8. You will be redirected to a 404 error page instead of the DETAIL PAGE, because the news content is unpublished

I expect a redirect to the DETAIL PAGE so I can view my news content in unpublished state before actually publishing it.


Op woensdag 13 december 2017 16:11:54 UTC+1 schreef John Michael Thomas:
I don't quite understand what you're trying to do.

If you view a page in the Preview mode in the page editor, it will show you what it's going to look like if you publish it (before it's published).  I just double-checked this on demo, and it's working fine for me - when I saved changes to a piece of content on the page in draft form, or added a new content item to a container on the page, the Preview mode showed both of those changes while the Live mode did not.

So can you be more specific about what you're doing?  For example, could you post a step-by-step on how you were able to reproduce your problem on demo?


This assumes you're accessing the page without any URL parameters, but from your post it sounds like somehow you're trying to pass a URL parameter (though I'm not sure how you would do that within the page editor).

On Wednesday, December 6, 2017 at 12:26:36 AM UTC-8, Yasin wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/f8cf51a2-d4a2-4917-820b-14eb2c9c4d33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
In reply to this post by John Michael Thomas
Make sure to execute the steps below fast, otherwise the demo site will automatically reset and publish the content (step 4)

1. Login to demo.dotcms.com
2. Go to Content -> Search
3. Select content type "News" from the dropdownlist
4. Select all items and unpublish those
5. Go to Site -> Browser
6. Open index in news-events/news/
7. Click on of the news items in the listing (these are unpublished in step 4)
8. You will be redirected to a 404 error page instead of the DETAIL PAGE, because the news content is unpublished

I expect a redirect to the DETAIL PAGE so I can view my news content in unpublished state before actually publishing it.



Op woensdag 13 december 2017 16:11:54 UTC+1 schreef John Michael Thomas:
I don't quite understand what you're trying to do.

If you view a page in the Preview mode in the page editor, it will show you what it's going to look like if you publish it (before it's published).  I just double-checked this on demo, and it's working fine for me - when I saved changes to a piece of content on the page in draft form, or added a new content item to a container on the page, the Preview mode showed both of those changes while the Live mode did not.

So can you be more specific about what you're doing?  For example, could you post a step-by-step on how you were able to reproduce your problem on demo?


This assumes you're accessing the page without any URL parameters, but from your post it sounds like somehow you're trying to pass a URL parameter (though I'm not sure how you would do that within the page editor).

On Wednesday, December 6, 2017 at 12:26:36 AM UTC-8, Yasin wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/f5919628-ce83-4f56-8f2f-d037ac839b7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
In reply to this post by John Michael Thomas
Make sure to execute the steps below fast, otherwise the demo site will automatically reset and re-publish the content (step 4)

1. Login to demo.dotcms.com
2. Go to Content -> Search
3. Select content type "News" from the dropdownlist
4. Select all items and unpublish those
5. Go to Site -> Browser
6. Open index in news-events/news/
7. Click on of the news items in the listing (these are unpublished in step 4)
8. You will be redirected to a 404 error page instead of the DETAIL PAGE, because the news content is unpublished

I expect a redirect to the DETAIL PAGE so I can view my news content in unpublished state before actually publishing it.

Op woensdag 13 december 2017 16:11:54 UTC+1 schreef John Michael Thomas:
I don't quite understand what you're trying to do.

If you view a page in the Preview mode in the page editor, it will show you what it's going to look like if you publish it (before it's published).  I just double-checked this on demo, and it's working fine for me - when I saved changes to a piece of content on the page in draft form, or added a new content item to a container on the page, the Preview mode showed both of those changes while the Live mode did not.

So can you be more specific about what you're doing?  For example, could you post a step-by-step on how you were able to reproduce your problem on demo?


This assumes you're accessing the page without any URL parameters, but from your post it sounds like somehow you're trying to pass a URL parameter (though I'm not sure how you would do that within the page editor).

On Wednesday, December 6, 2017 at 12:26:36 AM UTC-8, Yasin wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/56dee9a0-d258-481a-912b-653b84358003%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

Yasin
In reply to this post by John Michael Thomas
Make sure to execute the steps below fast, otherwise the demo site will automatically reset and re-publish the content (step 4)

1. Login to demo.dotcms.com
2. Go to Content -> Search
3. Select content type "News" from the dropdownlist
4. Select all items and unpublish those
5. Go to Site -> Browser
6. Open index in news-events/news/
7. Click on one of the news items in the listing (these are unpublished in step 4)
8. You will be redirected to a 404 error page instead of the DETAIL PAGE (the page where you normally see the values/fields of the content), because the news content is unpublished

I expect a redirect to the DETAIL PAGE so I can view my news content in unpublished state before actually publishing it.

Op woensdag 13 december 2017 16:11:54 UTC+1 schreef John Michael Thomas:
I don't quite understand what you're trying to do.

If you view a page in the Preview mode in the page editor, it will show you what it's going to look like if you publish it (before it's published).  I just double-checked this on demo, and it's working fine for me - when I saved changes to a piece of content on the page in draft form, or added a new content item to a container on the page, the Preview mode showed both of those changes while the Live mode did not.

So can you be more specific about what you're doing?  For example, could you post a step-by-step on how you were able to reproduce your problem on demo?


This assumes you're accessing the page without any URL parameters, but from your post it sounds like somehow you're trying to pass a URL parameter (though I'm not sure how you would do that within the page editor).

On Wednesday, December 6, 2017 at 12:26:36 AM UTC-8, Yasin wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/d250e376-ecc9-4a60-85bd-fac0c68df731%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 404 page not found for an unpublished detail page

John Michael Thomas
In reply to this post by Yasin
Ah I understand now.

So the issue is not that you can't preview a page that's unpublished, but that you can't preview a URL mapped content item which is unpublished.

Each news article on the demo site is a content item of the "News" content type, which is displayed in the detail page when you access the URL map pattern for that content item (none of the news articles has it's own page).  However the way URL maps work, if a content item is not published, attempting to access the URL map pattern for that content item will return a 404 rather than show you the detail page.  That's just how URL mapping works (I could go into the details of why, but bottom line is that the detail page is still published even when the news item isn't, so page preview applies to the detail page but not the individual content item).

So unfortunately you can't preview a URL mapped content item which is unpublished, at least not directly.  Although there are a couple ways you might be able to do this, I hesitate to suggest them unless you're pretty experienced with Velocity, since they would both require some significant coding and testing.

The closest you can come to previewing an unpublished content item is just to view a published one and see how the content from the unpublished item will be formatted when it's displayed.  Once you've verified that the formatting on the detail page is correct, you just have to make sure that the values in the fields of each unpublished content item are correct, and expect the detail page to format it correctly once it's published.

Final note: If you're using the Push Publishing feature, you can also fully preview URL mapped content items by just publishing them on the authoring server and viewing them on the front-end of the authoring server before pushing the content item to the production server.  But this obviously doesn't help if you have a single server setup.


On Wednesday, December 6, 2017 at 12:26:36 AM UTC-8, Yasin wrote:
Hi,

I would like to preview the content of a detail page that is unpublished (in admin mode).

Instead of showing me the page, dotCMS returns a 404 not found (because the content is unpublished).

I've asked this question in the past as well and we managed it to fix it with a workaround, similar to the example below:

#if(!$UtilMethods.isSet($URLMapContent))
  #if($UtilMethods.isSet($request.getParameter("jobId")))
    #set($jobId = $request.getParameter("jobId"))
    #set($jobQuery = "+StructureName:AquentJob +AquentJob.jobId:${jobId}")
    #set($jobList = $dotcontent.pull($jobQuery, 1, "modDate desc"))
    #if($jobList.size() > 0)
      #set($job = $jobList.get(0))
      #set($URLMapContent  = $job)
    #end
  #end
#end

Unfortunately, the solution above isn't working anymore as of dotCMS 4.

When requesting a detail page whose content is unpublished it executes a query with criteria live:true deleted: false (see URLMapFilter class: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L170\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFrAWBsseZjTqrD3S4oAMldCbtyjg&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L170)

But since the content is unpublished the live:true criteria won't find this piece of content. It also checks if the parameter 'previewPage' is set, if so it uses the criteria working: true instead of live:true. See: <a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java%23L168\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRGU6nOR_wisZZ_G_dNeABsWSHQ&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java#L168

This is exactly what I need, but when I pass this parameter in the URL it doesn't get recognized and still live:true is used.

What am I supposed to do to get a preview of an unpublished content?

Thnx

My old thread

<a href="http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fforumarchive.dotcms.com%2F404-page-not-found-for-an-unpublished-detail-page-td5732682.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHcmqWkrVFkQZ9zjemaisVR6Qda-A&#39;;return true;">http://forumarchive.dotcms.com/404-page-not-found-for-an-unpublished-detail-page-td5732682.html

The URLMapFilter class

<a href="https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FdotCMS%2Fcore%2Fblob%2Fed48dd41f1822682087e2c82e40b03ca3f6d7fae%2FdotCMS%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdotmarketing%2Fcms%2Furlmap%2Ffilters%2FURLMapFilter.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEZemji3PiSeQznqI7WPe3IH8uRBw&#39;;return true;">https://github.com/dotCMS/core/blob/ed48dd41f1822682087e2c82e40b03ca3f6d7fae/dotCMS/src/main/java/com/dotmarketing/cms/urlmap/filters/URLMapFilter.java

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/da774c2b-5f06-4cbb-ab59-fded224f1a31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.