com.bowstreet.builders.webapp
Class ImportedPageBuilder

java.lang.Object
  extended by com.bowstreet.builders.webapp.ImportedPageBuilder
All Implemented Interfaces:
WebAppBuilder, IExemplar

public class ImportedPageBuilder
extends java.lang.Object
implements WebAppBuilder, IExemplar

ImportedPage WebApp builder.


Nested Class Summary
static interface ImportedPageBuilder.STATICS
           
 
Field Summary
static java.lang.String ABSOLUTE_CONTENT_URL_PARM
           
static java.lang.String CONTEXT_PATH_PARM
           
static java.lang.String FORM_METHOD_ATTRIBUTE
           
static java.lang.String FULLY_PARSE_PARM
           
static java.lang.String INPUT_LOCALIZEURL
           
static java.lang.String INPUT_URL
           
 
Constructor Summary
ImportedPageBuilder()
           
 
Method Summary
 void doBuilderCall(GenContext genContext, WebApp webApp, BuilderCall builderCall, BuilderInputs builderInputs)
          doBuilderCall - WebApp builders do their regen work here, getting inputs from builderInputs and adding/modifying elements in the WebApp.
static void doWork(GenContext genContext, WebApp webApp, BuilderCall builderCall, BuilderInputs builderInputs)
          Do the actual work for the ImportedPage builder's doBuilderCall method.
static java.lang.String getApplicationContextPath(GenContext genContext)
          Get the current servlet application context - will return null if called at design time.
static java.util.List getDependencies()
          Get the list of dependencies.
static java.lang.String getServerURL(GenContext genContext)
          Calculate a reasonable server URL if possible.
static java.lang.String getServerURL(GenContext genContext, boolean omitAppContext, boolean absoluteURLs)
          Calculate a reasonable server URL if possible.
static boolean getUseURLMapperForContextURL()
          Determine if we should use simple code (request.getContextPath()) to compute the context URL, or if we have to use the URLMapper machinery.
static java.lang.String getValidEncodingForJSP(java.lang.String encoding)
          Is this character encoding one that can be used for writing JSPs?
static IXml importPage(java.lang.String url, java.lang.String serverURL, boolean absoluteURLs, boolean omitAppContext, boolean useCode, boolean addBase, boolean parseFully, java.lang.String userName, java.lang.String password, java.lang.Object linkProcessor, java.lang.String encoding, java.util.List dependencies)
          Fetch the specified page data.
static IXml importPage(java.lang.String url, java.lang.String serverURL, java.lang.String appContext, boolean modifyURLs, boolean absoluteURLs, boolean omitAppContext, boolean useCode, boolean addBase, boolean parseFully, java.lang.String userName, java.lang.String password, java.lang.Object linkProcessor, java.lang.String encoding, java.util.List dependencies)
          Fetch the specified page data.
static IXml importPage(java.lang.String url, java.lang.String serverURL, java.lang.String appContext, boolean absoluteURLs, boolean omitAppContext, boolean useCode, boolean addBase, boolean parseFully, java.lang.String userName, java.lang.String password, java.lang.Object linkProcessor, java.lang.String encoding, java.util.List dependencies)
          Fetch the specified page data.
 java.lang.Object newInstance()
          IExemplar implementation
static java.lang.String prepareUrl(java.lang.String base, java.lang.String localePath, java.lang.String url)
          Create an import URL that doesn't contain duplicate path separators.
static void reparseNodeFully(IXml node)
          The normal process to parse some HTML is to partially parse some of it, putting pieces we don't think are "important" inside HTMLContent nodes with CDATA wrappers.
static void setDependencies(java.util.List dependencies)
          Called to set a list of files the imported HTML refers to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ABSOLUTE_CONTENT_URL_PARM

public static final java.lang.String ABSOLUTE_CONTENT_URL_PARM
See Also:
Constant Field Values

CONTEXT_PATH_PARM

public static final java.lang.String CONTEXT_PATH_PARM
See Also:
Constant Field Values

FORM_METHOD_ATTRIBUTE

public static final java.lang.String FORM_METHOD_ATTRIBUTE
See Also:
Constant Field Values

FULLY_PARSE_PARM

public static final java.lang.String FULLY_PARSE_PARM
See Also:
Constant Field Values

INPUT_LOCALIZEURL

public static final java.lang.String INPUT_LOCALIZEURL
See Also:
Constant Field Values

INPUT_URL

public static final java.lang.String INPUT_URL
See Also:
Constant Field Values
Constructor Detail

ImportedPageBuilder

public ImportedPageBuilder()
Method Detail

doBuilderCall

public void doBuilderCall(GenContext genContext,
                          WebApp webApp,
                          BuilderCall builderCall,
                          BuilderInputs builderInputs)
doBuilderCall - WebApp builders do their regen work here, getting inputs from builderInputs and adding/modifying elements in the WebApp.

Specified by:
doBuilderCall in interface WebAppBuilder
Parameters:
genContext - The GenContext for this regen
webApp - The WebApp under construction
builderCall - Use this to set errors, get BuilderDef, etc.
builderInputs - The inputs for this builder call
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

doWork

public static void doWork(GenContext genContext,
                          WebApp webApp,
                          BuilderCall builderCall,
                          BuilderInputs builderInputs)
Do the actual work for the ImportedPage builder's doBuilderCall method.

Parameters:
genContext - The GenContext for this regen
webApp - The WebApp under construction
builderCall - Use this to set errors, get BuilderDef, etc.
builderInputs - The inputs for this builder call

getApplicationContextPath

public static java.lang.String getApplicationContextPath(GenContext genContext)
Get the current servlet application context - will return null if called at design time.

Returns:
application context path

getDependencies

public static java.util.List getDependencies()
Get the list of dependencies. Access to this list needs to be static because it can be set from the UI code before there's a builder call.


getServerURL

public static java.lang.String getServerURL(GenContext genContext)
Calculate a reasonable server URL if possible.


getServerURL

public static java.lang.String getServerURL(GenContext genContext,
                                            boolean omitAppContext,
                                            boolean absoluteURLs)
Calculate a reasonable server URL if possible.


getUseURLMapperForContextURL

public static boolean getUseURLMapperForContextURL()
Determine if we should use simple code (request.getContextPath()) to compute the context URL, or if we have to use the URLMapper machinery.

Returns:
boolean specifying whether to use URLMapper (vs simple code) for application context URL

getValidEncodingForJSP

public static java.lang.String getValidEncodingForJSP(java.lang.String encoding)
Is this character encoding one that can be used for writing JSPs? To answer this we see if it preserves ASCII characters.


importPage

public static IXml importPage(java.lang.String url,
                              java.lang.String serverURL,
                              boolean absoluteURLs,
                              boolean omitAppContext,
                              boolean useCode,
                              boolean addBase,
                              boolean parseFully,
                              java.lang.String userName,
                              java.lang.String password,
                              java.lang.Object linkProcessor,
                              java.lang.String encoding,
                              java.util.List dependencies)
                       throws java.lang.Exception
Fetch the specified page data.

Parameters:
url - url
serverURL - server url
absoluteURLs - boolean specifying whether to use absolute urls (true) or relative (false)
omitAppContext - boolean specifying whether to omit the app context
useCode - boolean specifying whether to use JSP code to generate URLs
addBase - boolean specifying whether to add a base URL to the page
parseFully - boolean specifying whether to fully parse the page
userName - username for accessing HTTP basic-auth protected pages.
password - password for accessing HTTP basic-auth protected pages.
linkProcessor - link processor (not typically used, pass null instead).
encoding - encoding for the specified page
dependencies - list of dependencies
Throws:
java.lang.Exception

importPage

public static IXml importPage(java.lang.String url,
                              java.lang.String serverURL,
                              java.lang.String appContext,
                              boolean modifyURLs,
                              boolean absoluteURLs,
                              boolean omitAppContext,
                              boolean useCode,
                              boolean addBase,
                              boolean parseFully,
                              java.lang.String userName,
                              java.lang.String password,
                              java.lang.Object linkProcessor,
                              java.lang.String encoding,
                              java.util.List dependencies)
                       throws java.lang.Exception
Fetch the specified page data.

Parameters:
url - url
serverURL - server url
appContext - application context
modifyURLs - boolean specifying whether to modify URLs found in the page data
absoluteURLs - boolean specifying whether to use absolute urls (true) or relative (false)
omitAppContext - boolean specifying whether to omit the app context
useCode - boolean specifying whether to use JSP code to generate URLs
addBase - boolean specifying whether to add a base URL to the page
parseFully - boolean specifying whether to fully parse the page
userName - username for accessing HTTP basic-auth protected pages.
password - password for accessing HTTP basic-auth protected pages.
linkProcessor - link processor (not typically used, pass null instead).
encoding - encoding for the specified page
dependencies - list of dependencies
Throws:
java.lang.Exception

importPage

public static IXml importPage(java.lang.String url,
                              java.lang.String serverURL,
                              java.lang.String appContext,
                              boolean absoluteURLs,
                              boolean omitAppContext,
                              boolean useCode,
                              boolean addBase,
                              boolean parseFully,
                              java.lang.String userName,
                              java.lang.String password,
                              java.lang.Object linkProcessor,
                              java.lang.String encoding,
                              java.util.List dependencies)
                       throws java.lang.Exception
Fetch the specified page data.

Parameters:
url - url
serverURL - server url
appContext - application context
absoluteURLs - boolean specifying whether to use absolute urls (true) or relative (false)
omitAppContext - boolean specifying whether to omit the app context
useCode - boolean specifying whether to use JSP code to generate URLs
addBase - boolean specifying whether to add a base URL to the page
parseFully - boolean specifying whether to fully parse the page
userName - username for accessing HTTP basic-auth protected pages.
password - password for accessing HTTP basic-auth protected pages.
linkProcessor - link processor (not typically used, pass null instead).
encoding - encoding for the specified page
dependencies - list of dependencies
Throws:
java.lang.Exception

newInstance

public java.lang.Object newInstance()
IExemplar implementation

Specified by:
newInstance in interface IExemplar
For Internal Use Only! Internal API, not supported for public consumption. Subject to change at any time.

prepareUrl

public static java.lang.String prepareUrl(java.lang.String base,
                                          java.lang.String localePath,
                                          java.lang.String url)
Create an import URL that doesn't contain duplicate path separators.

Parameters:
base - base url string
localePath - locale path
url - url path

reparseNodeFully

public static void reparseNodeFully(IXml node)
                             throws com.bowstreet.util.parser.ParserException
The normal process to parse some HTML is to partially parse some of it, putting pieces we don't think are "important" inside HTMLContent nodes with CDATA wrappers. If this is a problem, then you can call this method to fully parse the contents of any node.

Parameters:
node - IXml portion of a page which you want to be fully parsed.
Throws:
com.bowstreet.util.parser.ParserException

setDependencies

public static void setDependencies(java.util.List dependencies)
Called to set a list of files the imported HTML refers to.



Copyright © 2009 IBM. All Rights Reserved.