Home of: [Atelier "FUJIGURUMA"] >> [PageMixer hosted by SourceForge.net]

SEE "For Readers of English Version",
or Japanese version of this page

Identify value for Servlet

This section explains how to identify values for Servlet.

Overview

Class diagram

Class diagram in this section is shown below:

Class diagram
Class diagram (click for large figure)

Classes which you must define are colored, and other are already defined.

Class names

In this tutorial, abbreviated class names are used. Complete names are shown below.

Classes of PageMixer framework

NotationFull name
ApplicationKey jp.ne.dti.lares.foozy.pagemixer.servlet.ApplicationKey
ConsumerContext jp.ne.dti.lares.foozy.pagemixer.mixer.ConsumerContext
ContextInitKey jp.ne.dti.lares.foozy.pagemixer.servlet.ContextInitKey
CookieKey jp.ne.dti.lares.foozy.pagemixer.servlet.CookieKey
HashMapConsumerContext jp.ne.dti.lares.foozy.pagemixer.mixer.HashMapConsumerContext
ParameterKey jp.ne.dti.lares.foozy.pagemixer.servlet.ParameterKey
ReqHeaderKey jp.ne.dti.lares.foozy.pagemixer.servlet.ReqHeaderKey
RequestKey jp.ne.dti.lares.foozy.pagemixer.servlet.RequestKey
ResHeaderKey jp.ne.dti.lares.foozy.pagemixer.servlet.ResHeaderKey
ServletConsumerContext jp.ne.dti.lares.foozy.pagemixer.servlet.ServletConsumerContext
ServletInitKey jp.ne.dti.lares.foozy.pagemixer.servlet.ServletInitKey
SessionKey jp.ne.dti.lares.foozy.pagemixer.servlet.SessionKey

Tutorial specific classes

No tutorial specific class is explained in this section.

Classes to identify values

Now, you already know that you can identify the value in ConsumerContext by key Object.

ATTENTION: Please see "Mixing with PageMixer" at first, if you have not learn how to use PageMixer yet.

You can choose any objects to identify values in stand alone application environment: java.lang.String , for example. But mixing with Servlet, you will want to get/set/unset Servlet environment specific values, for example, which are given by:

PageMixer provides classes to identify above values in ConsumerContext shown below(please see "servlet" package description for complete list)

For example, you can get/set/unset value in request attribute by key object shown below.


Object key =
new RequestKey("name of attribute");

Key to identify value in request attribute

Accesing value by this key causes getAttribute(), setAttribute() and/or removeAttribute() of HttpServletRequest.

Identify values in ConsumerContext

Identify values in ServletConsumerContext

By classes described above work correctly with ServletConsumerContext. You can get/set/unset values by them without any other configuration except of correct ServletConsumerContext construction.

Please attention that some classes do not support some of get/set/unset functions because of Servlet API restriction. For example, you can not set/unset value by ParameterKey.

Identify values in other ConsumerContext

For other ConsumerContext implementation classes, it depends on implementation of it wether classes described above work correctly with them or not.

At least, they work with HashMapConsumerContext correctly, because they, key classes, override Object#equals and Object#hashCode.

But with HashMapConsumerContext, invalid use(set valu by ParameterKey, for example) of them does not cause UnsupportedOperationException raising. even though invalid use with ServletConsumerContext causes so. So, 'work correctly' means that they can 'identify values correctly'.


To next section "Overview of PageServlet"