I moved a Play Framework Project to a new PC and everything is working fine but there is one annoying problem:
All static assets return the 304: Not Modified header even after I edit them. And I think I found the origin of the problem, play framework replies following in curl:
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 527
Content-Type: application/javascript; charset=utf-8
Date: Wed, 14 Jan 2015 17:49:24 GMT
ETag: "4a0670efaaa84f8734d67d4557a7309dfe235301"
Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
The Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT part seems wrong to me.
And also when I edit something, the ETag isn't changing. This is annoying because Chrome doesn't load the changes unless I delete the cache and this makes mobile development nearly impossible.
The same thing also happens when I create a new application. It worked in my old Laptop wich had also Windows 8.
It looks like #3722.
Assets controller sends constant etag if path has a space in the name
Does the path to your workspace or to your assets has a space in it ? If so, remove it and try again.
I hope it helps.
Related
I am using com.opencsv.CSVReader to read a CSV from a URL served by my nginx Web server. The CSV file content is exactly this:
0.999,1.399,1.799,2.199,2.599,2.999,3.399,3.799,4.199,4.599,4.999,5.399
The problem is that when I read the file I get no csv values:
try (InputStreamReader in = new InputStreamReader(new URL(...csv).openStream(), "UTF-8"); CSVReader r = new CSVReader(in)) {
List<String[]> csv = r.readAll();
....
After this point, csv has failed to get the data (but no errors are raised), and csv.get(0).length is incorrectly 1, an empty string. I do not know why. Tests that I have done to isolate the problem:
I have tried obtaining the file via http and https from my nginx with similar results. I must say that this code was working fine not too long ago, and with no apparent reason now it is failing.
I have used a BufferedReader to see what was in in before reading the csv and I got:
Date: Fri, 10 Aug 2018 03:11:13 GMT
Content-Type: text/plain
Content-Length: 71
Last-Modified: Wed, 12 Jul 2017 16:23:24 GMT
Connection: keep-alive
ETag: "..."
Strict-Transport-Security: max-age=31536000
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Accept-Ranges: bytes
0.999,1.399,1.799,2.199,2.599,2.999,3.399,3.799,4.199,4.599,4.999,5.399
So I am not sure if the headers were also read by the csv reader and messed with it somehow.
I have used the same code to access an external CSV instead of the one served by my nginx and it worked fine, and the test using the BufferedReader with the external CSV did not show any header, just the csv values.
That is why I am also considering that it could be an nginx problem, since I also experienced a recent error of files not finishing download and I had to change my previous keepalive_timeout 65 that was working fine to keepalive_timeout 0. I am not sure why this happened all of a sudden.
This was very hard to debug, but the solution was to reinstall nginx because my copy was corrupted. My nginx instance was sending extra \r characters that did not interfere with curl or similar but that disrupted the Java implementation.
By the way - This probably highlighted a bug in .openStream() implementation.
I need to get events\log for all activities done by admin and other office365 users such as user login, user logout, create user, delete, Update
I have successfully configured office 365 management activity API and also receiving responses for following Content Type
Audit.AzureActiveDirectory
Audit. Exchange
Audit.SharePoint
DLP.All (DLP events only for all workloads)
But for Audit.General Content Type I am receiving Empty response please help me to solve this problem?
Do the Audit.General API provides the admin and users activities log.
If not in what ways I can get these logs, please advise.
Responce for Audit.General`
--> GET https://manage.office.com/api/v1.0/a153759e-c827-46b8-8223-7ceb5c246c3f/activity/feed/subscriptions/content?contentType=Audit.General http/1.1
User-Agent: java-tutorial
client-request-id: e77e2404-666b-4898-85bb-afa1d2da0cae
return-client-request-id: true
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlZXVkljMVdEMVRrc2JiMzAxc2FzTTVrT3E1USIsImtpZCI6IlZXVkljMVdEMVRrc2JiMzAxc2FzTTVrT3E1USJ9.eyJhdWQiOiJodHRwczovL21hbmFnZS5vZmZpY2UuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvYTE1Mzc1OWUtYzgyNy00NmI4LTgyMjMtN2NlYjVjMjQ2YzNmLyIsImlhdCI6MTUwMTg0MDcwMSwibmJmIjoxNTAxODQwNzAxLCJleHAiOjE1MDE4NDQ2MDEsImFjciI6IjEiLCJhaW8iOiJZMkZnWUJCeWZpRjF3Q0R6eitjMVNrR0pvaXVkWHF5L2QzaFZxTlpHeitjR1VabHp0UElCIiwiYW1yIjpbInB3ZCJd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jYyJEuoRZM6b65QKUcaOTaamK-ZjJKItkEpYs-I_g
--> END GET
<-- 200 OK https://manage.office.com/api/v1.0/a153759e-c827-46b8-8223-7ceb5c246c3f/activity/feed/subscriptions/content?contentType=Audit.General (163ms)
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 2
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.5
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Fri, 04 Aug 2017 10:03:25 GMT
OkHttp-Sent-Millis: 1501841286505
OkHttp-Received-Millis: 1501841286668
[]
<-- END HTTP (2-byte body)`
Currently I am working on Office 365 Management Activity API and I also faced this scenario earlier. This API was released by Microsoft merely within one year and it is in growing stage only. However, I would strongly recommend you to raise ticket to Microsoft support from your Office 365 admin portal. Microsoft support team will contact and assist you getting your problem resolved.
I'm trying to get the all contributors of a repo using this github api.
If I'm not wrong,it also tells me, if there are more than 500 contributors for a repo, it only gives 500 of them and rest are marked as anonymous.
For performance reasons, only the first 500 author email addresses in the repository will be linked to GitHub users.
This repo linux kernel has 5k+ contributors, as per the api i should get at least 500 contributors through the api.
When i do curl -I https://api.github.com/repos/torvalds/linux/contributors?per_page=100
I get only 3 pages (per_page = 100) so i get >300 contributors.(look at "link" header)
Is there a way to get all the contributors of the repo ( 5000+ )?
HTTP/1.1 200 OK
Server: GitHub.com
Date: Thu, 19 Nov 2015 18:00:54 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 100308
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 56
X-RateLimit-Reset: 1447958881
Cache-Control: public, max-age=60, s-maxage=60
Last-Modified: Thu, 19 Nov 2015 16:06:38 GMT
ETag: "a57e0f74fc68e1791da15d33fa044616"
Vary: Accept
X-GitHub-Media-Type: github.v3
Link: <https://api.github.com/repositories/2325298/contributors?per_page=100&page=2>; rel="next", <https://api.github.com/repositories/2325298/contributors?per_page=100&page=3>; rel="last"
X-XSS-Protection: 1; mode=block
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
Vary: Accept-Encoding
X-Served-By: a30e6f9aa7cf5731b87dfb3b9992202d
X-GitHub-Request-Id: 67E881D2:146C9:24CF1BB3:564E0E55
Since the GitHub API doesn't seem to support this, another approach (a much much slower approach) would be to clone the repo and then run this command (to get names):
git log --all --format='%aN' | sort -u
To get results by email address (which should guard against contributor name config changes and will be more accurate):
git log --all --format='%aE' | sort -u
If you needed this functionality for any repo you could write a simple script that would take in the repository path, clone the repo, run the command, and then delete the downloaded repo.
In the meantime, you could contact GitHub in hopes they increase the priority in expanding/fixing their API.
If I run a webapp under the uri /myapp then as soon as the app is accessed via http://example.com/myapp, the URL changes to http://example.com/myapp/. Is there any way to prevent this?
When you have such a behaviour your web (or application) server returns a
301 Moved Permanently
when the URL without slash is requested.
You can see a similar example when getting http://www.google.es/services
HTTP/1.1 301 Moved Permanently
Location: http://www.google.es/services/
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Date: Wed, 11 May 2011 15:24:06 GMT
Expires: Fri, 10 Jun 2011 15:24:06 GMT
Cache-Control: public, max-age=2592000
Server: sffe
Content-Length: 227
X-XSS-Protection: 1; mode=block
After this first HTTP get to http://www.google.es/services
(without slash), the browser makes a second HTTP get to http://www.google.es/services/ (with slash). You can trace the HTTP requests with Network tab in Firebug, for example.
You can check your web/application server configuration, and maybe you can change this behaviour.
So recently I learned that in order to serve static files with a Last-Modified header from Google App Engine, I had to write my own (simple) servlet to do that. OK fine, I went and did it, results can be viewed here.
But now I find that File.lastModified() is always returning the same value, no matter that I have touched the file, even tried outright replacing it, and also re-deployed my app. The headers always come back with the same Last-Modified field:
HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment; filename="java-intro.zip"
Last-Modified: Tue, 04 Aug 2009 17:48:41 GMT
Last-Modified-in-millis: 1249408121000
Date: Tue, 04 Aug 2009 20:47:59 GMT
Server: Google Frontend
Content-Length: 0
Also curious is that it comes back with zero content-length, despite the fact that I am setting that in the HttpServletResponse, and I get back the proper data when I download it using my browser.
What gives, Google App Engine?