Re: Struts2 Rest Mapper Taking Over Non Rest Json Result

2016-09-20 Thread Ken McWilliams
To solve a similar issue I ended up creating my own ContentTypeHandler. As
you already have a result it should be pretty easy to wrap (at least I
found it so). The problem is that after doing so all JSON will be handled
by your new Content type...

While this link shows how to use Jackson, you can create your own
implementation and then apply your own configuration in the same way:
http://struts.apache.org/docs/rest-plugin.html#RESTPlugin-UseJacksonframeworkasJSONContentTypeHandler




On Tue, Sep 20, 2016 at 12:34 PM, Paul Zepernick <
paul.zepern...@healthsmart.com> wrote:

> Thanks Martin, it was getting to the correct action class buy it was not
> using the result I defined in the action.  It was going to its own result
> implementation based on the fact that I am requesting an application/json
> data type.  I found out that if I add ".action" to the url it processes
> everything correctly and goes to the correct result.  I am not sure if that
> is the intended behavior, a setup issue on my part, or a bug?
>
> -Original Message-
> From: Martin Gainty [mailto:mgai...@hotmail.com]
> Sent: Tuesday, September 20, 2016 2:24 PM
> To: Struts Users Mailing List <user@struts.apache.org>
> Subject: RE: Struts2 Rest Mapper Taking Over Non Rest Json Result
>
> to control navigation why not map it? className="org.healthsmart.NonRestfulAction"> name="id">{1}...
> GET: /grid/method="index"when you reference /grid/ struts will call
> org.healthsmart.NonRestfulAction index method https://struts.apache.org/
> docs/restfulactionmapper.html
>
> or use DMI
> 
>   
> /WEB-INF/content/hello.jsp name="redisplay" type="redirectAction">hello
> add
> https://struts.apache.org/docs/action-configuration.
> html#ActionConfiguration-ActionMappings
> I would check struts.mapper.prefixMapping for normal "rest prefixMapping
> vs struts prefixMapping" configurationhttps://struts.apache.org/docs/
> restfulactionmapper.html
> if that looks ok as a last result you can implement a custom mapper which
> will read the URL and redirect to correct class programaticallyhttp://
> stackoverflow.com/questions/17697432/struts2-rest-plugin-making-
> both-struts-actions-rest-actions-work-together-but
> Martin
> __
>
>
>
> > From: paul.zepern...@healthsmart.com
> > To: user@struts.apache.org
> > Subject: Struts2 Rest Mapper Taking Over Non Rest Json Result
> > Date: Tue, 20 Sep 2016 15:28:42 +
> >
> > This was also posted to stackoverflow and relevant config information
> can be seen in the post: http://stackoverflow.com/
> questions/39593721/struts2-rest-mapper-taking-over-non-rest-json-result
> >
> > I am working with the DataTables JS library and am trying to write
> actions for the grid. I have a api in place that creates the json for me
> already and I just need to stream it back. I created a custom result to
> handle this, but the result mapped in the action never runs. No matter what
> the result type, the REST mapper tries to handle it as soon as it sees that
> application/json has been requested from the client. I have used the prefix
> mapping in the configuration to have all url's using /grid to bypass the
> rest mapper. It seems to be working in some capacity because it runs the
> correct interceptor stack and is using the @Action annotation information
> to map the url. However, the result specified is NOT running and is instead
> being provided by the rest mapper based on the stack trace I am receiving.
> I would like to completely bypass the rest mapper for any actions in the
> /grid namespace. Have I done something wrong in the configuration that is
> still causing rest to be involved in the request to those actions?
> >
> > Paul R. Zepernick
> > Sr. Programmer Analyst
> >
> >
> >
> >
> >
> >
> > Disclaimer: This communication and any files transmitted with it may
> contain information that is privileged, confidential and/or exempt from
> disclosure under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or use of
> the information contained herein (including any reliance thereon) is
> strictly prohibited. If you received this communication in error, please
> immediately contact the sender and destroy the material in its entirety,
> whether in electronic or hard copy format. Thank you.
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


RE: Struts2 Rest Mapper Taking Over Non Rest Json Result

2016-09-20 Thread Paul Zepernick
Thanks Martin, it was getting to the correct action class buy it was not using 
the result I defined in the action.  It was going to its own result 
implementation based on the fact that I am requesting an application/json data 
type.  I found out that if I add ".action" to the url it processes everything 
correctly and goes to the correct result.  I am not sure if that is the 
intended behavior, a setup issue on my part, or a bug?

-Original Message-
From: Martin Gainty [mailto:mgai...@hotmail.com] 
Sent: Tuesday, September 20, 2016 2:24 PM
To: Struts Users Mailing List <user@struts.apache.org>
Subject: RE: Struts2 Rest Mapper Taking Over Non Rest Json Result

to control navigation why not map it?{1}   
 ...
GET: /grid/method="index"when you reference /grid/ struts will call 
org.healthsmart.NonRestfulAction index method 
https://struts.apache.org/docs/restfulactionmapper.html

or use DMI
  
  /WEB-INF/content/hello.jsphello
add
https://struts.apache.org/docs/action-configuration.html#ActionConfiguration-ActionMappings
I would check struts.mapper.prefixMapping for normal "rest prefixMapping vs 
struts prefixMapping" 
configurationhttps://struts.apache.org/docs/restfulactionmapper.html
if that looks ok as a last result you can implement a custom mapper which will 
read the URL and redirect to correct class 
programaticallyhttp://stackoverflow.com/questions/17697432/struts2-rest-plugin-making-both-struts-actions-rest-actions-work-together-but
Martin
__ 



> From: paul.zepern...@healthsmart.com
> To: user@struts.apache.org
> Subject: Struts2 Rest Mapper Taking Over Non Rest Json Result
> Date: Tue, 20 Sep 2016 15:28:42 +
> 
> This was also posted to stackoverflow and relevant config information can be 
> seen in the post: 
> http://stackoverflow.com/questions/39593721/struts2-rest-mapper-taking-over-non-rest-json-result
> 
> I am working with the DataTables JS library and am trying to write actions 
> for the grid. I have a api in place that creates the json for me already and 
> I just need to stream it back. I created a custom result to handle this, but 
> the result mapped in the action never runs. No matter what the result type, 
> the REST mapper tries to handle it as soon as it sees that application/json 
> has been requested from the client. I have used the prefix mapping in the 
> configuration to have all url's using /grid to bypass the rest mapper. It 
> seems to be working in some capacity because it runs the correct interceptor 
> stack and is using the @Action annotation information to map the url. 
> However, the result specified is NOT running and is instead being provided by 
> the rest mapper based on the stack trace I am receiving. I would like to 
> completely bypass the rest mapper for any actions in the /grid namespace. 
> Have I done something wrong in the configuration that is still causing rest 
> to be involved in the request to those actions?
> 
> Paul R. Zepernick
> Sr. Programmer Analyst
> 
> 
> 
> 
> 
> 
> Disclaimer: This communication and any files transmitted with it may contain 
> information that is privileged, confidential and/or exempt from disclosure 
> under applicable law. If you are not the intended recipient, you are hereby 
> notified that any disclosure, copying, distribution, or use of the 
> information contained herein (including any reliance thereon) is strictly 
> prohibited. If you received this communication in error, please immediately 
> contact the sender and destroy the material in its entirety, whether in 
> electronic or hard copy format. Thank you.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
  

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Struts2 Rest Mapper Taking Over Non Rest Json Result

2016-09-20 Thread Martin Gainty
to control navigation why not map it?{1}   
 ...
GET: /grid/method="index"when you reference /grid/
struts will call org.healthsmart.NonRestfulAction index method 
https://struts.apache.org/docs/restfulactionmapper.html

or use DMI
  
  /WEB-INF/content/hello.jsphello
add
https://struts.apache.org/docs/action-configuration.html#ActionConfiguration-ActionMappings
I would check struts.mapper.prefixMapping for normal "rest prefixMapping vs 
struts prefixMapping" 
configurationhttps://struts.apache.org/docs/restfulactionmapper.html
if that looks ok as a last result you can implement a custom mapper which will 
read the URL and redirect to correct class 
programaticallyhttp://stackoverflow.com/questions/17697432/struts2-rest-plugin-making-both-struts-actions-rest-actions-work-together-but
Martin 
__ 



> From: paul.zepern...@healthsmart.com
> To: user@struts.apache.org
> Subject: Struts2 Rest Mapper Taking Over Non Rest Json Result
> Date: Tue, 20 Sep 2016 15:28:42 +
> 
> This was also posted to stackoverflow and relevant config information can be 
> seen in the post: 
> http://stackoverflow.com/questions/39593721/struts2-rest-mapper-taking-over-non-rest-json-result
> 
> I am working with the DataTables JS library and am trying to write actions 
> for the grid. I have a api in place that creates the json for me already and 
> I just need to stream it back. I created a custom result to handle this, but 
> the result mapped in the action never runs. No matter what the result type, 
> the REST mapper tries to handle it as soon as it sees that application/json 
> has been requested from the client. I have used the prefix mapping in the 
> configuration to have all url's using /grid to bypass the rest mapper. It 
> seems to be working in some capacity because it runs the correct interceptor 
> stack and is using the @Action annotation information to map the url. 
> However, the result specified is NOT running and is instead being provided by 
> the rest mapper based on the stack trace I am receiving. I would like to 
> completely bypass the rest mapper for any actions in the /grid namespace. 
> Have I done something wrong in the configuration that is still causing rest 
> to be involved in the request to those actions?
> 
> Paul R. Zepernick
> Sr. Programmer Analyst
> 
> 
> 
> 
> 
> 
> Disclaimer: This communication and any files transmitted with it may contain 
> information that is privileged, confidential and/or exempt from disclosure 
> under applicable law. If you are not the intended recipient, you are hereby 
> notified that any disclosure, copying, distribution, or use of the 
> information contained herein (including any reliance thereon) is strictly 
> prohibited. If you received this communication in error, please immediately 
> contact the sender and destroy the material in its entirety, whether in 
> electronic or hard copy format. Thank you.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>