Re: Ajax Servlet Deployment

2015-05-20 Thread John Huss
If you are aren't on a recent version of Wonder, you need to be for this to
work - Ajax in servlet. Probably fixed about a year ago.
On Tue, May 19, 2015 at 4:14 PM Kevin Hinkson k...@coralstone.co wrote:

 Hi,
 I am attempting to deploy a web page where the page uses an
 AjaxFlexibleFileUpload component. This works in the development setup.
 However, once the page with the AjaxFlexibleFileUpload loads on the server
 the two XHRs that run come back with 200 responses but they are completely
 empty of content. This results in no file dialog appearing when a user
 attempts to select an image for upload.

 The errors that show in the browser JS console are
 JSONRpcClientException: error parsing result”, ReferenceError: Can't find
 variable: jsonrpc_0 and  ReferenceError: Can't find variable: jsonrpc_1.

 My local development setup is a (reverse) proxy through NGINX. The
 deployment is to a AWS Elastic Beanstalk, in Tomcat 7, Java 7 which uses
 Apache as a reverse proxy.

 I’ll admit I know very little about WebObjects and Ajax. It is not clear
 to me that I have all the correct steps for using Ajax components. One
 thing I did was to override pageWithName in the Application class.

 @Override
 public WOComponent pageWithName(String name, WOContext context)
 {
 log.error(application pageWithName  + name +   + context);
 WOComponent page = super.pageWithName(name, context);
 log.error(got page  + page);
 return page;
 }

 I noticed that when run locally there is nothing in the logs for the XHR
 requests because they load fine. However, when deployed to a Beanstalk
 instance I get the following.

 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -application
 pageWithName null er.extensions.appserver.ERXWOServletContext contextID=0
 requestSenderID=0.17.1.1.1.0.1 elementID=null
 sessionID=GpMB9KKAiBu1Rdv4MqVNu0
 request=er.extensions.appserver.ERXRequest
 (er.extensions.appserver.ERXRequest httpVersion=HTTP/1.0
 headers={accept=[*/*], accept-encoding=[gzip, deflate],
 accept-language=[en-us], connection=[Keep-Alive], content-length=[50],
 content-type=[text/plain],
 cookie=[JSESSIONID=727EEEFD467421EFD51BB2A65A0707BF], dnt=[1],
 host=[replaced.host.url], origin=[http://replaced.host.url], referer=[
 http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1],
 remote_addr=[104.200.104.189], user-agent=[Mozilla/5.0 (Macintosh; Intel
 Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6
 Safari/600.6.3], x-forwarded-host=[replaced.host.url],
 x-forwarded-server=[ip-172-31-26-217.ec2.internal],
 x-requested-with=[XMLHttpRequest], x-webobjects-adaptor-version=[5.2],
 x-webobjects-servlet-server-name=[replaced.host.url],
 x-webobjects-servlet-server-port=[80]} content-length=50 cookies=null
 userInfo={ServletConfig=org.apache.catalina.core.StandardWrapperFacade@7f127e0,
 ServletContext=org.apache.catalina.core.ApplicationContextFacade@6970e732,
 HttpServletRequest=org.apache.catalina.connector.RequestFacade@2b18fb03,
 HttpServletResponse=org.apache.catalina.connector.ResponseFacade@7507980f}
 storePageInBacktrackCache=true ) method=POST
 uri=/WebObjects/AdneroWeb.woa/ajax/0.0.17.1.1.1.0.1
 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO
 formValueEncoding=UTF-8 formValues={WOIsmapCoords =
 ({id:1,method:system.listMethods,params:[]}); }  response=null
 pageElement=null pageComponent=null currentComponent=null
 url=/WebObjects/AdneroWeb.woa urlApplicationNumber=-1
 distributionEnabled=false pageChanged=false pageReplaced=false

 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -got page
 com.adnero.finance.web.pages.Main name: com.adnero.finance.web.pages.Main
 subcomponents: null 


 I am guessing that this differences means that the ajax requests are not
 being handled by the Ajax Handler but are getting caught by the default
 handler or that they are falling back to pageWithName, (which then falls
 back to Main.class) when they should not be?

 My apache config for the proxy looks like this:

 RewriteEngine On

 RewriteCond %{REQUEST_URI} ^/WebObjects/Frameworks/ [NC]
 RewriteRule ^/WebObjects/Frameworks/(.+)$
 /WebServerResources/Frameworks/$1 [PT]

 RewriteCond %{REQUEST_URI} ^/WebObjects/Contents/ [NC]
 RewriteRule ^/WebObjects/Contents/(.+)$ /WebServerResources/Contents/$1
 [PT]

 RewriteCond %{REQUEST_URI}
 ^/WebObjects/AdneroWeb.woa/Contents/WebServerResources/ [NC]
 RewriteRule ^/WebObjects/AdneroWeb.woa/Contents/WebServerResources/(.+)$
 /WebServerResources/Contents/WebServerResources/$1 [PT]

 RewriteCond %{REQUEST_URI} ^/ishealthy$ [NC]
 RewriteRule ^/ishealthy$
 /WebObjects/AdneroWeb.woa/ra/Healthcheck/ishealthy [PT]

 Proxy *
 Order deny,allow
 Allow from all
 /Proxy

 ProxyPass / http://localhost:8080/ retry=0
 ProxyPassReverse / http://localhost:8080/
 ProxyPreserveHost on

 LogFormat %h (%{X-Forwarded-For}i) %l %u %t \%r\ %s %b \%{Referer}i\
 \%{User-Agent}i\
 ErrorLog /var/log/httpd/elasticbeanstalk-error_log
 

Re: Ajax Servlet Deployment

2015-05-20 Thread Kevin Hinkson
Hi John,

Thanks for the tip. I tried that and it wasn’t the issue per say. I also tried 
re-ordering the frameworks.

I did finally figure it out. The local development environment used an https 
connection and the ElasticBeanstalk one did not. Combined with the secure 
cookie property being on in Wonder this meant that the session was not 
available to the browser. This seems to have caused the issue.

Thanks for your help.

 On May 20, 2015, at 9:23 AM, John Huss johnth...@gmail.com wrote:
 
 If you are aren't on a recent version of Wonder, you need to be for this to 
 work - Ajax in servlet. Probably fixed about a year ago.
 On Tue, May 19, 2015 at 4:14 PM Kevin Hinkson k...@coralstone.co 
 mailto:k...@coralstone.co wrote:
 Hi,
 I am attempting to deploy a web page where the page uses an 
 AjaxFlexibleFileUpload component. This works in the development setup. 
 However, once the page with the AjaxFlexibleFileUpload loads on the server 
 the two XHRs that run come back with 200 responses but they are completely 
 empty of content. This results in no file dialog appearing when a user 
 attempts to select an image for upload.
 
 The errors that show in the browser JS console are JSONRpcClientException: 
 error parsing result”, ReferenceError: Can't find variable: jsonrpc_0 and  
 ReferenceError: Can't find variable: jsonrpc_1.
 
 My local development setup is a (reverse) proxy through NGINX. The deployment 
 is to a AWS Elastic Beanstalk, in Tomcat 7, Java 7 which uses Apache as a 
 reverse proxy.
 
 I’ll admit I know very little about WebObjects and Ajax. It is not clear to 
 me that I have all the correct steps for using Ajax components. One thing I 
 did was to override pageWithName in the Application class.
 
 @Override
 public WOComponent pageWithName(String name, WOContext context)
 {
 log.error(application pageWithName  + name +   + context);
 WOComponent page = super.pageWithName(name, context);
 log.error(got page  + page);
 return page;
 }
 
 I noticed that when run locally there is nothing in the logs for the XHR 
 requests because they load fine. However, when deployed to a Beanstalk 
 instance I get the following.
 
 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -application 
 pageWithName null er.extensions.appserver.ERXWOServletContext contextID=0 
 requestSenderID=0.17.1.1.1.0.1 elementID=null 
 sessionID=GpMB9KKAiBu1Rdv4MqVNu0 request=er.extensions.appserver.ERXRequest 
 (er.extensions.appserver.ERXRequest httpVersion=HTTP/1.0 
 headers={accept=[*/*], accept-encoding=[gzip, deflate], 
 accept-language=[en-us], connection=[Keep-Alive], content-length=[50], 
 content-type=[text/plain], 
 cookie=[JSESSIONID=727EEEFD467421EFD51BB2A65A0707BF], dnt=[1], 
 host=[replaced.host.url], origin=[http://replaced.host.url 
 http://replaced.host.url/], 
 referer=[http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1 
 http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1], 
 remote_addr=[104.200.104.189], user-agent=[Mozilla/5.0 (Macintosh; Intel Mac 
 OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 
 Safari/600.6.3], x-forwarded-host=[replaced.host.url], 
 x-forwarded-server=[ip-172-31-26-217.ec2.internal], 
 x-requested-with=[XMLHttpRequest], x-webobjects-adaptor-version=[5.2], 
 x-webobjects-servlet-server-name=[replaced.host.url], 
 x-webobjects-servlet-server-port=[80]} content-length=50 cookies=null 
 userInfo={ServletConfig=org.apache.catalina.core.StandardWrapperFacade@7f127e0,
  ServletContext=org.apache.catalina.core.ApplicationContextFacade@6970e732, 
 HttpServletRequest=org.apache.catalina.connector.RequestFacade@2b18fb03, 
 HttpServletResponse=org.apache.catalina.connector.ResponseFacade@7507980f} 
 storePageInBacktrackCache=true ) method=POST 
 uri=/WebObjects/AdneroWeb.woa/ajax/0.0.17.1.1.1.0.1 
 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO 
 formValueEncoding=UTF-8 formValues={WOIsmapCoords = 
 ({id:1,method:system.listMethods,params:[]}); }  response=null 
 pageElement=null pageComponent=null currentComponent=null 
 url=/WebObjects/AdneroWeb.woa urlApplicationNumber=-1 
 distributionEnabled=false pageChanged=false pageReplaced=false
 
 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -got page 
 com.adnero.finance.web.pages.Main name: com.adnero.finance.web.pages.Main 
 subcomponents: null 
 
 
 I am guessing that this differences means that the ajax requests are not 
 being handled by the Ajax Handler but are getting caught by the default 
 handler or that they are falling back to pageWithName, (which then falls back 
 to Main.class) when they should not be?
 
 My apache config for the proxy looks like this:
 
 RewriteEngine On
 
 RewriteCond %{REQUEST_URI} ^/WebObjects/Frameworks/ [NC]
 RewriteRule ^/WebObjects/Frameworks/(.+)$ /WebServerResources/Frameworks/$1 
 [PT]
 
 RewriteCond %{REQUEST_URI} ^/WebObjects/Contents/ [NC]
 RewriteRule ^/WebObjects/Contents/(.+)$ 

Ajax Servlet Deployment

2015-05-19 Thread Kevin Hinkson
Hi,
I am attempting to deploy a web page where the page uses an 
AjaxFlexibleFileUpload component. This works in the development setup. However, 
once the page with the AjaxFlexibleFileUpload loads on the server the two XHRs 
that run come back with 200 responses but they are completely empty of content. 
This results in no file dialog appearing when a user attempts to select an 
image for upload.

The errors that show in the browser JS console are JSONRpcClientException: 
error parsing result”, ReferenceError: Can't find variable: jsonrpc_0 and  
ReferenceError: Can't find variable: jsonrpc_1.

My local development setup is a (reverse) proxy through NGINX. The deployment 
is to a AWS Elastic Beanstalk, in Tomcat 7, Java 7 which uses Apache as a 
reverse proxy. 

I’ll admit I know very little about WebObjects and Ajax. It is not clear to me 
that I have all the correct steps for using Ajax components. One thing I did 
was to override pageWithName in the Application class.

@Override
public WOComponent pageWithName(String name, WOContext context) 
{
log.error(application pageWithName  + name +   + context);
WOComponent page = super.pageWithName(name, context);
log.error(got page  + page);
return page;
}

I noticed that when run locally there is nothing in the logs for the XHR 
requests because they load fine. However, when deployed to a Beanstalk instance 
I get the following.

ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -application 
pageWithName null er.extensions.appserver.ERXWOServletContext contextID=0 
requestSenderID=0.17.1.1.1.0.1 elementID=null sessionID=GpMB9KKAiBu1Rdv4MqVNu0 
request=er.extensions.appserver.ERXRequest 
(er.extensions.appserver.ERXRequest httpVersion=HTTP/1.0 
headers={accept=[*/*], accept-encoding=[gzip, deflate], 
accept-language=[en-us], connection=[Keep-Alive], content-length=[50], 
content-type=[text/plain], 
cookie=[JSESSIONID=727EEEFD467421EFD51BB2A65A0707BF], dnt=[1], 
host=[replaced.host.url], origin=[http://replaced.host.url], 
referer=[http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1], 
remote_addr=[104.200.104.189], user-agent=[Mozilla/5.0 (Macintosh; Intel Mac OS 
X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 
Safari/600.6.3], x-forwarded-host=[replaced.host.url], 
x-forwarded-server=[ip-172-31-26-217.ec2.internal], 
x-requested-with=[XMLHttpRequest], x-webobjects-adaptor-version=[5.2], 
x-webobjects-servlet-server-name=[replaced.host.url], 
x-webobjects-servlet-server-port=[80]} content-length=50 cookies=null 
userInfo={ServletConfig=org.apache.catalina.core.StandardWrapperFacade@7f127e0, 
ServletContext=org.apache.catalina.core.ApplicationContextFacade@6970e732, 
HttpServletRequest=org.apache.catalina.connector.RequestFacade@2b18fb03, 
HttpServletResponse=org.apache.catalina.connector.ResponseFacade@7507980f} 
storePageInBacktrackCache=true ) method=POST 
uri=/WebObjects/AdneroWeb.woa/ajax/0.0.17.1.1.1.0.1 
defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO 
formValueEncoding=UTF-8 formValues={WOIsmapCoords = 
({id:1,method:system.listMethods,params:[]}); }  response=null 
pageElement=null pageComponent=null currentComponent=null 
url=/WebObjects/AdneroWeb.woa urlApplicationNumber=-1 distributionEnabled=false 
pageChanged=false pageReplaced=false

ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -got page 
com.adnero.finance.web.pages.Main name: com.adnero.finance.web.pages.Main 
subcomponents: null 


I am guessing that this differences means that the ajax requests are not being 
handled by the Ajax Handler but are getting caught by the default handler or 
that they are falling back to pageWithName, (which then falls back to 
Main.class) when they should not be? 

My apache config for the proxy looks like this:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/WebObjects/Frameworks/ [NC]
RewriteRule ^/WebObjects/Frameworks/(.+)$ /WebServerResources/Frameworks/$1 [PT]

RewriteCond %{REQUEST_URI} ^/WebObjects/Contents/ [NC]
RewriteRule ^/WebObjects/Contents/(.+)$ /WebServerResources/Contents/$1 [PT]

RewriteCond %{REQUEST_URI} 
^/WebObjects/AdneroWeb.woa/Contents/WebServerResources/ [NC]
RewriteRule ^/WebObjects/AdneroWeb.woa/Contents/WebServerResources/(.+)$ 
/WebServerResources/Contents/WebServerResources/$1 [PT]

RewriteCond %{REQUEST_URI} ^/ishealthy$ [NC]
RewriteRule ^/ishealthy$ /WebObjects/AdneroWeb.woa/ra/Healthcheck/ishealthy [PT]

Proxy *
Order deny,allow
Allow from all
/Proxy

ProxyPass / http://localhost:8080/ retry=0
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on

LogFormat %h (%{X-Forwarded-For}i) %l %u %t \%r\ %s %b \%{Referer}i\ 
\%{User-Agent}i\
ErrorLog /var/log/httpd/elasticbeanstalk-error_log
TransferLog /var/log/httpd/elasticbeanstalk-access_log



I am completely lost as to what to try next. Any help in identifying why the 
Ajax requests are not being handled properly would be appreciated.



 ___