You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2008/07/10 13:09:50 UTC

svn commit: r675511 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java

Author: amilas
Date: Thu Jul 10 04:09:49 2008
New Revision: 675511

URL: http://svn.apache.org/viewvc?rev=675511&view=rev
Log:
Added an option to set the time zone when formatting the date

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java?rev=675511&r1=675510&r2=675511&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java Thu Jul 10 04:09:49 2008
@@ -24,6 +24,8 @@
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMText;
 import org.apache.axis2.databinding.utils.ConverterUtil;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
@@ -289,7 +291,15 @@
             return zulu.format(((Calendar)obj).getTime());
         } else if (obj instanceof Date) {
             SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
-//            zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+            MessageContext messageContext = MessageContext.getCurrentMessageContext();
+            AxisService axisServce = messageContext.getAxisService();
+            // if the user has given a pirticualr timezone we use it.
+            System.out.println("TimZone ==> " + axisServce.getParameterValue("TimeZone"));
+            if (axisServce.getParameter("TimeZone") != null){
+               zulu.setTimeZone(TimeZone.getTimeZone((String)axisServce.getParameter("TimeZone").getValue()));
+            }
+
             return zulu.format(obj);
         }
         return obj.toString();



Re: svn commit: r675511 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java

Posted by Amila Suriarachchi <am...@gmail.com>.
done.

thanks,
Amila.

On Thu, Jul 10, 2008 at 7:40 PM, Davanum Srinivas <da...@gmail.com> wrote:

> Please remove the System.out.
>
> thanks,
> dims
>
> On Thu, Jul 10, 2008 at 7:09 AM,  <am...@apache.org> wrote:
> > Author: amilas
> > Date: Thu Jul 10 04:09:49 2008
> > New Revision: 675511
> >
> > URL: http://svn.apache.org/viewvc?rev=675511&view=rev
> > Log:
> > Added an option to set the time zone when formatting the date
> >
> > Modified:
> >
>  webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
> >
> > Modified:
> webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
> > URL:
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java?rev=675511&r1=675510&r2=675511&view=diff
> >
> ==============================================================================
> > ---
> webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
> (original)
> > +++
> webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
> Thu Jul 10 04:09:49 2008
> > @@ -24,6 +24,8 @@
> >  import org.apache.axiom.om.OMNode;
> >  import org.apache.axiom.om.OMText;
> >  import org.apache.axis2.databinding.utils.ConverterUtil;
> > +import org.apache.axis2.context.MessageContext;
> > +import org.apache.axis2.description.AxisService;
> >
> >  import javax.activation.DataHandler;
> >  import javax.xml.namespace.QName;
> > @@ -289,7 +291,15 @@
> >             return zulu.format(((Calendar)obj).getTime());
> >         } else if (obj instanceof Date) {
> >             SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
> > -//            zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
> > +
> > +            MessageContext messageContext =
> MessageContext.getCurrentMessageContext();
> > +            AxisService axisServce = messageContext.getAxisService();
> > +            // if the user has given a pirticualr timezone we use it.
> > +            System.out.println("TimZone ==> " +
> axisServce.getParameterValue("TimeZone"));
> > +            if (axisServce.getParameter("TimeZone") != null){
> > +
> zulu.setTimeZone(TimeZone.getTimeZone((String)axisServce.getParameter("TimeZone").getValue()));
> > +            }
> > +
> >             return zulu.format(obj);
> >         }
> >         return obj.toString();
> >
> >
> >
>
>
>
> --
> Davanum Srinivas :: http://davanum.wordpress.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: svn commit: r675511 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java

Posted by Davanum Srinivas <da...@gmail.com>.
Please remove the System.out.

thanks,
dims

On Thu, Jul 10, 2008 at 7:09 AM,  <am...@apache.org> wrote:
> Author: amilas
> Date: Thu Jul 10 04:09:49 2008
> New Revision: 675511
>
> URL: http://svn.apache.org/viewvc?rev=675511&view=rev
> Log:
> Added an option to set the time zone when formatting the date
>
> Modified:
>    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
>
> Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java?rev=675511&r1=675510&r2=675511&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java (original)
> +++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java Thu Jul 10 04:09:49 2008
> @@ -24,6 +24,8 @@
>  import org.apache.axiom.om.OMNode;
>  import org.apache.axiom.om.OMText;
>  import org.apache.axis2.databinding.utils.ConverterUtil;
> +import org.apache.axis2.context.MessageContext;
> +import org.apache.axis2.description.AxisService;
>
>  import javax.activation.DataHandler;
>  import javax.xml.namespace.QName;
> @@ -289,7 +291,15 @@
>             return zulu.format(((Calendar)obj).getTime());
>         } else if (obj instanceof Date) {
>             SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
> -//            zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
> +
> +            MessageContext messageContext = MessageContext.getCurrentMessageContext();
> +            AxisService axisServce = messageContext.getAxisService();
> +            // if the user has given a pirticualr timezone we use it.
> +            System.out.println("TimZone ==> " + axisServce.getParameterValue("TimeZone"));
> +            if (axisServce.getParameter("TimeZone") != null){
> +               zulu.setTimeZone(TimeZone.getTimeZone((String)axisServce.getParameter("TimeZone").getValue()));
> +            }
> +
>             return zulu.format(obj);
>         }
>         return obj.toString();
>
>
>



-- 
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org