| java.lang.Object org.vfny.geoserver.util.Requests
Requests | final public class Requests (Code) | | Utility methods helpful when processing GeoServer Requests.
Provides helper functions and classes useful when implementing your own
Response classes. Of significant importantance are the Request processing
functions that allow access to the WebContainer, GeoServer and the User's
Session.
If you are working with the STRUTS API the Action method is the direct
paralle of the Response classes. You may whish to look at how ConfigAction
is implemented, it is a super class which delegates to these Request
processing methods.
author: Jody Garnett |
Method Summary | |
public static String | appendContextPath(String url, String contextPath) Appends a context path to a base url.
Parameters: url - The base url. Parameters: contextPath - The context path to be appended. | public static String | appendQueryString(String url, String queryString) Appends a query string to a url.
This method checks url to see if the appended query string requires a '?' or
'&' to be prepended.
Parameters: url - The base url. Parameters: queryString - The query string to be appended, should not contain the '?' character. | public static String | getBaseJspUrl(HttpServletRequest httpServletRequest, GeoServer geoserver) | public static String | getBaseUrl(HttpServletRequest httpServletRequest, GeoServer geoserver) Get base url used - it is not any more assumed to be
http://server:port/geoserver
Removed the hardcoded "http://" and replaced it with
httpServletRequest.getScheme() because the https case was not being
handled. | public static InputStream | getInputStream(URL url) This method gets the correct input stream for a URL.
If the URL is a http/https connection, the Accept-Encoding: gzip, deflate is added.
It the paramter is added, the response is checked to see if the response
is encoded in gzip, deflate or plain bytes. | public static String | getSchemaBaseUrl(HttpServletRequest httpServletRequest, GeoServer geoserver) | public static String | getTileCacheBaseUrl(HttpServletRequest request, GeoServer geoServer) Returns the full url to the tile cache used by GeoServer ( if any ).
If the tile cache set in the configuration (
GeoServer.getTileCache )
is set to an asbsolute url, it is simply returned. | public static UserContainer | getUserContainer(HttpServletRequest request) Aquire type safe session information in a UserContainer. | public static boolean | isLoggedIn(HttpServletRequest request) Tests is user is loggin in. | public static void | logOut(HttpServletRequest request) Ensures a user is logged out. | public static boolean | loggedIn(HttpServletRequest request) | public static Map | parseOptionParameter(String rawOptionString) |
appendContextPath | public static String appendContextPath(String url, String contextPath)(Code) | | Appends a context path to a base url.
Parameters: url - The base url. Parameters: contextPath - The context path to be appended. A full url with the context path appended. |
appendQueryString | public static String appendQueryString(String url, String queryString)(Code) | | Appends a query string to a url.
This method checks url to see if the appended query string requires a '?' or
'&' to be prepended.
Parameters: url - The base url. Parameters: queryString - The query string to be appended, should not contain the '?' character. A full url with the query string appended. |
getBaseUrl | public static String getBaseUrl(HttpServletRequest httpServletRequest, GeoServer geoserver)(Code) | | Get base url used - it is not any more assumed to be
http://server:port/geoserver
Removed the hardcoded "http://" and replaced it with
httpServletRequest.getScheme() because the https case was not being
handled.
Parameters: httpServletRequest - http://server:port/path-defined-context |
getInputStream | public static InputStream getInputStream(URL url) throws IOException(Code) | | This method gets the correct input stream for a URL.
If the URL is a http/https connection, the Accept-Encoding: gzip, deflate is added.
It the paramter is added, the response is checked to see if the response
is encoded in gzip, deflate or plain bytes. The correct input stream wrapper is then
selected and returned.
This method was added as part of GEOS-420
Parameters: url - The url to the sld file The InputStream used to validate and parse the SLD xml. throws: IOException - |
getSchemaBaseUrl | public static String getSchemaBaseUrl(HttpServletRequest httpServletRequest, GeoServer geoserver)(Code) | | Get capabilities base url used
Parameters: httpServletRequest - http://server:port/path-defined-context/data/capabilities |
getTileCacheBaseUrl | public static String getTileCacheBaseUrl(HttpServletRequest request, GeoServer geoServer)(Code) | | Returns the full url to the tile cache used by GeoServer ( if any ).
If the tile cache set in the configuration (
GeoServer.getTileCache )
is set to an asbsolute url, it is simply returned. Otherwise the value
is appended to the scheme and host of the supplied request.
Parameters: request - The request. Parameters: geoServer - The geoserver configuration. The url to the tile cache, or null if no tilecache set. |
getUserContainer | public static UserContainer getUserContainer(HttpServletRequest request)(Code) | | Aquire type safe session information in a UserContainer.
Parameters: request - Http Request used to aquire session reference UserContainer containing typesafe session information. |
isLoggedIn | public static boolean isLoggedIn(HttpServletRequest request)(Code) | | Tests is user is loggin in.
True if UserContainer exists has been created.
Parameters: request - HttpServletRequest providing current Session |
logOut | public static void logOut(HttpServletRequest request)(Code) | | Ensures a user is logged out.
Removes the UserContainer, and thus GeoServers knowledge of the current
user attached to this Session.
Parameters: request - HttpServletRequest providing current Session |
parseOptionParameter | public static Map parseOptionParameter(String rawOptionString) throws IllegalArgumentException(Code) | | Parses an 'option-holding' parameters in the following form
FORMAT_OPTIONS=multiKey:val1,val2,val3;singleKey:val
Useful for parsing out the FORMAT_OPTIONS and LEGEND_OPTIONS parameters
|
|
|