Difference between revisions of "LlSetContentType"

From Second Life Wiki
Jump to: navigation, search
(I think this function is intended for attachments, hence the owner restriction.)
Line 1: Line 1:
<!-- {{LSL Generic/RC|[[Beta/Magnum|RC Magnum]]}} -->
 
 
{{LSL_Function
 
{{LSL_Function
 +
|inject-1={{LSL Generic/RC|[[Beta/Magnum|RC Magnum]]}}
 
|mode=pre-release
 
|mode=pre-release
|func=LlSetContentType
+
|func=llSetContentType
 
|func_id=?
 
|func_id=?
|func_energy=0.0
+
|func_energy=?
|func_sleep=0.0
+
|func_sleep
|func_desc=Set the [http://en.wikipedia.org/wiki/Internet_media_type Internet media type] of an [[LSL HTTP server]] response.
+
|func_desc=Set the {{Wikipedia|Internet media type|Internet media type}} of an [[LSL HTTP server]] response.{{Footnote|This function sets the "Content-Type" header in any subsequent [[llHTTPResponse]] responses.}}
 
|sort
 
|sort
|func_footnote=
+
|func_footnote
 
|return_type
 
|return_type
 
|return_text
 
|return_text
 
|p1_type=key|p1_name=request_id|p1_desc=a valid [[http_request]]() key
 
|p1_type=key|p1_name=request_id|p1_desc=a valid [[http_request]]() key
 
|p2_type=integer|p2_name=content_type|p2_desc=Media type to use with any following [[llHTTPResponse]]('''request_id''', ...)  
 
|p2_type=integer|p2_name=content_type|p2_desc=Media type to use with any following [[llHTTPResponse]]('''request_id''', ...)  
|constants={{{!}} {{Prettytable|style=margin-top:0;margin-bottom:0;}}
+
|constants={{{!}} class="sortable" {{Prettytable|style=margin-top:0;margin-bottom:0;}}
 
{{!}}-{{Hl2}}
 
{{!}}-{{Hl2}}
! colspan="2" {{!}} content_type
+
! {{!}} content_type
! Description
+
! title="Value" {{!}}
{{!}}-
+
! Content-Type
{{!}} {{LSL Const|CONTENT_TYPE_TEXT|integer|ihex=0|c=text/plain}}
+
{{!}}- <!-- to correct these, change the ihex value to the base 10 integer value of the constant and remove "|hex=0x?" and delete this comment-->
 +
{{!}} {{LSL Const|CONTENT_TYPE_TEXT|integer|ihex=unknown value|hex=0x?|c=text/plain}}
 
{{!}} {{#var:value}}
 
{{!}} {{#var:value}}
 
{{!}} {{#var:comment}}
 
{{!}} {{#var:comment}}
 
{{!}}-
 
{{!}}-
{{!}} {{LSL Const|CONTENT_TYPE_HTML|integer|ihex=0|c=text/html}}
+
{{!}} {{LSL Const|CONTENT_TYPE_HTML|integer|ihex=unknown value|hex=0x?|c=text/html}}
 
{{!}} {{#var:value}}
 
{{!}} {{#var:value}}
 
{{!}} {{#var:comment}}
 
{{!}} {{#var:comment}}
Line 28: Line 29:
 
|spec
 
|spec
 
|caveats=
 
|caveats=
* This function only has an effect for embedded browsers, on content owned by the person viewing. In all other cases text/plain will be used. {{Hilite|Need to verify what counts as "owned" here.}}
+
* This setting will be ignored if..
 +
*# the web browser is not the Second Life client
 +
*# the user (logged into the SL client viewing the page) is not the owner of the object. {{Hilite|What about group owned objects?}}
 
|examples
 
|examples
 
|helpers
 
|helpers
Line 43: Line 46:
 
|cat1=HTTP
 
|cat1=HTTP
 
|cat2=HTTP/Server
 
|cat2=HTTP/Server
 +
|comments=The client and owner limitations are most likely to remove the possibility of running a website from a prim.
 
}}
 
}}

Revision as of 21:09, 3 August 2011

KBcaution.png Important: This feature is currently only available on the RC Magnum server channel.
Emblem-important-red.png Pre-release Documentation Warning!

This function is not available yet. This documentation was written prior to its final release so it may not match the final implementation.

Summary

Function: llSetContentType( key request_id, integer content_type );

Set the Internet media type of an LSL HTTP server response.[1]

• key request_id a valid http_request() key
• integer content_type Media type to use with any following llHTTPResponse(request_id, ...)
content_type Content-Type
CONTENT_TYPE_TEXT 0x? text/plain
CONTENT_TYPE_HTML 0x? text/html

Caveats

  • This setting will be ignored if..
    1. the web browser is not the Second Life client
    2. the user (logged into the SL client viewing the page) is not the owner of the object. What about group owned objects?
All Issues ~ Search JIRA for related Bugs

Examples

See Also

Events

•  http_request

Functions

•  llHTTPResponse

Articles

•  LSL HTTP server

Deep Notes

History

  • Scheduled for RC Magnum channel, week of August 3, 2011.
Search JIRA for related Issues

Footnotes

  1. ^ This function sets the "Content-Type" header in any subsequent llHTTPResponse responses.

Signature

function void llSetContentType( key request_id, integer content_type );

Comments

The client and owner limitations are most likely to remove the possibility of running a website from a prim.