Does REST work?

576 views
Skip to first unread message

Adam Cameron

unread,
May 22, 2015, 3:47:12 AM5/22/15
to lu...@googlegroups.com
G'day:
I'm troubleshooting some code for someone on Twitter (https://twitter.com/cyndi104/status/600783012775747584).

Running the code on ColdFusion, I get the issue as per what Cyndi was seeing.

I wanted to see how Lucee handled the same (in an attempt to plug Lucee to her), but I can't seem to get REST to work on Lucee (4.5 or 5).

Here's what I did:
* The three files in her gist are in this dir: D:\Websites\www.scribble.local\shared\junk\cyndi
* In Lucee server admin, I set up a REST mapping - /cyndi - pointing to that dir. I opt for it to NOT be the default app
* I also check the option to list REST services if I browse to /rest
* I have modified her code so that the URLs are http://#CGI.http_host#/rest/cyndi/, not http://www.yoursite.com/

These are the steps I took on CF, and they work.

On Lucee, when I browse to /rest, I get this:

Available sevice mappings are:
  • /rest/cyndi
So far, so good. If I browse to /rest/cyndi, I get:

no rest service for [/cyndi] found

Perhaps fair enough, as the end points have specific names in that code, and I'm not actually browsing to them

However if I browse to one of the defined endpoints, eg: /rest/cyndi/MyHandler1/MyTest/true, then I get this:

Lucee 4.5.0.042 Error (missinginclude)
MessagePage ../../../../../../null [C:\null] not found
Java StacktracePage ../../../../../../null [C:\null] not found 
  at lucee.runtime.PageSourceImpl.loadPage(Unknown Source):-1 
  at lucee.runtime.component.ComponentLoader.loadComponent(Unknown Source):-1 
  at lucee.runtime.component.ComponentLoader.loadComponent(Unknown Source):-1 
  at lucee.runtime.rest.Mapping._init(Unknown Source):-1 

etc.

Same on Lucee 5.

It looks very much to me like a bug in Lucee, but given what a drama ColdFusion has managed to maker out of /rest services, it would not surprise me if Lucee had non-obvious "idiosyncrasies" too.

Is there something else I need to do?

Cheers.

-- 
Adam







AJ Mercer

unread,
May 22, 2015, 3:58:18 AM5/22/15
to lu...@googlegroups.com
does this one work?
     /rest/cyndi/MyHandler1/MyTest/true

try putting / before restpath

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/7063023d-01f1-41a2-a7f5-195d699ad569%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

AJ Mercer

unread,
May 22, 2015, 3:59:36 AM5/22/15
to lu...@googlegroups.com
ops
/rest/cyndi/MyHandler2/MyTest/true

Adam Cameron

unread,
May 22, 2015, 4:45:01 AM5/22/15
to lu...@googlegroups.com


On Friday, 22 May 2015 08:59:36 UTC+1, AJ Mercer wrote:
ops
/rest/cyndi/MyHandler2/MyTest/true

Same error.

-- 
Adam 

AJ Mercer

unread,
May 22, 2015, 10:32:47 PM5/22/15
to lu...@googlegroups.com
looks like it is the data type on the arguments
data on the URL (and POST) scope are stings

try this

component rest="true" name="myHandler2" restPath="MyHandler2" output="false" {
remote any function GetHandler(required string booleanVal restargsource="path") 
restpath="MyTest/{booleanVal}"  
httpmethod="GET" produces="application/json" {

return arguments.booleanVal;  //booleanVal will be no because yes was passed in not true
}
}

 


On 22 May 2015 at 15:47, Adam Cameron <camero...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/7063023d-01f1-41a2-a7f5-195d699ad569%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Cameron

unread,
May 23, 2015, 3:31:31 AM5/23/15
to lu...@googlegroups.com


On Saturday, 23 May 2015 03:32:47 UTC+1, AJ Mercer wrote:
looks like it is the data type on the arguments
data on the URL (and POST) scope are stings

It's not even finding the file mate; it doesn't matter what's in it!

-- 
Adam 

Adam Cameron

unread,
May 23, 2015, 4:01:11 AM5/23/15
to lu...@googlegroups.com


On Friday, 22 May 2015 08:47:12 UTC+1, Adam Cameron wrote:

Lucee 4.5.0.042 Error (missinginclude)
MessagePage ../../../../../../null [C:\null] not found
Java StacktracePage ../../../../../../null [C:\null] not found 
  at lucee.runtime.PageSourceImpl.loadPage(Unknown Source):-1 
  at lucee.runtime.component.ComponentLoader.loadComponent(Unknown Source):-1 
  at lucee.runtime.component.ComponentLoader.loadComponent(Unknown Source):-1 
  at lucee.runtime.rest.Mapping._init(Unknown Source):-1 


Hmmm... some more information here. For the sake of completeness I decided to demonstrate AJ's suggestion isn't relevant, but am at home now so needed to set the code / mapping up again on my home machine (I was @ work y/day). And on this machine it works fine on Lucee 5. 

On Lucee 4.5 I get this:

Lucee 4.5.1.015 Error (java.lang.StringIndexOutOfBoundsException)
MessageString index out of range: -15
Causejava.lang.StringIndexOutOfBoundsException
Java StacktraceString index out of range: -15 
  at java.lang.String.substring(String.java:1914):1914 
  at lucee.runtime.PageSourceImpl.createComponentName(PageSourceImpl.java:642):642 
  at lucee.runtime.PageSourceImpl.getComponentName(PageSourceImpl.java:591):591 
  at lucee.runtime.type.util.ComponentUtil.getClassname(ComponentUtil.java:324):324 
  at lucee.runtime.type.util.ComponentUtil.getComponentJavaAccess(ComponentUtil.java:104):104 
  at lucee.runtime.ComponentImpl.getJavaAccessClass(ComponentImpl.java:1852):1852 
  at lucee.runtime.ComponentImpl.getMetaData(ComponentImpl.java:1432):1432 
  at lucee.runtime.ComponentImpl.getMetaData(ComponentImpl.java:1406):1406 
  at lucee.runtime.ComponentImpl.getMetaData(ComponentImpl.java:1365):1365 
  at lucee.runtime.rest.Mapping._init(Mapping.java:142):142 
  at lucee.runtime.rest.Mapping.init(Mapping.java:100):100 
  at lucee.runtime.rest.Mapping.getResult(Mapping.java:208):208 
  at lucee.runtime.rest.RestRequestListener.execute(RestRequestListener.java:57):57 
  at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:121):121 
  at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:35):35 
  at lucee.runtime.PageContextImpl.executeRest(PageContextImpl.java:2188):2188 
  at lucee.runtime.engine.CFMLEngineImpl.serviceRest(CFMLEngineImpl.java:501):501 
  at lucee.loader.servlet.RestServlet.service(Unknown Source):-1 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:725):725 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291):291 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206 
  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52):52 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239):239 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206 
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219):219 
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106):106 
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501):501 
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142):142 
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79):79 
  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610):610 
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88):88 
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537):537 
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085):1085 
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658):658 
  at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222):222 
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556):1556 
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513):1513 
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142):1142 
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617):617 
  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61):61 
  at java.lang.Thread.run(Thread.java:745):745 
 
Timestamp23/05/15 08:54:09 BST
 
So that's interesting.

On Railo 4.2.2.004 final it works fine too.

I have another machine here... I'll try on that too and report back.

Is there any sensible troubleshooting steps I can take with this on the machine that's erroring, or more info that's worth providing?

Can someone else try running that code on their rig and see what they get?

Cheers.

-- 
Adam

Adam Cameron

unread,
May 23, 2015, 4:30:28 AM5/23/15
to lu...@googlegroups.com


On Saturday, 23 May 2015 09:01:11 UTC+1, Adam Cameron wrote:
I have another machine here... I'll try on that too and report back.


Same result on the other machine: Lucee 5 A-OK; Lucee 4.5: StringIndexoutOfBoundsException

One thing that occurs to me about my work machine... I might have done the mapping wrong. My Lucee installs are on my C: drive, and the websites are on the D: drive. I've a symlink in my Lucee  webroot pointing /shared to D:\websites\shared (so C:\apps\lucee\5\express\webapps\ROOT\shared is actually a resource on D: drive). Now I think I perhaps added the REST mapping via the D: drive directory, not the C: drive one. That might explain why Lucee is getting confused. Can't check this now, but will check on Mon.

AND... whilst my home machines are all C:-based, I still symlink in the shared dir into the Lucee webroot from another location. And indeed I was giving it the "wrong" path in the REST mapping: I was using the "real" path to the directory, not the linked one. Once I used the linked one on Lucee 4.5, it worked fine.

Odd how Railo 4.2 and Lucee 5 still manages to work it all out just fine. But not an issue, just "interesting".

So... nothing to see here... move along...

-- 
Adam


김태식

unread,
Jul 12, 2015, 11:51:12 PM7/12/15
to lu...@googlegroups.com
The same problem, why did it not resolved so far?
Also frequently down, and less trust in the lucce.

I will came back to railo.


2015년 5월 23일 토요일 오후 3시 30분 28초 UTC+7, Adam Cameron 님의 말:

Juan Aguilar

unread,
Jul 13, 2015, 9:39:33 AM7/13/15
to lu...@googlegroups.com
On Sunday, July 12, 2015 at 11:51:12 PM UTC-4, 김태식 wrote:
The same problem, why did it not resolved so far?
Also frequently down, and less trust in the lucce.

I will came back to railo.

Where your chances of having issues resolved right now are "../../../../../../null [C:\null] not found".

김태식

unread,
Jul 13, 2015, 1:07:56 PM7/13/15
to lu...@googlegroups.com
I installed to my windows server. (tomcat 8 and lucee war)
Then I will setup the rest mapping in lucee web admin, And the other is not a problem.
But rest, nothing happened. Tomcat does not recognize and display the 404 error.



2015년 7월 13일 월요일 오후 8시 39분 33초 UTC+7, Juan Aguilar 님의 말:

Carsten Klement

unread,
Jul 13, 2015, 1:17:04 PM7/13/15
to lu...@googlegroups.com
1st rx
-------- Ursprüngliche Nachricht --------
Von: 김태식 <actso...@gmail.com>
Datum: 13.07.2015 19:0zögvrfc (GMT+01:00)
Betreff: [xxfclrfvkvLuceeorccf] Re: Does rest of your  9work?

I installed to my windows server. (tomcat 8 and lucee war)
Then I will setup the rest mapping in lucee web admin, And the other is not a problem.
But rest, notpffhing happened. Tomcat does not recognize and display the 404 error.



2015년 7월 13일 월요일 오후 8시 39분 33초 UTC+7, Juan Aguilar 님의 말:
On Sunday, July 12, 2015 at 11:51:12 PM UTC-4, 김태식 wrote:
The same problem, why did it not resolved so far?
Also frequently down, and less trust in the lucce.

I will came back to railo.

Where your chances of having issues resolved right now are "../../../../../../null [C:\null] not found".

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Mark Drew

unread,
Jul 13, 2015, 1:26:31 PM7/13/15
to lu...@googlegroups.com
Check your web.xml  in the expanded war. The rest servlet might be commented out.

김태식 wrote:
--
You received this message because you are subscribed to the Google
Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+un...@googlegroups.com

To post to this group, send email to lu...@googlegroups.com

김태식

unread,
Jul 13, 2015, 3:12:11 PM7/13/15
to lu...@googlegroups.com
It was a waste of time in three days., It's too tired.
Railo also problem in tomcat 8 (8.0.24 version).

. whole configuration file no problem in conf/web.xml, WEB-INF/web.xml (both same)
(Issues)
- rest : not working 
- flex2gateway :not working.
  (error message :  MessageBrokerServlet failed to initialize due to runtime exception: Exception: flex.messaging.config.ConfigurationException: Please specify a valid 'services.configuration.file' in web.xml ...)




2015년 7월 14일 화요일 오전 12시 26분 31초 UTC+7, Mark Drew 님의 말:

Mark Drew

unread,
Jul 13, 2015, 3:27:49 PM7/13/15
to lu...@googlegroups.com
Dude. Share your web.xml. Can't help you unless you help us help you. 

Mark Drew
- Sent by typing with my thumbs. 
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/73c16e25-b5ac-4326-9ec1-5fe253756bbe%40googlegroups.com.

김태식

unread,
Jul 13, 2015, 3:50:01 PM7/13/15
to lu...@googlegroups.com

This files are web.xml file (web-inf/web.xml, conf/web.xml)
I removed lucee.war and installed railo.war to ROOT.from tomcat 8.0.24
but happened the same results.

Thanks.

2015년 7월 14일 화요일 오전 2시 27분 49초 UTC+7, Mark Drew 님의 말:
web-inf_web.xml
conf_web.xml

김태식

unread,
Jul 13, 2015, 5:00:22 PM7/13/15
to lu...@googlegroups.com
I founded the reason, rest directory created in webapps directory, so mapping is missing.
Maybe, I followed the documentation in other website, they will guide to wrong.

Be collapsed. 

So, finally rest supported, flex2gateway problem.

Thanks.


2015년 7월 14일 화요일 오전 2시 50분 1초 UTC+7, 김태식 님의 말:
Reply all
Reply to author
Forward
0 new messages