Hello Joe,

> I'm trying to write a simple java web server using the simpleframework. I'm
> close, but I process anything in the method handler:

OK. I can't reproduce the problem, as I don't have access to that
framework. But perhaps I can give some hints to help locate the problem.


> (de handler (request response) (java response 'close))
> (setq cont (interface "org.simpleframework.http.core.Container" 'handle
> handler))
> (setq con (java "org.simpleframework.transport.connect.SocketConnection" T
> cont))
> (setq addr (java "java.net.InetSocketAddress" T 8005))
> (java con 'connect addr)

One note first: In PicoLisp, it is advisable to use uppercase names for
(local) variables, because otherwise there is a risc for name conflicts.

For example, the expression

   (setq con (java "org.simpleframework...

changes the value of the symbol 'con', which happens to be a function
(setting the CDR of a cell). Later calls to that function will crash.
This risk also exists for function parameters, so I would write the
above as:

   (de handler (Request Response)
      (java Response 'close) )

   (setq Cont
      (interface "org.simpleframework.http.core.Container" 'handle handler) )

   (setq Con
      (java "org.simpleframework.transport.connect.SocketConnection" T Cont) )

   (setq Addr (java "java.net.InetSocketAddress" T 8005))

   (java Con 'connect Addr)


But this is probably not the problem here.


> When I run this and then curl http://localhost:8005 I get the following
> exception:
> 
> java.lang.IllegalAccessException: Class PicoLisp$Number can not access a
> member
> of class org.simpleframework.http.core.ResponseEntity with modifiers
> "public"

It would be interesting to see _where_ things get wrong. Could you
try to trace the execution? Please call

   (trace 'java)
   (trace 'interface)

before starting execution. And possibly trace other functions too, e.g.
(trace 'handler), or (traceAll) to trace all Lisp-level functions.

There must be a situation where perhaps the argument type (number?)
doesn't match.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to