Re: [basex-talk] Nullpointer exception using http:send-mail with authentication details, no send-authorization attribute

2019-02-14 Thread Christian Grün
Hi Markus,

thanks for your bug report, which summarizes exactly how the attribute
is supposed to work. The bug has been encountered just recently; it is
fixed in the latest stable snapshot.

Best,
Christian



On Fri, Feb 15, 2019 at 2:57 AM Markus Wittenberg  wrote:
>
>  Hi there,
>
> I get a Nullpointer exception (see below) using the http:send-mail method 
> with authentication details (Basic Auth), but without the send-authorization 
> attribute in the http:request element.
>
> According to the EXPath HTTP Client Module spec 
> (http://expath.org/spec/http-client#d2e430) the send-authorization attribute 
> is not mandatory, default value false should be used if it is missing.
>
>
> Unexpected error: Improper use? Potential bug? Your feedback is welcome:
> Contact: basex-talk@mailman.uni-konstanz.de
> Version: BaseX 9.1.1
> Java: Oracle Corporation, 1.8.0_92
> OS: Windows 7, amd64
> Stack Trace:
> java.lang.NullPointerException
> at org.basex.util.http.HttpClient.setContentType(HttpClient.java:259)
> at org.basex.util.http.HttpClient.sendRequest(HttpClient.java:83)
> at org.basex.query.func.http.HttpSendRequest.iter(HttpSendRequest.java:34)
> at org.basex.query.expr.ParseExpr.value(ParseExpr.java:74)
> at org.basex.query.expr.gflwor.GFLWOR.value(GFLWOR.java:73)
> at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:181)
> at org.basex.query.func.FuncCall.invoke(FuncCall.java:89)
> at org.basex.query.func.FuncCall.value(FuncCall.java:62)
> at org.basex.query.func.FuncCall.iter(FuncCall.java:67)
> at org.basex.query.scope.MainModule.iter(MainModule.java:118)
> at org.basex.query.QueryContext.iter(QueryContext.java:335)
> at org.basex.http.restxq.RestXqResponse.serialize(RestXqResponse.java:73)
> at org.basex.http.web.WebResponse.create(WebResponse.java:56)
> at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:54)
> at org.basex.http.BaseXServlet.service(BaseXServlet.java:59)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:857)
> at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
> at 
> org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
> at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
> at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
> at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
> at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
> at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
> at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
> at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
> at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
> at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
> at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
> at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
> at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
> at 
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
> at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> at org.eclipse.jetty.server.Server.handle(Server.java:503)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
> at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
> at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
> at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
> at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
> at java.lang.Thread.run(Thread.java:745)
>
>
> Best regards
>
> --
> Markus Wittenberg
>
> Tel +49 (0)8382 911 07 24
> Mail wittenb...@axxepta.de
>
> 
>
> axxepta solutions GmbH
> Lehmgrubenweg 17, 88131 Lindau
>
> Amtsgericht Berlin HRB 97544B
> Geschäftsführer: Karsten Becke, Maximilian Gärber


[basex-talk] Nullpointer exception using http:send-mail with authentication details, no send-authorization attribute

2019-02-14 Thread Markus Wittenberg

 Hi there,

I get a Nullpointer exception (see below) using the http:send-mail 
method with authentication details (Basic Auth), but without the 
send-authorization attribute in the http:request element.


According to the EXPath HTTP Client Module spec 
(http://expath.org/spec/http-client#d2e430) the send-authorization 
attribute is not mandatory, default value false should be used if it is 
missing.



Unexpected error: Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.1.1
Java: Oracle Corporation, 1.8.0_92
OS: Windows 7, amd64
Stack Trace:
java.lang.NullPointerException
at org.basex.util.http.HttpClient.setContentType(HttpClient.java:259)
at org.basex.util.http.HttpClient.sendRequest(HttpClient.java:83)
at 
org.basex.query.func.http.HttpSendRequest.iter(HttpSendRequest.java:34)
at org.basex.query.expr.ParseExpr.value(ParseExpr.java:74)
at org.basex.query.expr.gflwor.GFLWOR.value(GFLWOR.java:73)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:181)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:89)
at org.basex.query.func.FuncCall.value(FuncCall.java:62)
at org.basex.query.func.FuncCall.iter(FuncCall.java:67)
at org.basex.query.scope.MainModule.iter(MainModule.java:118)
at org.basex.query.QueryContext.iter(QueryContext.java:335)
at 
org.basex.http.restxq.RestXqResponse.serialize(RestXqResponse.java:73)
at org.basex.http.web.WebResponse.create(WebResponse.java:56)
at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:54)
at org.basex.http.BaseXServlet.service(BaseXServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:857)
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at 
org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
at 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:745)


Best regards

--
Markus Wittenberg

Tel +49 (0)8382 911 07 24
Mail wittenb...@axxepta.de



axxepta solutions GmbH
Lehmgrubenweg 17, 88131 Lindau

Amtsgericht Berlin HRB 97544B
Geschäftsführer: Karsten Becke, Maximilian Gärber



Re: [basex-talk] Using HTTP Digest Authentication in a RESTXQ services

2019-02-14 Thread Christian Grün
Hi Omar,

Digest authentication with RESTXQ should work out of the box. The
following changes in the configuration may be required:

• You’ll need to enable digest authentication in the web.xml
configuration file [1]
• By default, the admin user is enabled for RESTXQ requests. You’ll
need to remove the corresponding entry [2]

Best
Christian

[1] 
https://github.com/BaseXdb/basex/blob/9a089491894a01f9d8edb5d30e695f18b13bc9c4/basex-api/src/main/webapp/WEB-INF/web.xml#L93-L96
[2] 
https://github.com/BaseXdb/basex/blob/9a089491894a01f9d8edb5d30e695f18b13bc9c4/basex-api/src/main/webapp/WEB-INF/web.xml#L32-L35



On Thu, Feb 14, 2019 at 6:35 PM Omar Siam  wrote:
>
> Hi list!
>
> I just experimented a bit to see if there is an obvious way to use HTTP
> digest authentication for some RESTXQ service I plan to write. I would
> prefer not to reimplement the HTTP digest logic in XQuery. I thought
> maybe there is a way to use the built in digest logic like for the REST
> endpoint. I don't seem to get that to work. Any suggestions?
>
> Best regards
>
> Omar Siam
>


[basex-talk] Using HTTP Digest Authentication in a RESTXQ services

2019-02-14 Thread Omar Siam

Hi list!

I just experimented a bit to see if there is an obvious way to use HTTP 
digest authentication for some RESTXQ service I plan to write. I would 
prefer not to reimplement the HTTP digest logic in XQuery. I thought 
maybe there is a way to use the built in digest logic like for the REST 
endpoint. I don't seem to get that to work. Any suggestions?


Best regards

Omar Siam



Re: [basex-talk] Schema 1.1 validation and Xerces cta-full-xpath-checking?

2019-02-14 Thread Christian Grün
> you may consider adding it explicitly to the Wiki example:

Contributions to our Wiki are welcome ;)


Re: [basex-talk] Schema 1.1 validation and Xerces cta-full-xpath-checking?

2019-02-14 Thread Zimmel, Daniel
This is FUN indeed. Thanks Christian!
Since I consider it a central feature when using Xerces 1.1 validation (it is 
one out of four controlled Xerces validation features in Oxygen options, too), 
you may consider adding it explicitly to the Wiki example:

validate:xsd($doc,$schema,map { 
'http://apache.org/xml/features/validation/cta-full-xpath-checking': true() })

Without the feature, you are limited to XPath 1.0 in your assertions.

Daniel

> -Ursprüngliche Nachricht-
> Von: Christian Grün [mailto:christian.gr...@gmail.com]
> Gesendet: Donnerstag, 14. Februar 2019 14:38
> An: Zimmel, Daniel; George Sofianos
> Cc: basex-talk@mailman.uni-konstanz.de
> Betreff: Re: [basex-talk] Schema 1.1 validation and Xerces cta-full-xpath-
> checking?
> 
> Hi Daniel, hi George,
> 
> With the latest snapshot of BaseX, XSD validation features can now be
> specified [1,2]. In addition to that,
> 
> • I have removed the version argument. The most recent supported
> version XML Schema will now be used by default.
> • Two additional functions can be used to retrieve the applied
> processor and the supported version.
> 
> Have fun,
> Christian
> 
> [1] http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation
> [2] http://files.basex.org/releases/latest/
> 
> 
> 
> On Mon, Nov 19, 2018 at 5:07 PM Zimmel, Daniel 
> wrote:
> >
> > Hi,
> >
> > is there any chance BaseX will support the cta-full-xpath-checking option 
> > (see
> https://xerces.apache.org/xerces2-j/features.html)? Without it, schema 1.1
> validation is limited.
> >
> > I could not find any switches to configure Xerces features, but did find 
> > someone
> mentioning it from two years ago:
> > https://www.mail-archive.com/basex-talk@mailman.uni-
> konstanz.de/msg08446.html
> >
> > Or have I missed something in the documentation?
> >
> > Regards, Daniel
> >
> >
> >


Re: [basex-talk] proc:execute

2019-02-14 Thread Giuseppe G. A. Celano
Hi Christian,

The problem with Mac is that it is not that easy to chance root settings. 
However, I have found a workaround, which may be useful to others: instead of 
invoking something like proc:system("python", "main.py"), I create a bash file 
like:

#!/bin/bash

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
absolute-path/python absolute-path/main.py

and then I run in Basex proc:system("bash", "path-to-the-bash-file"). This 
works!

Ciao,
Giuseppe

Dr. Giuseppe G. A. Celano
DFG-project leader 
Universität Leipzig
Institute of Computer Science, NLP
Augustusplatz 10
Tel: +4934132223
04109 Leipzig
Deutschland

E-mail: cel...@informatik.uni-leipzig.de 

Web site 1: http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano 
 
Web site 2: https://sites.google.com/site/giuseppegacelano/ 


> On Feb 13, 2019, at 5:16 PM, Christian Grün  wrote:
> 
> Hi Giuseppe,
> 
> Have you tried to set your locale variable on your system? If it’s
> Ubuntu, you could have a look here:
> 
> https://ubuntuforums.org/showthread.php?t=2212353
> 
> Hope this helps,
> Christian
> 
> 
> On Tue, Feb 12, 2019 at 4:13 PM Giuseppe G. A. Celano
>  wrote:
>> 
>> I notice that if I run "locale" from my MAC Terminal I get the correct one 
>> (utf-8), but if I run proc:system("locale") I get:
>> 
>> LANG=
>> LC_COLLATE="C"
>> LC_CTYPE="C"
>> LC_MESSAGES="C"
>> LC_MONETARY="C"
>> LC_NUMERIC="C"
>> LC_TIME="C"
>> LC_ALL=
>> 
>> Is there a way to force BaseX to start with utf-8? Thanks.
>> 
>> Ciao,
>> Giuseppe
>> 
>> 
>> 
>> On Feb 12, 2019, at 9:12 AM, Giuseppe G. A. Celano 
>>  wrote:
>> 
>> Hi Liam
>> 
>> Thanks. My locale is actually "en_US.UTF-8", so I do not know why the error 
>> is raised
>> 
>> On Feb 12, 2019, at 6:30 AM, Liam R. E. Quin  wrote:
>> 
>> On Tue, 2019-02-12 at 01:42 +0100, Giuseppe G. A. Celano wrote:
>> 
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
>> 5390: ordinal not in range(128)
>> 
>> 
>> A guess - sounds like an encoding error - 0xE2 is â in Unicode, and 128
>> suggests US ASCII was expected - check the encoding declaration on the
>> XML, or maybe it's a locale difference?
>> 
>> --
>> Liam Quin, https://www.delightfulcomputing.com/
>> Available for XML/Document/Information Architecture/XSLT/
>> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
>> Web slave for vintage clipart http://www.fromoldbooks.org/
>> 
>> 
>> 
> 



Re: [basex-talk] Global locks

2019-02-14 Thread Christian Grün
Hi Andy,

> Is it required to specify all databases accessed within the manualock scope 
> or could it work just specifying specific databases as readonly?
> And the execution would error if these were violated.

Sounds good. I have opened a new issue [1]; we welcome further syntax proposals.

Cheers
Christian

[1] https://github.com/BaseXdb/basex/issues/1664


Re: [basex-talk] Schema 1.1 validation and Xerces cta-full-xpath-checking?

2019-02-14 Thread Christian Grün
Hi Daniel, hi George,

With the latest snapshot of BaseX, XSD validation features can now be
specified [1,2]. In addition to that,

• I have removed the version argument. The most recent supported
version XML Schema will now be used by default.
• Two additional functions can be used to retrieve the applied
processor and the supported version.

Have fun,
Christian

[1] http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation
[2] http://files.basex.org/releases/latest/



On Mon, Nov 19, 2018 at 5:07 PM Zimmel, Daniel  wrote:
>
> Hi,
>
> is there any chance BaseX will support the cta-full-xpath-checking option 
> (see https://xerces.apache.org/xerces2-j/features.html)? Without it, schema 
> 1.1 validation is limited.
>
> I could not find any switches to configure Xerces features, but did find 
> someone mentioning it from two years ago:
> https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg08446.html
>
> Or have I missed something in the documentation?
>
> Regards, Daniel
>
>
>


Re: [basex-talk] Global locks

2019-02-14 Thread Andy Bunce
I look forward to the longer term solution :)
But in the meantime these pragmas, although not pretty, would allow
solutions to specific multitasking performance issues to be explored where
currently they can be difficult/impossible. I think there is a certain
elegance in advisory nature of pragmas.

>If manual locking is enabled, an error will be raised if a database is
accessed that has not been specified in a lock pragma.

Is it required to specify all databases accessed within the manualock scope
or could it work just specifying specific databases as readonly?
And the execution would error if these were violated.

/Andy

/Andy


On Wed, 13 Feb 2019 at 16:56, Christian Grün 
wrote:

> > Would this work where the database names are only known at run time?
>
> Right now, our locking is based on static code analysis; runtime
> information won’t be included. In the longer term, we would like to
> extend our compiler to perform multiple steps:
>
> 1. Static parsing
> 2. Static optimizations (pre-evaluate 1+2 to 3, etc.)
> 3. Dynamic optimizations (reoptimize the query with query parameters
> and other context information)
> 4. Physical optimizations (open databases, utilize available index
> structures)
>
> Queries that have been parsed and statically compiled (Step 1+2) could
> be stored as compiled queries, or kept in main-memory and duplicated
> before dynamic optimizations take place. This could further reduce
> access times in RESTXQ applications – and it would allow us to improve
> locking, as we could do the lock check after Step 3.
>


Re: [basex-talk] Docker Volumes Permission denied

2019-02-14 Thread Michael Seiferle
Hi Marie, 

thanks for your observations!

The explanation for this behavior is, that the `basexhttp` Process inside the 
container runs as non-privileged user `basex` with an UID of 1984 & GID 0.
Usually processes inside docker containers will run as root and as such will be 
able to read & write from all volumes you mount *inside* your container.
Currently `basexhttp` does not do that.
It mounts your directory from your host OS as a volume insider your container, 
yet the fie/folder it still belongs to its original user (in your case UID 
1000) but from inside the running docker image, a USER with UID 1984 wants to 
write to it. This fails.

Basically: 
>  chown -R 1984 ~/Projects/Architextus/basex-xquery-server/data

Should make your data directory writable to that process — and if it were group 
writable it is still writable by your host OS.
As you write repo & webapp  from the host os only, there is no need to change 
ownership on those folders.

* Another approach I/we usually take is building my own docker image derived 
from basexhttp and ADD my project to the image.

> FROM basex/basexhttp
> ADD ./webapp /srv/basex/webapp
> ADD ./repo /srv/basex/repo
> ADD ./data /srv/basex/data



Any thoughts on this by other docker users? Lot’s of containers run privileged, 
but I am not sure if we really want this.




Let me know if you  need any more help!

Michael






> Am 12.02.2019 um 14:42 schrieb Marie Starck :
> 
> Hello everyone,
> 
> So I am looking to add Docker to a BaseX webapp that is currently running 
> properly on my local. In order to do that, I ran
> docker run -ti -d
> --publish 1984:1984
> --publish 8984:8984
> --volume ~/Projects/Architextus/basex-xquery-server/data:/srv/BaseXData
> --volume ~/Projects/Architextus/basex-xquery-server/webapp:/srv/BaseXWeb
> --volume ~/Projects/Architextus/basex-xquery-server/repo:/srv/BaseXRepo
> basex/basexhttp:8.6.4
> 
> And while localhost:8984 shows me the regular BaseX introduction page, none 
> of the rest endpoints work and I get this error when I try to access the 
> webapp from my localhost:
> 
> Stopped at /srv/BaseXWeb/xqm/g-holismo.xqm, 136/24:
> [bxerr:BXDB0002] Resource "/srv/BaseXData/DITA-AppResources/tbl.basex 
> (Permission denied)" not found.
> 
> Stack Trace:
> - /srv/BaseXWeb/xqm/g-holismo.xqm, 11/10
> 
> I checked the permissions on my docker container and it seems that the basex 
> user only has permissions on WEB-INF but none of the volumes, BaseXData, 
> BaseXRepo and BaseXWeb, those are shown as belonging to user 1000.
> 
> Has anyone experienced this before?
> 
> Thank you for any help or tip you could provide,
> 
> Marie
>