PageMixer API - 3.1

jp.ne.dti.lares.foozy.pagemixer.page
Class MonoPage

java.lang.Object
  |
  +--jp.ne.dti.lares.foozy.pagemixer.page.MonoPage
All Implemented Interfaces:
Page

public class MonoPage
extends java.lang.Object
implements Page

Page information accessing for 'mono' page.

This class treats the model of page that:

has fixed content type:
content type of page is fixed value.
has fixed encoding:
encoding of InputStream is fixed value.
is locale in-sensitive:
content of page is not locale sensitive.

For example: '/somepage.ja.html' page in your web application (1)has 'text/html; charset=Windows-31J' content, (2)is encoded in "Windows-31J" in local file system, and (3)has locale insensitive content.

Since:
PageMixer 3.0

Fields inherited from interface jp.ne.dti.lares.foozy.pagemixer.page.Page
DEFAULT_ENCODING
 
Constructor Summary
MonoPage(java.lang.String contentType)
          Constructor.
MonoPage(java.lang.String location, java.lang.String contentType)
          Constructor.
MonoPage(java.lang.String location, java.lang.String contentType, java.lang.String encoding)
          Constructor.
 
Method Summary
 void close(java.lang.Object descriptor)
          Does nothing because no resource requires release.
 void expire(long limit)
          Expire old page entries.
 java.lang.String getContentType(java.lang.Object descriptor)
          Return fixed content type specified at construction time.
 java.lang.String getEncoding(java.lang.Object descriptor)
          Return fixed encoding specified at construction time.
 java.lang.String getLocation(java.lang.Object descriptor)
          Return resource location of page.
 PageEntry getPageEntry(java.lang.Object descriptor)
          Get page entry stored in this object.
 java.lang.Object open(java.lang.String location, java.util.Locale locale)
          Return specified location as descriptor object.
 void putPageEntry(java.lang.Object descriptor, PageEntry entry)
          Store specified entry into this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonoPage

public MonoPage(java.lang.String location,
                java.lang.String contentType,
                java.lang.String encoding)
Constructor.

If null is specified as 'location', this treats 'location' parameter of open(String, Locale) as location of page resource.

So, it is recommended to specify 'location' of page explicitly, if:

"Encoding" is treated as shown below:

null
result of getCharSet(contentType)(this also may be null) is used
"default encoding"
null, which means using default encoding of runtime environment, is used
otherwise
specified encoding is used

You should specify "default encoding" explicitly, if you really want to use runtime environment default encoding.

It is recommended to omit encoding specification (= use encoding specified in content type) for maintenancability, if you write resource out in that encoding.

Parameters:
location - of page resource
contentType - of page
encoding - to read page resource in

MonoPage

public MonoPage(java.lang.String contentType)
Constructor.

This is equivalent with MonoPage(null, contentType, null).


MonoPage

public MonoPage(java.lang.String location,
                java.lang.String contentType)
Constructor.

This is equivalent with MonoPage(location, contentType, null).

Method Detail

open

public java.lang.Object open(java.lang.String location,
                             java.util.Locale locale)
                      throws java.io.IOException
Return specified location as descriptor object.
Specified by:
open in interface Page
Parameters:
location - to symbolize target page
locale - of target page
Returns:
descriptor object
See Also:
MonoPage(String, String, String)

close

public void close(java.lang.Object descriptor)
           throws java.io.IOException
Does nothing because no resource requires release.
Specified by:
close in interface Page
Parameters:
descriptor - of page

getLocation

public java.lang.String getLocation(java.lang.Object descriptor)
                             throws java.io.IOException
Return resource location of page.
Specified by:
getLocation in interface Page
Parameters:
descriptor - of page
Returns:
resource location of page

getContentType

public java.lang.String getContentType(java.lang.Object descriptor)
                                throws java.io.IOException
Return fixed content type specified at construction time.
Specified by:
getContentType in interface Page
Parameters:
descriptor - of page
Returns:
fixed value as content type of page

getEncoding

public java.lang.String getEncoding(java.lang.Object descriptor)
                             throws java.io.IOException
Return fixed encoding specified at construction time.
Specified by:
getEncoding in interface Page
Parameters:
descriptor - of page
Returns:
fixed value as encoding of InputStream to read page data in

putPageEntry

public void putPageEntry(java.lang.Object descriptor,
                         PageEntry entry)
                  throws java.io.IOException
Store specified entry into this object.
Specified by:
putPageEntry in interface Page
Parameters:
descriptor - of page
entry - to store

getPageEntry

public PageEntry getPageEntry(java.lang.Object descriptor)
                       throws java.io.IOException
Get page entry stored in this object.
Specified by:
getPageEntry in interface Page
Parameters:
descriptor - of page
Returns:
entry stored in this

expire

public void expire(long limit)
Expire old page entries.

This expire page entry stored in this object, if last accessing timestamp is earlier than specified one.

Specified by:
expire in interface Page
Parameters:
limit - milliseconds of last access timestamp

PageMixer API - 3.1