Skip to content

Commit

Permalink
Refactor to make the HttpAction objects and servlets independent of J…
Browse files Browse the repository at this point in the history
…etty.

An indirect dependency existed for HttpAction on SPARQLServer.
Refactoring is a step towards JENA-201 (Deliver Fuseki as a WAR file).

git-svn-id: https://svn.apache.org/repos/asf/jena/trunk@1517341 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
afs committed Aug 25, 2013
1 parent 0fd7015 commit 2409ee4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
3 changes: 3 additions & 0 deletions jena-fuseki/src/main/java/org/apache/jena/fuseki/Fuseki.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ private static Metadata initMetadata()
/** Instance of log for config server message s*/
public static final Logger configLog = LoggerFactory.getLogger(configLogName) ;

/** Instance of log for config server message s*/
public static boolean verboseLogging = false ;

/** An instance of management for stream opening, including redirecting through a
* location mapper whereby a name (e.g. URL) is redirected to another name (e.g. local file).
* */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public class SPARQLServer {
private ServerConfig serverConfig ;

private Server server = null ;
public static boolean verboseLogging = false ;
private static List<String> epDataset = Arrays.asList("*") ;

/**
Expand All @@ -83,7 +82,8 @@ public class SPARQLServer {
*/
public SPARQLServer(ServerConfig config) {
this.serverConfig = config ;
verboseLogging = config.verboseLogging ;
// Currently server-wide.
Fuseki.verboseLogging = config.verboseLogging ;

// GZip compression
// Note that regardless of this setting we'll always leave it turned off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,12 @@ protected void doCommon(HttpServletRequest request, HttpServletResponse response
}
}


// ---- Operation lifecycle

/** Return a fresh WebAction for this request */
protected HttpAction allocHttpAction(long id, HttpServletRequest request, HttpServletResponse response) {
// Need a way to set verbose logging on a per servlet and per request basis.
return new HttpAction(id, request, response, SPARQLServer.verboseLogging ) ;
return new HttpAction(id, request, response, verboseLogging) ;
}

protected abstract void validate(HttpAction action) ;
Expand Down Expand Up @@ -309,15 +308,9 @@ protected String mapRequestToDataset(String uri)
}

return uri.substring(0, i) ;
} /** Find the dataset name even if direct naming */
protected static String findTrailing(String uri, String dsname)
{
if ( dsname.length() >= uri.length() )
return "" ;
return uri.substring(dsname.length()+1) ; // Skip the separating "/"
}

protected static String mapRequestToService(DatasetRef dsRef, String uri, String serviceName)
protected String mapRequestToService(DatasetRef dsRef, String uri, String serviceName)
{
if ( dsRef == null )
return "" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private boolean serviceDispatch(HttpAction action, ServiceRef service, String sr
}

/** Find the graph (direct naming) or service name */
protected static String findTrailing(String uri, String dsname)
protected String findTrailing(String uri, String dsname)
{
if ( dsname.length() >= uri.length() )
return "" ;
Expand Down Expand Up @@ -334,6 +334,5 @@ protected void doPut(HttpServletRequest request, HttpServletResponse response)
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response)
{ doCommon(request, response) ; }

}

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public abstract class ServletBase extends HttpServlet
{
protected static final Logger log = Fuseki.requestLog ;
public final boolean verboseLogging = Fuseki.verboseLogging ;
private static AtomicLong requestIdAlloc = new AtomicLong(0) ;

protected ServletBase() { }
Expand Down

0 comments on commit 2409ee4

Please sign in to comment.