org.apache.tapestry.engine
Class ServiceEncodingImpl

java.lang.Object
  extended by org.apache.tapestry.engine.ServiceEncodingImpl
All Implemented Interfaces:
ServiceEncoding

public class ServiceEncodingImpl
extends Object
implements ServiceEncoding

Implementation of ServiceEncoding, which adds the ability to determine when the encoding has been modified.

Since:
4.0
Author:
Howard M. Lewis Ship

Field Summary
protected  boolean _modified
           
protected  QueryParameterMap _parameters
          Map of query parameter values; key is string name, value is either a string, an array of strings, or null.
protected  String _pathInfo
           
protected  String _servletPath
           
 
Constructor Summary
ServiceEncodingImpl(String servletPath)
          Creates a new instance with a new map of parameters.
ServiceEncodingImpl(String servletPath, QueryParameterMap parametersMap)
           
ServiceEncodingImpl(String servletPath, String pathInfo, QueryParameterMap parameters)
           
 
Method Summary
 String[] getParameterNames()
          Returns an array of parameter names.
 String getParameterValue(String name)
          Returns the value for the named parameter.
 String[] getParameterValues(String name)
          Returns the value for the named parameter.
 String getPathInfo()
          Returns the portion of the URL after the servlet itself.
 String getServletPath()
          Returns the servlet path for the request.
 boolean isModified()
           
 void resetModified()
           
 void setParameterValue(String name, String value)
          Sets the value for the named query parameter to the provided string.
 void setParameterValues(String name, String[] values)
          Sets the values for a named query parameter.
 void setPathInfo(String pathInfo)
           
 void setServletPath(String servletPath)
          Updates the servlet path for the encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_servletPath

protected String _servletPath

_pathInfo

protected String _pathInfo

_parameters

protected final QueryParameterMap _parameters
Map of query parameter values; key is string name, value is either a string, an array of strings, or null. Could have done this with subclassing rather than delegation.


_modified

protected boolean _modified
Constructor Detail

ServiceEncodingImpl

public ServiceEncodingImpl(String servletPath)
Creates a new instance with a new map of parameters.


ServiceEncodingImpl

public ServiceEncodingImpl(String servletPath,
                           QueryParameterMap parametersMap)

ServiceEncodingImpl

public ServiceEncodingImpl(String servletPath,
                           String pathInfo,
                           QueryParameterMap parameters)
Method Detail

isModified

public boolean isModified()

resetModified

public void resetModified()

getParameterValue

public String getParameterValue(String name)
Description copied from interface: ServiceEncoding
Returns the value for the named parameter. If multiple values are stored for the query parameter, only the first is returned.

Specified by:
getParameterValue in interface ServiceEncoding
Returns:
the value, or null if no such query parameter exists

getParameterValues

public String[] getParameterValues(String name)
Description copied from interface: ServiceEncoding
Returns the value for the named parameter.

Specified by:
getParameterValues in interface ServiceEncoding
Returns:
the values, or null if no such query parameter exists

setServletPath

public void setServletPath(String servletPath)
Description copied from interface: ServiceEncoding
Updates the servlet path for the encoding. In some cases, this is a combination of the servlet and additional path info.

Specified by:
setServletPath in interface ServiceEncoding

setParameterValue

public void setParameterValue(String name,
                              String value)
Description copied from interface: ServiceEncoding
Sets the value for the named query parameter to the provided string.

Specified by:
setParameterValue in interface ServiceEncoding
Parameters:
name - the name of the parameter to set.
value - the new value, which may be null.

setParameterValues

public void setParameterValues(String name,
                               String[] values)
Description copied from interface: ServiceEncoding
Sets the values for a named query parameter.

Specified by:
setParameterValues in interface ServiceEncoding

getServletPath

public String getServletPath()
Description copied from interface: ServiceEncoding
Returns the servlet path for the request. This is the portion of the URL recognized as the servlet. When the URL pattern (in web.xml) ends in a "*" (such as "/book/*"), this method will return the matched servlet portion ("/book/") and {#link #getPathInfo} will return the rest of the URL.

Specified by:
getServletPath in interface ServiceEncoding

getParameterNames

public String[] getParameterNames()
Description copied from interface: ServiceEncoding
Returns an array of parameter names. The names are returned in alphabetically sorted order. This list includes all parameter names, even those for which the stored value is null.

Specified by:
getParameterNames in interface ServiceEncoding

getPathInfo

public String getPathInfo()
Description copied from interface: ServiceEncoding
Returns the portion of the URL after the servlet itself.

Specified by:
getPathInfo in interface ServiceEncoding
Returns:
pathInfo if path info was supplied in the request, or null otherwise.

setPathInfo

public void setPathInfo(String pathInfo)


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.