on ‎2007 Mar 23 1:53 PM
hi,
i want to upload files to the server-cache, so that i can download them.
to do so, i used this code:
DATA: cached_response TYPE REF TO if_http_response,
guid TYPE guid_32,
CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg = 1.
cached_response->set_data( file-mimetype ).
cached_response->set_content_type( file_mime_type ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = guid.
CONCATENATE runtime->application_url '/' guid INTO url.
cl_http_server=>server_cache_upload( url = url
response = cached_response ).the file describes a gif image
the file-content is an xstring (about 44KB) and the mimetype is image/gif
this should work, but in the browser i get this error message:
-
-
BSP Exception: Das Objekt 4603E7BA78A5008C000000000A4222CA in der URL /sap(bD1kZSZjPTAwMQ==)/bc/bsp/sap/myapplication/4603E7BA78A5008C000000000A4222CA ist nicht gültig.
-
-
i checked the file-content, the mime typ and the url.
everything is filled and seems to be valid values.
i debugged into the server_cache_upload method and the inner function call give a sy-subrc = 0, so it seems also be good.
but i can not download the file from the server.
the strange thing is, that this code already worked, until i changed the source from witch i load my file-content.
but in case of a bad file content the browser should also download and try to show me, right?
at my tries of changing the sourceloader i make some errors and i created some empty responses, because the file-content wasnt loaded.
could it be that these attempts of creating empty responses somewhere destroyed the server-cache?
hopefully Grafl Ronald
Request clarification before answering.
correct your code with below correct..
l_pdf_len = xstrlen( l_pdf_xstring ).
cached_response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = file_mime_type ). "'application/pdf'
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).apart of the above change, everything is fine..
<i>* Reward each useful answer</i>
Raja T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
very very strange
we tried to find the problem with the smicm
and now it works xD.
dont know why, we didnt something else than show statistik and cache entries 😃
mfg Grafl Ronald
--
The problem appears again
--
We solved the Problem.
it seems that the server-cache is somewhere connected to the spool.
Message was edited by:
Grafl Ronald
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.