WSS4JOutInterceptor Timestamp: How to change expiration duration? - cxf

How do I change the duration of the timestamp? I seem to get five minutes as the default; I needed to change the duration to ten minutes.
<wsu:Timestamp wsu:Id="TS-36971e11-a696-4c24-a89a-45d6a562c594">
<wsu:Created>2016-01-21T17:59:33.442Z</wsu:Created>
<wsu:Expires>2016-01-21T18:04:33.442Z</wsu:Expires>
</wsu:Timestamp>
I needed to change the expiration time to ten minutes after the 'Created' time.

Here is what I found out:
Set the timeToLive property to the number of seconds to expiration (default: 300)
wss4jOutProps.put("timeToLive", 600);

Related

Calendar.setTimeInMillis giving Different value after setting the time

I am working with getting previous date for various time zone based on the current date.Right now in my code, I got the US current time in milli seconds and then setting the time which in another Calendar object.
Then I am modifying that Calendar object Date with negative values to get previous dates.
When I checked, Calendar object is returning different values than the values which I set.May be I did not understand how Calendar object works.
Please explain why the time is different.
Below code gets the current time in US
Timestamp currTimeInGMT = DateTimeUtils.getCurrentTimeInGMT();
Timestamp currTime = DateTimeUtils.convertDateTime(currTimeInGMT,TimeZone.getTimeZone("GMT"),TimeZone.getTimeZone("PST"));
Using the above code, I am getting Current US time as September 18 1.12 AM Then I am converting the time into milli seconds using this code
Long currentTimeInLong = currTime.getTime();
Then I am setting the above time in Calendar object
Calendar yesterdayCal = Calendar.getInstance(TimeZone.getTimeZone("PST"));
yesterdayCal.setTimeInMillis(timeInMillis);
After setting the time,
First I tried to get time from Calendar object using yesterdayCal.getTime(), I am getting September 18 1.12 AM
Then I tried to get Date, Hour, Minute using below code
Date=yesterdayCal.get(Calendar.DATE)
Hour=yesterdayCal.get(Calendar.HOUR)
Minute=yesterdayCal.get(Calendar.MINUTE)
I am getting the following results.
Date=17, Hour=12, Minute=42
Why I am getting two different results for two methods getTime() and get().
As #mwe answered, if it sets the time in UTC, then I should get the same time for both the methods even if its wrong time.
Please explain clearly, as I am really confused with these methods
If you use setTimeInMillis it sets the time in UTC.
So you have to add the time difference to you time zone, PST, to the long value.
yesterdayCal.setTimeInMillis(timeInMillis+8000l);

How to get Ticks in system date?

I need Ticks in Current date time, just print the Ticks only.
set #date = GETDATE();
I need this format output:
Ticks - 634513824000000000
You won't get precission you want. See: ##TIMETICKS
Returns the number of microseconds per tick.
The amount of time per tick is computer-dependent. Each tick on the operating system is 31.25 milliseconds, or one thirty-second of a second.
SELECT ##TIMETICKS
-- result: 31250

Check the expire date of every rows

I'll try to explain my problem:
I have one model Attorney with have many rows.
Every attorney have a date to expire in a date coloumn. Ex: 15/09/2013
I need to check, every day, if some attorney will expire in 30 days.
In other words, I need to check, every day, the date of every attorney registered and if the date of expire is less than 30 days, and grab the id of the attorney in this situation and execute an action.
I have nothing. How I do this?
You will probably need to use a cron job to execute these task every day.
To check if a record will expire in 30 days, you could use php strtotime to calc the final date. Then, you should compare if the expire date is lower or equals:
date('Y-m-d', strtotime( date('Y-m-d') . ' +30 day' ));
try the cron job for linux ;or schedule for windows . they will check the date field and do an action depend on your conditions , here is a link for example :
http://blog.nexcess.net/2013/05/09/cron-job-for-the-last-day-of-the-month/

Extjs-Adding seconds to timestamp

I have a form with timestamp field with 1 minute increment but i want seconds to be included to too. how to do it? is there a way to add seconds to timestamp? can someone help please?
ExtJs has a very rich Date function. To get the seconds timestamp:
var seconds = (new Date()).format('U');

recycle time reporting service

by default the recycle time for reporting service is 720 minutes (12 hours). It is the reportserver.config file
720
Now it happens every 2 o'clock. so consequently, it happens twice a day 2 AM and 2 PM. Now the problem is we cannot have it recycled during business hours (2 PM). how do I set this to occur only # 4 AM?
thanks
From http://msdn.microsoft.com/en-us/library/ms157273.aspx
"RecycleTime: Specifies a recycle time for the application domain, measured in minutes. Valid values range from 0 to maximum integer. The default is 720."
I would interpret this as, after running X minutes, the app domain will recycle. If you want it to recycle every 24 hours, set it to 1440 minutes (24h x 60m).
If you want it to happen at 4am, I would assume you need to recycle it manually at 4AM. This would presumably reset the timer and force the auto recycle (every 1440 minutes) to occur again after 24 hours (or at 4am).

Resources