org.autoplot.servlet.ServletUtil

Utilities for the servlets

ServletUtil( )


checkSecurity

checkSecurity( HttpServletResponse response, String id, String suri, String vap ) → SecurityResponse

This checks the whitelist for the URI, and also inserts headers into the response.

Parameters

response - a HttpServletResponse
id - null or the id, which is mapped to a URI.
suri - null or the uri.
vap - null or the vap

Returns:

true if the URI is whitelisted

[search for examples] [view on GitHub] [view on old javadoc]


dumpWhitelistToLogger

dumpWhitelistToLogger( java.util.logging.Level level ) → void

dump the whitelist to the logger at the given level.

Parameters

level - the level to log at.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc]


getBlackList

getBlackList( ) → List

return the blacklist, checking no more than once per 5 seconds, and creating the default file if one is not found. See HOME/autoplot_data/server/blacklist.txt

Returns:

list of regular expressions to allow.

[search for examples] [view on GitHub] [view on old javadoc]


getIdMap

getIdMap( ) → Map

return the id map, checking no more than once per 5 seconds, and creating an empty file if one is not found. See HOME/autoplot_data/server/

Returns:

map from one string to another.

[search for examples] [view on GitHub] [view on old javadoc]


getIntParameter

getIntParameter( HttpServletRequest request, String name, int dval ) → int

Parameters

request - a HttpServletRequest
name - a String
dval - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc]


getServletContact

getServletContact( ) → String

return the contact info for the server

Returns:

a String

[search for examples] [view on GitHub] [view on old javadoc]


getServletHome

getServletHome( ) → File

Returns:

java.io.File

[search for examples] [view on GitHub] [view on old javadoc]


getStringParameter

getStringParameter( HttpServletRequest request, String name, String dval ) → String

Parameters

request - a HttpServletRequest
name - a String
dval - a String

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc]


getWhiteList

getWhiteList( ) → List

return the whitelist, checking no more than once per 5 seconds, and creating the default file if one is not found. See HOME/autoplot_data/server/whitelist.txt

Returns:

list of regular expressions to allow.

[search for examples] [view on GitHub] [view on old javadoc]


isBlacklisted

isBlacklisted( String suri ) → boolean

return true if the suri is blacklisted, meaning we do not trust that scripts and other content from from this address could harm the server.

Parameters

suri - the uri.

Returns:

true if the suri is blacklisted.

[search for examples] [view on GitHub] [view on old javadoc]


isWhitelisted

isWhitelisted( String suri ) → boolean

return true if the suri is whitelisted, meaning we trust that scripts and other content from from this address will not harm the server. This also checks the blacklist, and if the item is in the blacklist, then it will not be whitelisted.

Parameters

suri - the uri.

Returns:

true if the suri is whitelisted.

[search for examples] [view on GitHub] [view on old javadoc]


securityCheckPart2

securityCheckPart2( org.autoplot.servlet.ServletUtil.SecurityResponse sr ) → void

this is the part that throws the exception if security violation occurs.

Parameters

sr - a ServletUtil.SecurityResponse

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc]