How do I maintain session state with a Google Earth client? - java

I'm playing with dynamic updates to Google Earth KML files.
The updates are of the form
<kml...>
<NetworkLinkControl>
<Update>
<targetHref="...">
<Change>
<Placemark targetId="...">
...stuff to update...
</Placemark>
</Change>
</Update>
</NetworkLinkControl>
</kml>
And it all works greatm from my Java Servlet - except that GE doesn't seem to support HTTP Sessions, and I need to provide only the updates that have occurred since the last request from a given client.
Am I doing something wrong? Does GE support sessions and I'm too stupid to work out how? If I need to provide client-specific updates without sessions, how can I do that? (I know I could use the source IP address as a coarse measure but that feels kinda nasty...)
Thanks!

Old question, but you need to encode the session ID as part of the URLs. GE does not maintain cookies.

It seems that I can use the kml/NetworkLinkControl/cookie element to give the client a parameter to send back to me. Trying to use this to get the client to tell me when it last requested an update and use this instead of sessions...

Related

Stream key with YASEA

I'm trying to stream via RTMP to a server made by other people. I'm using Android so I'm trying with YASEA.
I've used YASEA other times and it worked good, just passing and URL to it. My problem now is that the server now has an url type:
rtmp:[server]:[port]/[something]/[something]
but also I have what they call "Stream Name/Stream Key".
I've tested OBS and the Android app RTMPCamera and they let me set url and that Stream key, but in YASEA I don't have a clue of where to put that key.
Does anyone know if there's a place to set it or if I can set it within the URL?
I've tested with:
rtmp:[server]:[port]/[something]/[something]/[key]
rtmp:[server]:[port]/[something]/[something]?StreamKey=[key]
rtmp:[server]:[port]/[something]/[something]?StreamName=[key]
rtmp:[server]:[port]/[something]/[something][key]
rtmp:[server]:[port]/[something]/[something]?key=[key]
rtmp:[server]:[port]/[something]/[something]?[key]
But none of those worked.
.. usually it's just url/stream_key.
rtmp:[server]:[port]/["Stream Name/Stream Key"]

Alfresco notification mail link modify

I am using Alfresco community edition-5.1.x set up SMTP configuration in my production server whenever user doing activity in alfresco user get notifications mail, We able to get all the information but in the mail notification mail down alfresco url is there with my domain name (i.e http://mydomainxx.com:5038) when click the link not working browser because its wrong url how can i change to (http://mydomainxx.com) only domainname not with port number , I am stuck on that any can help out.
You should change the default alfresco-global.properties:
alfresco.context=alfresco
alfresco.host=127.0.0.1
alfresco.port=8080
alfresco.protocol=http
share.context=share
share.host=127.0.0.1
share.port=8080
share.protocol=http
In your case just changing the port to 80 would be sufficient.
There's a couple of places mentioned here that you could try out (haven't tried them myself). If that proves to not work, IMHO the easiest way is to simply change the notification FTL's with the URL you want (found at "Company Home/Data Dictionary/Email Templates").
However, it is not the cleanest one, so decide for yourself whether you want to take that route.
Hope this helps someone.
#
# URL Parameters(SSL)
# -------------------------
alfresco.context=alfresco
alfresco.host=yourdomain.com
alfresco.port=443
alfresco.protocol=https
share.context=share
share.host=yourdomain.com
share.port=443
share.protocol=https
## Non-ssl
alfresco.context=alfresco
alfresco.host=yourdomain.com
alfresco.port=8080
#<YOUR_PORT_NUMBER>
alfresco.protocol=http
share.context=share
share.host=yourdomain.com
share.port=8080
#<YOUR_PORT_NUMBER>
share.protocol=http

Java Web Start return value - workaround

I know that returning a value from a JWSapp to the "calling" page cannot be done.
However, I use this JWSapp to get user ID from its biometric information.
The idea is that when you try to login, a button allows to launch the JWSapp that will deal with the biometric tasks and then return the user's idea.
Still, as I said, from a JWSapp I cannot send back the id to auto-complete the field. I found this post: Returning a value from a java web start application but I really need to keep the JWS (external constraints)...
So there's my question: is there any workaround to get the id back?
Thank you in advance :)

How do you set up a redirect from www to non-www with Play! Java 2.3 running the default server?

I recently set up a website and pushed it to production using Digital Ocean. However, I noticed that for both SEO purposes and to make Facebook Share work appropriately, I should set up my server to redirect www. requests to non-www. I'm running Play! Java 2.3 with a PostgreSQL database and the default Netty server. Any advice would be greatly appreciated.
There are lots of ways of redirecting. I wouldn't say DNS-redirects are the correct and only way of doing it, it's one way. Google is just fine with you doing a 301 redirect with Play.
Here's one way of accomplishing it with Play! filters (scala):
object NonWwwFilter extends Filter {
def apply(f:RequestHeader => Future[Result])(rh: RequestHeader): Future[Result] =
if (rh.host.startsWith("www.")) {
Future.successful(Results.MovedPermanently("https://" + rh.host.substring(4) + rh.uri))
} else {
f(rh)
}
}
The right way to do it is to do in not on the framework/webserver side, but on the DNS-server side.
You can do it in DNS-management area of GoDaddy or any other domain name registrar.

In java, how can I get an Amazon EC2 Instance to see its own tags?

So I have a java program running within an Amazon EC2 instance. Is there a way to programatically get its own tags? I have tried instantiating a new AmazonEC2Client to us the describeTags() function but it only gives me null. Any help would be appreciated thank you.
Edit: To make things clearer, the instances are going to be unmanned worker machines spun up to solely do some computations
This should help you get started...
String instanceId = EC2MetadataUtils.getInstanceId();
AmazonEC2 client = AmazonEC2ClientBuilder.standard()
.withCredentials(new DefaultAWSCredentialsProviderChain())
.build();
DescribeTagsRequest req = new DescribeTagsRequest()
.withFilters(new Filter("resource-id", Collections.singletonList(instanceId)));
DescribeTagsResult describeTagsResult = client.describeTags(req);
List<TagDescription> tags = describeTagsResult.getTags()
You should be able to get the current instance id by sending a request to: http://169.254.169.254/latest/meta-data/instance-id. This only works within ec2. With this you can access quite a bit of information about the instance. However, tags do not appear to be included.
You should be able to take the instance id along with the correct authentication to get the instance tags. If you are going to run this on an instance, you may want to provide an IAM user with limited access instead of a user which has access to everything in case the instance is compromised.
While using user-data may be the simplest solution, the OP was asking specifically about the tagging, and unfortunately amazon hasn't made this as easy as it could be. However, It can be done. You want to use a combination of 2 amazon services.
First you need to retrieve the Instance ID. This can be achieved by hitting the URL from within your instance:
http://169.254.169.254/latest/meta-data/instance-id
Once you have the resource ID, you'll want to use Amazon's EC2 API to access the tags. Since you said you're using Java, I would suggest the Using the AWS SDK amazon makes available. Within this SDK you'll find a method called describeTags (documentation). You can use a Resource ID as one of the filters to get the specific tags to your instance. Supported filters are
tag key
resource-id
resource-type
I suggest doing this retrieval at boot using something like cloud-init and caching the tags on your server for use later if necessary.

Categories

Resources