Skip to content

Instantly share code, notes, and snippets.

@danja
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danja/e8ecbf7e51f7a2616122 to your computer and use it in GitHub Desktop.
Save danja/e8ecbf7e51f7a2616122 to your computer and use it in GitHub Desktop.
CORS on Fuseki2

same thing in md format

Two simple steps (below)

my current setup (on Ubuntu) is starting from a script:

` export FUSEKI_HOME=../../apache-jena-fuseki-2.3.0 export FUSEKI_BASE=../../apache-jena-fuseki-2.3.0

java -Xms2048M -Xmx2048M -Xss4m -jar ../../apache-jena-fuseki-2.3.0/fuseki-server.jar --verbose --update --config ../data/schemaedit-config.ttl --port=3333 `

Two simple steps

  1. Copy a shiro.ini from github Fuseki2 into webapp

  2. In webapp/WEB-INF/web.xml, insert the following before first filter block :

    <filter>
        <filter-name>cross-origin</filter-name>
        <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>cross-origin</filter-name>
        <url-pattern>*</url-pattern>
    </filter-mapping>
    ```
    maybe, following the above (untested in isolation)  :
    ```
      <filter>
    <filter-name>ShiroFilter</filter-name>
    <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>ShiroFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ERROR</dispatcher>
  </filter-mapping>

  <context-param>
    <param-name>shiroConfigLocations</param-name>
    <!-- Try a path name in: FUSEKI_BASE, FUSEKI_HOME, war resource
	 If a "file:" then look there and there only.
    -->
    <param-value>shiro.ini</param-value>
  </context-param>

based on: http://mail-archives.apache.org/mod_mbox/jena-users/201507.mbox/%3C55A6974E.9010009@maudry.com%3E

http://www.eclipse.org/jetty/documentation/current/cross-origin-filter.html

## Two simple steps (below)
### my current setup (on Ubuntu) is starting from a script:
export FUSEKI_HOME=../../apache-jena-fuseki-2.3.0
export FUSEKI_BASE=../../apache-jena-fuseki-2.3.0
java -Xms2048M -Xmx2048M -Xss4m -jar ../../apache-jena-fuseki-2.3.0/fuseki-server.jar --verbose --update --config ../data/schemaedit-config.ttl --port=3333
## Two simple steps
1. Copy a shiro.ini from github Fuseki2 into webapp
2. In webapp/WEB-INF/web.xml, insert the following before first filter block :
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
maybe, following the above (untested in isolation) :
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<context-param>
<param-name>shiroConfigLocations</param-name>
<!-- Try a path name in: FUSEKI_BASE, FUSEKI_HOME, war resource
If a "file:" then look there and there only.
-->
<param-value>shiro.ini</param-value>
</context-param>
based on:
http://mail-archives.apache.org/mod_mbox/jena-users/201507.mbox/%3C55A6974E.9010009@maudry.com%3E
http://www.eclipse.org/jetty/documentation/current/cross-origin-filter.html
@ColinMaudry
Copy link

Glad to help :) Your gist skyrocketed in DuckDuckGo results with "fusekI2"!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment