Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.javahispano.canyamo.services.workdata
Class WorkDataImpl  view WorkDataImpl download WorkDataImpl.java

java.lang.Object
  extended byorg.javahispano.canyamo.services.workdata.WorkDataImpl
All Implemented Interfaces:
org.javahispano.canyamo.core.WorkData

public class WorkDataImpl
extends java.lang.Object
implements org.javahispano.canyamo.core.WorkData

This class encapsulates an user's request + response to be used along the framework

Version:

Field Summary
protected  java.lang.String forward
          Description of the Field
protected  java.io.Writer out
          Output Writer
Mainly JSPWriter or Response.outputStream
protected  javax.servlet.http.HttpServletRequest request
          User's HTTP Request
protected  javax.servlet.http.HttpServletResponse response
          HTTPresponse to user
 
Constructor Summary
WorkDataImpl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Constructor for the CanyamoRequest object
 
Method Summary
 void addCookie(java.lang.String key, java.lang.String value)
          Adds a cookie to the response to user
 void addCookie(java.lang.String key, java.lang.String value, int age)
          Adds a cookie to the response to user
 java.lang.String encodeURL(java.lang.String url)
          Encodes an URL to add session info if cookies are not allowed
 void forward(java.lang.String url)
          Forwards the framework to another action/url
 java.util.Map getAllParameters()
          Gets all Parameters of user's request

If a parameter has a single value, it comes as String, if a parameter has many values (case multiselect HTML list), it returns a list of Strings.
 java.lang.Object getAttribute(java.lang.String key)
          Gets an attribute of this work-data
 java.lang.String getCookieValue(java.lang.String key)
          Gets the value of the given cookie, if present
 java.lang.String getForward()
          Retrieves the URL to which the framework should be redirected
 java.io.Writer getOutputWriter()
          Gets response's outputWriter
 java.lang.String getParameter(java.lang.String key)
          Gets one parameter of user's request
 java.lang.String getPrincipalName()
          Returns the name of the user authenticate with Container Manager Authentication
 java.lang.String getServletPath()
          Gets the path of the servlet for user's request

Actually it returns action's name, since Servlet has a mapping to *.action
 javax.servlet.http.HttpServletRequest getServletRequest()
          Gets the servletRequest attribute of the WorkDataImpl object
 javax.servlet.http.HttpServletResponse getServletResponse()
          Gets the servletResponse attribute of the WorkDataImpl object
 java.lang.Object getSessionAttribute(java.lang.String key)
          Gets an attribute stored in user' session
 java.lang.String getURL()
          Gets the URL of user's request
 org.javahispano.canyamo.services.user.User getUser()
          Returns the user for the actual request
 void invalidateSession()
          Invalidates user's session
 boolean isDefaultUser()
          Says if the actual user is a registered user or an anonymous one
 void redirect(java.lang.String url)
          Redirects the framework to another action/url
 void setAttribute(java.lang.String key, java.lang.Object value)
          Sets an request attribute
 void setOutputWriter(java.io.Writer out)
          Sets the outputWriter attribute of the WorkDataImpl object
 void setSessionAttribute(java.lang.String key, java.lang.Object value)
          Sets an attribute in user' session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected javax.servlet.http.HttpServletRequest request
User's HTTP Request


response

protected javax.servlet.http.HttpServletResponse response
HTTPresponse to user


forward

protected java.lang.String forward
Description of the Field


out

protected java.io.Writer out
Output Writer
Mainly JSPWriter or Response.outputStream

Constructor Detail

WorkDataImpl

public WorkDataImpl(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
Constructor for the CanyamoRequest object

Since:
Method Detail

setSessionAttribute

public void setSessionAttribute(java.lang.String key,
                                java.lang.Object value)
Sets an attribute in user' session

Specified by:
setSessionAttribute in interface org.javahispano.canyamo.core.WorkData

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Sets an request attribute

Specified by:
setAttribute in interface org.javahispano.canyamo.core.WorkData

setOutputWriter

public void setOutputWriter(java.io.Writer out)
Sets the outputWriter attribute of the WorkDataImpl object


getSessionAttribute

public java.lang.Object getSessionAttribute(java.lang.String key)
Gets an attribute stored in user' session

Specified by:
getSessionAttribute in interface org.javahispano.canyamo.core.WorkData

getCookieValue

public java.lang.String getCookieValue(java.lang.String key)
Gets the value of the given cookie, if present

Specified by:
getCookieValue in interface org.javahispano.canyamo.core.WorkData

getURL

public java.lang.String getURL()
Gets the URL of user's request

Specified by:
getURL in interface org.javahispano.canyamo.core.WorkData

getServletPath

public java.lang.String getServletPath()
Gets the path of the servlet for user's request

Actually it returns action's name, since Servlet has a mapping to *.action

Specified by:
getServletPath in interface org.javahispano.canyamo.core.WorkData

getParameter

public java.lang.String getParameter(java.lang.String key)
Gets one parameter of user's request

Specified by:
getParameter in interface org.javahispano.canyamo.core.WorkData

getAllParameters

public java.util.Map getAllParameters()
Gets all Parameters of user's request

If a parameter has a single value, it comes as String, if a parameter has many values (case multiselect HTML list), it returns a list of Strings.

Specified by:
getAllParameters in interface org.javahispano.canyamo.core.WorkData

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Gets an attribute of this work-data

Specified by:
getAttribute in interface org.javahispano.canyamo.core.WorkData

getUser

public org.javahispano.canyamo.services.user.User getUser()
Returns the user for the actual request

Specified by:
getUser in interface org.javahispano.canyamo.core.WorkData

isDefaultUser

public boolean isDefaultUser()
Says if the actual user is a registered user or an anonymous one

Specified by:
isDefaultUser in interface org.javahispano.canyamo.core.WorkData

getServletRequest

public javax.servlet.http.HttpServletRequest getServletRequest()
Gets the servletRequest attribute of the WorkDataImpl object


getServletResponse

public javax.servlet.http.HttpServletResponse getServletResponse()
Gets the servletResponse attribute of the WorkDataImpl object


getOutputWriter

public java.io.Writer getOutputWriter()
                               throws java.io.IOException
Gets response's outputWriter

Specified by:
getOutputWriter in interface org.javahispano.canyamo.core.WorkData

getPrincipalName

public java.lang.String getPrincipalName()
Returns the name of the user authenticate with Container Manager Authentication

Specified by:
getPrincipalName in interface org.javahispano.canyamo.core.WorkData

getForward

public java.lang.String getForward()
Retrieves the URL to which the framework should be redirected

Specified by:
getForward in interface org.javahispano.canyamo.core.WorkData

invalidateSession

public void invalidateSession()
Invalidates user's session

Specified by:
invalidateSession in interface org.javahispano.canyamo.core.WorkData

addCookie

public void addCookie(java.lang.String key,
                      java.lang.String value)
Adds a cookie to the response to user

Specified by:
addCookie in interface org.javahispano.canyamo.core.WorkData

addCookie

public void addCookie(java.lang.String key,
                      java.lang.String value,
                      int age)
Adds a cookie to the response to user

Specified by:
addCookie in interface org.javahispano.canyamo.core.WorkData

redirect

public void redirect(java.lang.String url)
Redirects the framework to another action/url

Specified by:
redirect in interface org.javahispano.canyamo.core.WorkData

forward

public void forward(java.lang.String url)
Forwards the framework to another action/url

Specified by:
forward in interface org.javahispano.canyamo.core.WorkData

encodeURL

public java.lang.String encodeURL(java.lang.String url)
Encodes an URL to add session info if cookies are not allowed

Specified by:
encodeURL in interface org.javahispano.canyamo.core.WorkData