You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (Created) (JIRA)" <ji...@apache.org> on 2012/01/24 19:50:41 UTC

[jira] [Created] (JENA-201) Deliver Fuseki as a WAR file.

Deliver Fuseki as a WAR file.
-----------------------------

                 Key: JENA-201
                 URL: https://issues.apache.org/jira/browse/JENA-201
             Project: Jena
          Issue Type: Improvement
          Components: Fuseki
            Reporter: Andy Seaborne
            Priority: Minor




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Rob Vesse (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13193359#comment-13193359 ] 

Rob Vesse commented on JENA-201:
--------------------------------

So here are my notes on progress so far.

Generating a war with maven is trivial by using the war:war goal once you've created a web.xml file in the appropriate place.

The tricky part looks to be configuration, usually Fuseki would pick up config from command line but this is not doable in WAR packaging

Unless anyone has objections my intention is to try using <context-param> elements to set up the defaults and then somehow get those to be used to configure the server at first run.  Problem is I can't see any obvious way to do this (but that may just be my lack of familiarity with the servlet specs), we actually don't really want to explicitly register servlets because we want to still to configure based on a config file.

The other option is to have a WAR which just has a default config for a single dataset with that dataset being defined by a config file so users can customize that.  I assume that this second option is not the preferred option

If anyone has ideas/input/opinions on this please chime in
                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Jacobus Geluk (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13208576#comment-13208576 ] 

Jacobus Geluk commented on JENA-201:
------------------------------------

Andy, I have created a [fork of jena-fuseki on github|https://github.com/jgeluk/jena-fuseki], where I used your main Joseki servlet as the basis for a similar Fuseki servlet. Called it [ConfigServlet|https://github.com/jgeluk/jena-fuseki/blob/trunk/src/main/java/org/apache/jena/fuseki/server/ConfigServlet.java] and put it next to the SPARQLServer class since it's kind of the Servlet-equivalent of that class. It loads the config.ttl but in order to dynamically create the other Servlets, like is done for Jetty in SPARQLServer, such as SPARQL_QueryGeneral and SPARQL_REST, I need to implement the Tomcat specific interface ContainerServlet, which makes it a privileged Servlet. Not really an elegant solution since it would require an additional parameter in Context.xml (and make it Tomcat specific).
So I guess the only proper way to do this is to make that dispatcher as you suggested. I guess it would be similar to what Joseki does then? Any hints?
                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Rob Vesse (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13193448#comment-13193448 ] 

Rob Vesse commented on JENA-201:
--------------------------------

Another notion is that you could have the base servlets declared but not mapped to paths and then use filters to remap requests to the relevant servlet based on URL patterns.  You'd need to integrate some on the fly config loading and caching but this might be the best way of actually achieving this
                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Jacobus Geluk (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13208576#comment-13208576 ] 

Jacobus Geluk edited comment on JENA-201 at 2/15/12 4:46 PM:
-------------------------------------------------------------

Andy, I have created a [https://github.com/jgeluk/jena-fuseki|fork of jena-fuseki on github], where I used your main Joseki servlet as the basis for a similar Fuseki servlet. Called it [ConfigServlet|https://github.com/jgeluk/jena-fuseki/blob/trunk/src/main/java/org/apache/jena/fuseki/server/ConfigServlet.java] and put it next to the SPARQLServer class since it's kind of the Servlet-equivalent of that class. It loads the config.ttl but in order to dynamically create the other Servlets, like is done for Jetty in SPARQLServer, such as SPARQL_QueryGeneral and SPARQL_REST, I need to implement the Tomcat specific interface ContainerServlet, which makes it a privileged Servlet. Not really an elegant solution since it would require an additional parameter in Context.xml (and make it Tomcat specific).
So I guess the only proper way to do this is to make that dispatcher as you suggested. I guess it would be similar to what Joseki does then? Any hints?
                
      was (Author: jgeluk):
    Andy, I have created a [fork of jena-fuseki on github|https://github.com/jgeluk/jena-fuseki], where I used your main Joseki servlet as the basis for a similar Fuseki servlet. Called it [ConfigServlet|https://github.com/jgeluk/jena-fuseki/blob/trunk/src/main/java/org/apache/jena/fuseki/server/ConfigServlet.java] and put it next to the SPARQLServer class since it's kind of the Servlet-equivalent of that class. It loads the config.ttl but in order to dynamically create the other Servlets, like is done for Jetty in SPARQLServer, such as SPARQL_QueryGeneral and SPARQL_REST, I need to implement the Tomcat specific interface ContainerServlet, which makes it a privileged Servlet. Not really an elegant solution since it would require an additional parameter in Context.xml (and make it Tomcat specific).
So I guess the only proper way to do this is to make that dispatcher as you suggested. I guess it would be similar to what Joseki does then? Any hints?
                  
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Jacobus Geluk (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13208576#comment-13208576 ] 

Jacobus Geluk edited comment on JENA-201 at 2/15/12 4:47 PM:
-------------------------------------------------------------

Andy, I have created a fork of jena-fuseki on github (https://github.com/jgeluk/jena-fuseki), where I used your main Joseki servlet as the basis for a similar Fuseki servlet. Called it ConfigServlet (https://github.com/jgeluk/jena-fuseki/blob/trunk/src/main/java/org/apache/jena/fuseki/server/ConfigServlet.java) and put it next to the SPARQLServer class since it's kind of the Servlet-equivalent of that class. It loads the config.ttl but in order to dynamically create the other Servlets, like is done for Jetty in SPARQLServer, such as SPARQL_QueryGeneral and SPARQL_REST, I need to implement the Tomcat specific interface ContainerServlet, which makes it a privileged Servlet. Not really an elegant solution since it would require an additional parameter in Context.xml (and make it Tomcat specific).
So I guess the only proper way to do this is to make that dispatcher as you suggested. I guess it would be similar to what Joseki does then? Any hints?
                
      was (Author: jgeluk):
    Andy, I have created a [https://github.com/jgeluk/jena-fuseki|fork of jena-fuseki on github], where I used your main Joseki servlet as the basis for a similar Fuseki servlet. Called it [ConfigServlet|https://github.com/jgeluk/jena-fuseki/blob/trunk/src/main/java/org/apache/jena/fuseki/server/ConfigServlet.java] and put it next to the SPARQLServer class since it's kind of the Servlet-equivalent of that class. It loads the config.ttl but in order to dynamically create the other Servlets, like is done for Jetty in SPARQLServer, such as SPARQL_QueryGeneral and SPARQL_REST, I need to implement the Tomcat specific interface ContainerServlet, which makes it a privileged Servlet. Not really an elegant solution since it would require an additional parameter in Context.xml (and make it Tomcat specific).
So I guess the only proper way to do this is to make that dispatcher as you suggested. I guess it would be similar to what Joseki does then? Any hints?
                  
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Rob Vesse (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259705#comment-13259705 ] 

Rob Vesse commented on JENA-201:
--------------------------------

So while I have not made further progress on this I think I now see how to proceed with this though I don't think I have time to work on this currently.

The main problem as previously discussed is keeping dynamic configuration while moving to a container agnostic WAR which on the face of it seems rather awkward but I believe this is doable.  I now believe that the way to this is by utilizing a ServletContextListener (http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html) - this is a part of the Java Servlets API and is easily registered in a web.xml file like so:

  <listener>
    <listener-class>org.apache.jena.fuseki.FusekiContextListener</listener-class>
  </listener>

Then the contextInitialized() method can be used to read the configuration file (which will have to be located at a path within the web app i.e. people will need to deploy the WAR and then go in and edit the config appropriately prior to running it) and wire up servlets and filters appropriately since it has access to the servlet context and can call all the addServlet(), addFilter() methods etc. as necessary

                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Rob Vesse (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197063#comment-13197063 ] 

Rob Vesse commented on JENA-201:
--------------------------------

I think the generic dispatch pattern would be ideal but I don't really have the expertise in the relevant area of Java to implement that myself.  I was hoping that repackaging as a WAR would be relatively simple but I keep running into stumbling blocks.

The latest hiccup I've uncovered in my experimentation is that Fuseki includes servlet-api in its dependencies, if you try and run as a WAR within Tomcat it will complain because the spec says a WAR shouldn't include a copy of the servlet-api.

One possible workaround here would be to have a separate project for the WAR packing and declare the servlet-api as an optional dependency (http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html) of the main Fuseki project so it doesn't get packaged by the WAR project, since optional dependencies of dependencies are not included.  The downside to this is that those using Fuseki as a library for a standalone server may have to explicitly add servlet-api back as a dependency
                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Andy Seaborne (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194092#comment-13194092 ] 

Andy Seaborne commented on JENA-201:
------------------------------------

Joseki has a more comprehensive way to find a config.  The code for Joseki is in the Scratch area.

org.joseki.http.Servlet is the main servlet. init(ServletConfig) plays "hunt the config".  It looks in:

* ServletContext
* A Java system property.

The command line sets the system property.  The command line also forces early initialization otherwise the initialization process does not happen until the servlet is first used.  That can be confusing because config file errors don't show up until first request when inside a larger system but we probably just have to live with that.

The init code has to be aware it can be called multiple times.  A simple boolean to check and simply return is sufficient.

One user support issue that comes up is that Tomcat blocks access to files outside the webapp area by default.

The war file could be just the server or server+the web pages.  I'm inclined to focus on just the server.
                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Andy Seaborne (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194126#comment-13194126 ] 

Andy Seaborne commented on JENA-201:
------------------------------------

One issue for web.xml ...

The URIs for routing the requests include the dataset name before the service name.

Standalone, a relevant servlet is mounted at each service point declared in the config file, including no servlet if that service isn't offered.  This is more than JAX-RS like dispatch by pattern. A single dispatcher to work on URI patterns, with the dispatch built with info from the config file may be necessary.  web.xml is merely routing everything to this dispatcher servlet.  This style could be rolled back to the standalone server so as not to have duplication.

Or maybe put the "configuration" almost entirely in web.xml, leaving only the dataset declaration part for each service in the config file and let the webapp container manage it i.e have two configuration mechanisms. As some config file for assemblers is going to be needed, I'm inclined currently to have one place to configure and have the generic dispatch servlet.


                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JENA-201) Deliver Fuseki as a WAR file.

Posted by "Rob Vesse (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13193404#comment-13193404 ] 

Rob Vesse commented on JENA-201:
--------------------------------

With regards to the first option one suggestion is that we add overrides of the init(ServletConfig config) method to the servlets in Fuseki, we then use a static flag to distinguish between the case where servlets have been created by command line invoke and by web.xml loading.  In the former case we would skip any init() initialization while in the latter case it would be essential
                
> Deliver Fuseki as a WAR file.
> -----------------------------
>
>                 Key: JENA-201
>                 URL: https://issues.apache.org/jira/browse/JENA-201
>             Project: Jena
>          Issue Type: Improvement
>          Components: Fuseki
>            Reporter: Andy Seaborne
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira