Help transmitting different content types to servlet

Hi,
I need to send data from my J2ME app to a servlet.
Firstly, I need to send a bunch of text which is interpreted by the servlet and used to set various things. I can do this fine by setting the content type of the connection object to "application/x-www-form-urlencoded". After I have sent this data, I then need to send a byte array to the same servlet. I have read that this needs to be sent as "application/octet" type, but setting the header to that before closing the connection object throws an error, and fails to send anything to the servlet. How do I send multiple content types to the servlet? Do I need a new connection object? And if so how do I handle the servlet side of things to distinguish between both connections?
Chris

figured it out - i closed the first connection and opened another to send the binary data. then on the servlet I distinguished between the two by reading the request header to see what type of data was being sent at that time.

Similar Messages

  • How to set content type in servlet?

    Hi, there,
    I'm writing a servlet to use ObjectOutputStream to return an object to applet. How can I set this content type in servlet?
    Thanks.

    Actually, I'm writing a "HashMap" from servlet to applet. I have used your suggested content type "application/octet-stream" and another "appication/x-java-serialized-object" to try it. But in applet side, when I use (HashMap)in.readObject(), it always gives me a exception as:"java.util.HashMap; IllegalAccessException". Why?
    Thankd.

  • Help with email content type HTML

    Hi,
    Following is my control file code for sending the email message (just putting the delivery part, and not the while content from control file):
    <xapi:delivery>
    <xapi:email server="${DCRD_SMTP_HOST}" port="${DCRD_SMTP_PORT}"
    from="${CP_DCRD_ADMIN_EMAIL}"
         reply-to="${CP_DCRD_ADMIN_EMAIL}">
    <!-- Set the id for the delivery method -->
    <xapi:message id="123" to="${CF_DCRD_CONTACT_EMAIL}" cc="${CP_DCRD_ADMIN_EMAIL}" bcc="[email protected], [email protected]" attachment="true" content-type="html"
    subject="Datacard Maintenance Agreement Number ${CONTRACT_NUMBER} ">${CF_FINAL_EMAIL_CONTENT}
    </xapi:message>
    </xapi:email>
    </xapi:delivery>
    The formula column CF_FINAL_EMAIL_CONTENT get populated with some html content based on condition. Now, when I get the email, the text from the formula column get printed as is.......with tags and all. It's like I had unformatted plain text email. I need the content to be formatted and I need different content based on a condition. Has anyone done this before?
    Appreciate any help on this.
    Thanks,
    Alka

    I finally could fix the issue by still using a formula column to store the html text and using the following in my control file (in bold):
    <xapi:message id="123" to="${CF_DCRD_CONTACT_EMAIL}" cc="${CP_DCRD_ADMIN_EMAIL}" bcc="[email protected], [email protected]" attachment="true" content-type="text/html"
    subject="Datacard Maintenance Agreement Number ${CONTRACT_NUMBER} "> *<content><![CDATA[${CF_FINAL_EMAIL_CONTENT}]]></content>*
    </xapi:message>
    Hope this would help someone clueless like me :-)
    Alka

  • Urgent, Please help - UnsupportedMediaException: Unsupported Content-Type

    Hello Fusion Geeks,
    I am trying to call a web service. I am using "create web service proxy" in jdev, generated by JAX-WS. When I am calling the web service using Client java code generated by jdeveloper I am getting exception "Exception in thread "main" com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/octet-stream Supported ones are: [application/soap+xml]" . I did not get any response back from web service.
    However I have some observations :
    1) I switched on HTTP analyzer on my jdeveloper to check what SOAP request is getting passed from my program. I found that the perfect SOAP message has been formed and hitting the correct endpoint. And I found that correct response back in HTTP analyzer.
    2) The error message I got is : "Exception in thread "main" com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/octet-stream Supported ones are: [application/soap+xml]" I looked into oracle support for this error message I found that this error message is listed there. I tried the solution mentioned under document titled "JAX-WS web service that uses SOAP 1.2 binding throws error "Unsupported Content-Type" [ID 844691.1]" . But that did not solve my problem.
    Thanks

    Hello Vlad,
    Thanks for your response. In response I see Content-Type: application/xop+xml; which is different from what you are saying (application/soap+xml). Surprisingly SOAP UI shows response correctly but it fails from java jax-ws proxy.
    Content-ID: <SoapContent>
    Content-Type: application/xop+xml; charset=utf-8; type="text/xml; charset=utf-8"
    Content-Transfer-Encoding: binary

  • I need help using multiple content types in a wiki page library

    I currently trying to used multiple custom content types based off of the wiki page content type in one wiki page library. 
    EDIT: "Allow management of content types" has been enabled with the designer
    The way i would like this library to work is:
    Click the "Files" tab in the ribbon
    Click the "New Document" drop down menu
    Select one of the content types (Client, Contact, Project)
    SharePoint Will Ask for the Page Name and content type fields
    Click create
    Then it will take you to the new created page.
    This issue I'm currently having is when i click on one of the options (Client, Contact, Project) it will ask for a page name then you have to check it in to get to the edit form. The edit form it then loads is the default content type and not the selected
    content type.
    So my questions are.
    Is there any way i can combine the page name and edit steps together into one step?
    How can I get the edit form to pull from the selected content type?
    Thanks in advanced
    James T.F

    Wiki library isn't really designed for customizations... it's a "special" library that overrides a lot of default behavior... similar evidence can be found if you're trying to add metadata columns to wiki pages... they're just not really designed to handle
    it very well.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Writing different Content Types to Response

    I am writing the part of an application that will display documents that users have stored on the system. The types we allow or .tiff, , .PDF, Word, and Excel.
    I am sending the contents of the file to the response with this code:
    PrintWriter out = response.getWriter();
    File file;
    ServletContext sc = getServletContext();
    String mimetype;               
    file = new File(pathToFile);
    mimetype = sc.getMimeType(pathToFile);
    response.setContentType(mimetype);
    // Read in the file and send chars to response
    FileReader fReader = new FileReader(file);
    char[] chars = new char[500];
    while((fReader.read(chars)) != -1) {
         out.write(chars);
    fReader.close();
    out.flush();
    out.close();The mime types I am using are
    application/msword
    application/vnd.ms-excel
    application/pdf
    image/tiff
    Word works great. Excel sort of works. IE displays an error that data may be lost, but then displays the worksheet.
    PDF half works. The table of contents displays in the left frame, but the right content frame is blank. And tiff only shows a distorted version of the image.
    And it doesn't work in Firefox at all. I just get a blank frame regardless of the file type.
    My question is, am I doing this correctly? Am I reading in the file and writing it back to the response the correct way? PDF and TIFF are working partially but not 100%. I feel like I am missing something.
    Thanks,
    Karl

    Thanks a lot. It works perfectly now........in IE.
    In Firefox PDF and images work ok, but for Word and Excel I get endless "Open With.." dialogs. Is this a plugin issue? I added the following line to my servlet with no change in result:
    response.setHeader("Content-Disposition","inline");
    Thanks,
    Karl

  • Issue with New Document in a document library with multiple content types

    Hi,
    I have a created a custom list definition based on a document library. I added 3 content types in this list, one is a document set (lets call it DOCSET), the two others are content types inheriting from Document (DOCA and DOCB).
    I deployed the list definition with a site scoped feature and the list instance with a web scoped feature. After activating the two features, the list is created and the content types are present in the list.
    When I click in the New Document button and choose either the DOCA or DOCB content type, a Word document opens and the DOCA content type is always associated to this Word document.
    With SharePoint Manager 2013 I saw that the template.dotx document was not in the Forms/DOCA or Forms/DOCB folder.
    So I decided to remove all the content types from the list definition and add them by code with the ListAdded event receiver. I used list.ContentTypes.Add to add the content types to the list.
    With this method the templates are correctly copied from the template.dotx in the RootFolder/Forms folder of my list. These templates have the rights content type id, but the New Document button still does not work properly.
    So I looked at the Content Types inside my library and saw that the DocumentTemplateUrl linked to the RootFolder/Forms/template.dotx and not the RootFolder/Forms/DOCA/template.dotx or RootFolder/Forms/DOCB/template.dotx.
    I debugged my code to look closer and see that right after the list.ContentTypes.Add, the DocumentTemplateUrl is correclty set but when my EventReceiver finishes, the DocumentTemplateUrl get back to the RootFolder/Forms/template.dotx.
    Have you any idea why this is not working ?
    Regards

    Hi,
    Per my understanding, there is an issue about the DOCA and DOCB content types which inherits from Document Content Type in your custom list definition.
    By default, if there is a custom content type inherits the OOTB Document Content Type, it will also inherits the template.dotx file from the OOTB Document Content Type.
    The template URL of a custom content type which inherits the OOTB Document Content Type:
    If you want to specify different templates for different content types, the code demo below would be helpful:
    http://www.learningsharepoint.com/2010/07/14/programmatically-create-a-new-content-type-in-sharepoint-2010/
    Thanks
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Update Item when Content Type is changed in the browser

    I feel like I might be missing something obvious here - I set up a number of managed content types.  While editing a list item with multiple content types, when a user changes to a different content type using the drop down at the top of the page,
    the edits are not saved.  Is there any way to force an update when the user changes content type?  Clicking save returns the user to the list view which means the user needs to edit it again, and navigate to the content type.

    Hi Steve,
    Per my understanding, you might want to update item with the input values when content type changed by selecting an option in the “Content Type” drop down menu in
    EditForm.aspx page.
    A Content Type is a set of predefined columns, from the perspective of the use of Content Type in a list, it would be easier to maintain per record with only one content
    type as an item, this is also a recommended behavior when working with multiple content types in a list.
    If you want to take use of columns from multiple content types in an item, a suggestion is that you can create a custom content type with the columns from other content
    types you want, then add it into your list.  
    Thanks 
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Workflow attached to content type shows the status as 'Starting'

    Hi,
    I have developed a workflow to distribute documents from Drop Off library to different SharePoint libraries based on the content type that the document uploaded to.
    The drop off library has been configured incoming mail settings hence the documents would be on boarded to drop off library through e-mails. In this scenario, my workflow should be triggered when the document is on boarded through email.
    Another scenario, the user can upload the document to different content type manually and updates the respective meta data values. This scenario, my workflow should be triggered when the item updated.
    So, I have configured my workflow should run on the content types and trigger when item is created through e-mail and item is updated by manual.
    The document on boarded through e-mails are working fine as soon as the item is created.
    Issue:
    The workflow associated on a content type which needs to be triggered on item created is triggering as soon as the user uploads a document manually and shows the status as 'Starting'.
    The workflow associated on a content type which needs to be triggered on item modified is triggering as soon as the user updating meta data values after document is uploaded. Hence, throwing an error
    'cannot open a file from drop off' library exception when I try to read file using C# code as file stream bytes.
    Configuration:
    1. The content types are having mandatory fields which has a default values set.
    2. The document version settings are set as check out the document when editing the properties.
    Please help me to resolve this bug and let me know if you need more details.
    Also, let me know how can we cancel the workflow if it is in 'starting' mode.
    The workflow should run the document is onboardedwhen an item is created and

    Hi,
    According to your description, my understanding is that you want to get data from content type in JSlink.
    I suggest you can get the content type data in JSLink using JavaScript Client Object Model.
    Here are some derailed code demos for your reference:
    http://sharepoint.aspcode.net/view/635399286724222582163436/sharepoint-how-to-get-field-value-using-jsom-jslink-without-async-call
    http://sharepoint.stackexchange.com/questions/93777/how-to-get-contenttype-name-in-clientsidejavascript-jquery-csom-etc-in-editf
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Specifying Content Type of the Response

    Can anyone enlist the different content type supported by browsers.
    In the Servlet, I need to set this to enable file download.
    My web application should supoort upload and download of files of any file type.

    http://www.ietf.org/rfc/rfc2045.txt

  • Document Sets and Content Types

    Hi All,
    I am having trouble in getting the "document sets" content types applied as expected when I try to create a site based off custom template.
    Scenario:
    We have 8 document sets stored in a document library. This library is part of a site which we have saved as a template.
    E.g. of document sets is "Others", "Meetings" etc
    Each of these document sets have one or more content types associated with it.
    We are trying to create a site based off the saved site template using powershell.
    E.g. $web = New-SPWeb http://myserver/sites/mysite/subsite
    $web.ApplyWebTemplate("{GUID}#Name of Template")
    When we open the document sets in this newly created site, the content types seem to be coming all together rather than being associated with the specific document set.
    E.g. Clicking "New document" in the "others" document set would show up content types from "meeting" and all the remaining document sets present in that library.
    Interestingly, when I go to "Document Set" settings, I only see the content type of "Others" Document Set.
    Any idea why the "New document" dropdown for the document set is not behaving as expected?

    Hi Abhi,
    Based on your description, I did a test. In my testing, everything worked well.
    The steps are:
    Go to Site Actions->Site Settings->Site content types.
    Create a new content type, and select parent content type from Document Set Content Types, and Parent Content Type: Document Set
    Click ok
    Under Settings, click Document Set settings
    On the Allowed Content Type section, select some content types and add them
    Click OK
    Then repeat step2-6, and create another custom document set
    Open your library, and allow management of content types in advanced settings
    Add the two document sets into the library
    Check each document set, and each one had different content types
    Save the site as a template and include the content
    Create a new site based on the site template using PowerShell(the command was same with yours)
    After creating, check the document sets of the library in the new site, everything worked well.
    Please check your process as the above steps.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Content Type Question

    I created a term set called 'Document Category' that has 10 different terms (e.g. Quote, Agreement, Diagram, etc.) that describe the types of documents users save into our main document library. I then created 10 different Content Types, each with it's
    own template, so, from the doc library, users can click Files > New, and choose the appropriate content type to create a document. I want to be able to sort in the library using a custom column I created, called 'Document Category', that links to the 'Document
    Category' managed metadata term set. When users create a new document based on one of the content types, I want the 'Document Category' field automatically populated in the Document Information Panel with the correct term. My problem is that I can't find a
    way of getting each individual content type to default to it's matching term. I can set the custom column to use a default value (e.g. Quote) so it comes up automatically filled in for the 'Quote' content type. Because I'm linking the 'Agreement' content type
    to the same custom column, though, it obviously then defaults to 'Quote', too. I was hoping to have a different term linked to each content type. Does anyone know how to do this? Any help would be greatly appreciated! -Pete

    Hi,
    According to your post, my understanding is that you wanted to set the 'Document Category' field automatically.
    I recommend to create SharePoint 2010 Platform workflow and then set an empty Managed Metadata column using the following format: Term Name| Unique Identifier based on the item content type.
    You can create workflow as below and start the workflow automatically when an item is created:
    Thank you for your understanding.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Filter SharePoint 2010 Ent. content types based AD Security Group

    We are trying to use SharePoint as a records management system. I have several site collections (Team Site at the root of each site) and my plan is to setup one site collection as a content type hub. The content type hub would then distribute all of the
    content types to my other site collections. Since I may have 70 different content types I want to filter what each user can see based on AD Security Groups (the SG matches the department the employee is in). This way they can only choose the content type that
    applies to their department and it won't be so confusing. I'll then apply retention policies based on content type. I know that I can apply retention policies based on the document library but I want the users to be able to organize their records however they
    want to.
    Am I taking the wrong approach? Is this possible?

     
    Hi,
    As far as I know, we can define the Permission Set on a content type. In this way, you can control which users or group can change or access which content types.
    For more information about SharePoint security and content type, see
    http://blog.contentmanagementconnection.com/Home/21510
    Thanks,
    Rock Wang
    Rock Wang TechNet Community Support

  • Dispform.aspx with content types

    SharePoint 2013 farm.
    I have two content types in a list. I need to change the dispform.aspx. 
    There are different fields for both content types, so copying the dispform.aspx to create and modify a new one is not a solution I think. I am not sure. i am new in this :)
    Can someone give me a step by step, how to modify the displayform of a list so that I can customize the the form for both content types.
    best regards,
    Olafur

    Hi  Olafur,
    There is a way in SharePoint Designer to specify which form the different content types in a list or library will use.
    Open up the list,  click on the content type name:
    On the Content Type screen, under the forms section, there is a text field where you can enter the relative path to the new form that you created.
    Reference:
    http://social.technet.microsoft.com/Forums/en-US/8f62d12d-8b72-40c7-baa4-59f4c211e86a/calendar-unique-newform-for-each-content-type?forum=sharepointgeneralprevious
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Content type of .key files

    Dear team ,
    please tell me the "contenttype" of the .pages file format....
    example: .doc....is having the content type as "application/ms-word"
    similarly can u tell me content type of .pages
    Regards,
    spradeepkumar

    hi balusC thanks, it works very well.
    your site http://balusc.xs4all.nl/srv/dev-jep-pdf.html helped me a lot.
    But one point. There is another method : URLConnection.guessContentTypeFromStream(InputStream)but it don't work and i receive as result a null.
    Is there another classes/methods which helps getting the content type of a file? not necessarily from sun. thanks
    bye

Maybe you are looking for

  • Smartforms output could not be issued

    hi all, i have executed my smartforms. and activated and checked the syntax it doesnt show any error. but while i excute the form through the transaction code it throws me an error. stating output culd not be issued. thanxs in advance

  • 24"imac running dual 20"

    Hi, has anybody got 24"intel imac running dual screen 20"cinema .How do you find it for colour etc. Also very interestd to know about using aperture with this setup,what are your experiences thanks

  • Get "Waiting for 127.0.0.1..." with some sites. No problem with Opera.

    Firefox 3.6.13. Tried loading www.cortondenham.com and get "Waiting for 127.0.0.1..." and hangs. Same with "talkingvillages.com". Both load OK with Opera. Tried commenting out "127.0.0.1 localhost" from Hosts file, same issue. Tried safe mode, same i

  • AAck!!!!!!!!!! I don't know what to do.........

    I am losing a corporate discount on my family plan soon. That will shoot my monthly bill from $250---> $300. I  carry both my sons as they are both in college and have little money.....HOWEVER,  I am simply unwilling to pay $3600+/year for phone (and

  • Apply Gradient across stroke not working now?

    Updated Illustrator to CC and now my apply gradient to stroke is acting funny (also does it with apply along stroke). First i can't get it to show up unless I find a number it likes (start out with 1 pt, don't see a stoke so increase size 1 pt at a t