URL Manipulation when content-type is application/json (with UAG 2010)

Hey,
I got a website published through HTTPS trunk (UAG2010) which works with "application/json" content type at some parts (AJAX objects).
The parts which use applicaton/json content-type are loaded with a bad URL's on the client side (the internal URLs)
How can i configure that UAG will manipulate this content-type? (so the HAT mechanism will manipulate these get requests and responses)
Thank you, Idan.

Hi Idan,
We had a similar issue with internal links not being translated for a particular UAG published website. You'll need to run fiddler or httpwatch from a UAG client to identify the failing URL link extension types, eg .jsp and .RF
Open the trunk configuration, and select the portal tab, click
edit under Search and Replace Response Content.
Under Servers, put the fqdn of the web server / publishing address, and under URLs, add the identified extensions.
We also had to have a custom WhlFiltSecureRemote_HTTPS.xml file created under
Von\Conf\Websites\%trunk_name%\conf\CustomUpdate
which included the defined application type for the published website, and tells UAG when to use the search and replace parser.
Hope that helps.
http://chrisocallaghan.blogspot.com/

Similar Messages

  • The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

  • 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]

  • I have my settings to not fill in the URL bar when I type. Yet, when I type something, it's giving me a drop down of sites that match as I type. Why? And how do I get it to stop? It's really annoying.

    Example: If I'm typing in www.mozilla.com, when I get to www.mo, it drops down a list of all the sites I've previously gone to that start with that.

    Quote: ''I have my settings to not fill in the URL bar when I type''<br />
    Do you have an extension to make that setting or did you change the pref [http://kb.mozillazine.org/browser.urlbar.maxRichResults browser.urlbar.maxRichResults] on the about:config page to 0 or -1?
    In the Firefox 3.0.x versions you are limited about what to do with the location bar.
    * Old Location Bar: https://addons.mozilla.org/firefox/addon/7637
    If you update to Firefox 3.5.x or 3.6.x then you have more options for the location bar behavior.<br />
    See [[Smart Location Bar]]

  • How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    For my part you are welcome, sdowers.
    Unfortunately, the uncertainty arising from the rounding has been up several times here in this forum.
    I just came to remember a warning that needs to be given:
    The rounding of the representation of a numerical value may be harmless in itself, but if you use it for any operation that changes the value, such as multiplication or whatever, things will go wrong because the operation will be made on the basis of the rounded value instead of the true value. So, as in your first case in post #2, 39.625 rounded to 39.63 will become 79.26 instead of 79.25.

  • I must re-install HDD, when tried to install application DVD with iPhoto,there was a error message, could not instal it again, I have LION 10.7.3. How can install application DVD again?

    I must re-install HDD, but when tried to install application DVD with iPhoto,there was a error message, could not instal it again,
    I have LION 10.7.3.
    How can install application DVD again?
    thanks
    Dimitar

    I've asked the hosts to move this post to Lion.
    Here is a better place for you Lion posts.
    https://discussions.apple.com/community/mac_os/mac_os_x_v10.7_lion?view=discussi ons
    What is HDD?
    How to install most applications from DVD.
    Place dvd in dvd drive.
    Double click on dvd image if a folder didn't appear.
    Double click on application icon in drive folder.
    follow instructions.
    Robert

  • When trying to set up syn with outlook 2010 - it does not show as an option

    When trying to set up syn with outlook 2010 - outlook it does not show as an option

    Hi smrkevin,
    Welcome to the BlackBerry Support Community.
    What version of BlackBerry Desktop Software do you have installed? If you do not have the latest version listed here: http://bbry.lv/ds97JW I would advise upgrading it.
    If you already have the latest version of Desktop Software, can you verify if you are running a Click to Run installation of Outlook? You can check this in Outlook -> Help -> About Microsoft Outlook. If you are using a Click to Run installation, you will need to install a full version of Microsoft Outlook to setup synchronization. For more information, see: http://bbry.lv/qDIoXO
    Hope this helps.
    -FS
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • How to set Content-Disposition to "application/json;"

    Using System.Net.Http.Httpclient, I am trying to do a multipart post in C# and with a wp8.
    This is a snippet of my code:
    varclient =
    newHttpClient();
                    client.DefaultRequestHeaders.TryAddWithoutValidation(
    "Content-Type",
    "application/json");
    MultipartFormDataContent
    content = newMultipartFormDataContent();
    content.Add(
    newStringContent(requestObj,
    Encoding.UTF8,
    "application/json"),
    "request");
    but using Fiddler, I noticed that I am sending this:
    Content-Type: application/json; charset=utf-8
    Content-Dis name=request
    while I need to send this (taken from an android device where the call is working):
    Content-Dis name="request"
    Content-Type: text/plain; charset=UTF-8
     - How to achieve the expected result?

    Your code explicitly sets the incorrect content type.  Why are you setting it to "application/json", when you say it requires "text/plain; charset=UTF-8"?
    Bret Bentzinger (MSFT) @awehellyeah

  • Returning content type of application/RFC822

    I have a servlet which needs to return a data stream that the browser
              shoule save as a file on the users local hard drive.
              My servlet seems to work just fine with Netscape 4.7 but IE always saves
              the original HTML Form page that called the Servlet.
              Is there a bug in WL/IE or am I doing something stupid
              here's my code - the method doing returning the data is the last one in
              this code - getResponseFromDispatch()
              Thanks
              Tom
              package com.nexterna.optiform.server.b2b;
              import javax.servlet.*;
              import javax.servlet.http.*;
              import java.io.*;
              import java.util.*;
              import javax.naming.*;
              import org.apache.log4j.Category;
              import org.apache.log4j.PropertyConfigurator;
              import org.w3c.tools.codec.Base64Encoder;
              import com.nexterna.optiform.server.ejb.dispatcher.*;
              import com.nexterna.optiform.common.*;
              import com.nexterna.ejb.usermanager.*;
              import com.nexterna.common.security.*;
              * Title: B2BInterfaces
              * Description:
              * Copyright: Copyright (c) 2001
              * Company:
              * @author
              * @version 1.0
              public class ExportResponseAsXML extends HttpServlet {
              private static final String CONTENT_TYPE = "text/html";
              /**Initialize global variables*/
              private Context jndiContext = null;
              private String poolName = "";
              private String providerURL = "";
              private String icf = "";
              private String command = null;
              private DispatcherServices dispatcher = null;
              private UserManager usermgr = null;
              private String ccode = "b2b.9284s3a41";
              private static Category cat =
              Category.getInstance(ExportResponseAsXML.class.getName());
              public void init(ServletConfig config) throws ServletException {
              super.init(config);
              try {
              InitialContext ic = new InitialContext();
              Context environment = (Context) ic.lookup("java:comp/env");
              PropertyConfigurator.configure(
              config.getInitParameter("LOG4J"));
              poolName =
              config.getInitParameter("POOLNAME");
              providerURL = config.getInitParameter("PROVIDER_URL");
              icf = config.getInitParameter("INITIAL_CONTEXT_FACTORY");
              catch (NamingException e) {
              cat.error("Exception in EJBCreate trying to lookup
              initializations");
              cat.error("Servlet Failed Initialization " + poolName + ":"
              + providerURL + ":" + icf);
              cat.error(e);
              getDispatchServices();
              getUserManager();
              if (cat.isDebugEnabled()) {
              cat.debug("Servlet Initialized " + poolName + ":" +
              providerURL + ":" + icf);
              /**Process the HTTP Get request*/
              public void doGet(HttpServletRequest request, HttpServletResponse
              response) throws ServletException, IOException {
              response.setContentType(CONTENT_TYPE);
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<head><title>ExportResponseAsXML</title></head>");
              out.println("<body>");
              out.println("<p>The servlet has received a GET. This is the
              reply.</p>");
              out.println("</body></html>");
              /**Process the HTTP Post request*/
              public void doPost(HttpServletRequest request, HttpServletResponse
              response)
              throws ServletException, IOException {
              // first we need to get the user-id/password and create a user profile
              Base64Encoder b = new Base64Encoder(request.getParameter("passwd"));
              String pass = b.processString();
              if (usermgr == null)
              log("User manager is null!");
              UserProfile up = usermgr.getUserProfile(
              request.getParameter("userid").toUpperCase(), pass);
              if ((up == null) ||
              (!ccode.startsWith(request.getParameter("controlcode")))) {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<head><title>ExportResponse</title></head>");
              out.println("<body>");
              out.println("<p>Incorrect parameters");
              out.println("</body></html>");
              cat.error("incorrect parameters: " + up + " : " +
              request.getParameter("controlcode"));
              else {
              // there are 3 ways to export responses
              // 1. via the dispath id
              // 2. via the response id
              // 3. vis the form name and last retrieved date
              // the third one allows you to get all new responses for a form
              type
              // and for a time period.
              String rid = request.getParameter("rid");
              String did = request.getParameter("did");
              String formname = request.getParameter("formname");
              String date = request.getParameter("datefrom");
              boolean failed = false;
              if (cat.isDebugEnabled()) {
              cat.debug("rid " + rid);
              cat.debug("did " + did);
              cat.debug("formname " + formname);
              cat.debug("datefrom " + date);
              if (did != null)
              failed = getResponseFromDispatch(response, did);
              else if (rid != null)
              //failed = getResponse(response, rid);
              System.out.println("temp");
              else if (formname != null && date != null)
              //failed = getAllResponses(response, formname, date);
              System.out.println("temp");
              else {
              response.setContentType(CONTENT_TYPE);
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<head><title>ExportResponseAsXML</title></head>");
              out.println("<body>");
              out.println("<p>No Responses available.</p>");
              out.println("</body></html>");
              if (failed) {
              response.setContentType(CONTENT_TYPE);
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<head><title>ExportResponseAsXML</title></head>");
              out.println("<body>");
              out.println("<p>No Responses available due to error.</p>");
              out.println("</body></html>");
              /**Clean up resources*/
              public void destroy() {
              protected static Context getInitialContext(String purl, String picf)
              throws javax.naming.NamingException{
              cat.debug("URL: " + purl);
              cat.debug("Initial_context_factory: " + picf);
              Properties p = new Properties();
              // ... Specify the JNDI properties specific to the vendor.
              p.put(Context.INITIAL_CONTEXT_FACTORY, picf);
              p.put(Context.PROVIDER_URL, purl);
              return new javax.naming.InitialContext(p);
              protected void getDispatchServices() {
              DispatcherServicesHome home = null;
              try {
              //if (jndiContext == null)
              cat.debug("trying to get jndi - dispatcher");
              jndiContext = getInitialContext(providerURL, icf);
              cat.debug("doing lookup - dispatcher");
              Object obj = jndiContext.lookup("nexterna.DispatcherServices");
              cat.debug("getting home ref - dispatcher");
              home = (DispatcherServicesHome)
              javax.rmi.PortableRemoteObject.narrow(
              obj, DispatcherServicesHome.class);
              catch (javax.naming.NamingException ne)
              cat.error(ne);
              catch (Exception e)
              cat.error(e);
              try {
              cat.debug("home.create - dispatcher");
              dispatcher = home.create();
              catch (javax.ejb.CreateException ce)
              cat.error(ce);
              catch (java.rmi.RemoteException re)
              cat.error(re);
              catch (Exception e)
              cat.error(e);
              protected void getUserManager() {
              UserManagerHome home = null;
              try {
              if (jndiContext == null)
              cat.debug("trying to get jndi - usermanager");
              jndiContext = getInitialContext(providerURL, icf);
              cat.debug("doing lookup - usermanager");
              Object obj = jndiContext.lookup("nexterna.UserManager");
              cat.debug("getting home ref - usermanager");
              home = (UserManagerHome) javax.rmi.PortableRemoteObject.narrow(
              obj, UserManagerHome.class);
              catch (javax.naming.NamingException ne)
              cat.error(ne);
              catch (Exception e)
              cat.error(e);
              try {
              cat.debug("home.create - usermanager");
              usermgr = home.create();
              catch (javax.ejb.CreateException ce)
              cat.error(ce);
              catch (java.rmi.RemoteException re)
              cat.error(re);
              catch (Exception e)
              cat.error(e);
              protected boolean getResponseFromDispatch(HttpServletResponse resp,
              String id) {
              String s = null;
              try {
              //before we will export responses to a dispatch, the dispatch
              must be complete
              s = dispatcher.getDispatchStatusString(id);
              catch (java.rmi.RemoteException e)
              cat.error(e);
              return true;
              if (s.compareToIgnoreCase("Completed") != 0) {
              cat.debug("Dispatch status is not COMPLETED. Cannot export
              responses");
              return true;
              resp.setContentType("application/RFC822");
              resp.setHeader("Content-Type", "application/RFC822"); // set both
              ways to be safe
              resp.setHeader("Content-disposition",
              "attachment; filename=\"" + id + ".txt\"");
              cat.debug("Setting headers");
              cat.debug("Content-disposition",
              "attachment; filename=\"" + id + ".txt\"");
              HashMap responses = null;
              try {
              responses = dispatcher.getResponses(id,
              DispatcherServices.DISPATCH_ID);
              catch (java.rmi.RemoteException e)
              cat.error(e);
              return true;
              try {
              ServletOutputStream os = resp.getOutputStream();
              Iterator i = responses.values().iterator();
              while (i.hasNext()) {
              Object o = i.next();
              os.print(o.toString());
              cat.debug("Writing XML");
              cat.debug(o.toString());
              os.flush();
              os.close();
              catch (Exception e)
              cat.error(e);
              return true;
              return false;
              

              There is also a bug in IE5.5 SP0 and 1 where saving a document using the file download
              dialogue can indeed result in the HTML of the active frame being saved instead
              of the document.
              You can get IE 5.5 SP2 fix here:
              http://www.microsoft.com/windows/ie/download/ie55sp2.htm
              "Cameron Purdy" <[email protected]> wrote:
              >Hi Tom,
              >
              >I looked over the code. I think the problem is caused by the fact that
              >you
              >are doing a POST instead of a GET. IE doesn't GET anything back (OK,
              >I'm
              >totally technically wrong, but read the early HTTP specs and you'll see
              >the
              >"intent" of what I'm saying) so it just saves the current document. That's
              >my guess. Change to GET and it should work, since IE will know to save
              >the
              >incoming document.
              >
              >FWIW - You will often get more performance using a buffer of some sort
              >between your looping/writing and the response's stream.
              >
              >Peace,
              >
              >--
              >Cameron Purdy
              >Tangosol Inc.
              ><< Tangosol Server: How Weblogic applications are customized >>
              ><< Download now from http://www.tangosol.com/download.jsp >>
              >
              >
              >"Tom Gerber" <[email protected]> wrote in message
              >news:[email protected]...
              >> I have a servlet which needs to return a data stream that the browser
              >> shoule save as a file on the users local hard drive.
              >>
              >> My servlet seems to work just fine with Netscape 4.7 but IE always
              >saves
              >> the original HTML Form page that called the Servlet.
              >>
              >> Is there a bug in WL/IE or am I doing something stupid
              >>
              >> here's my code - the method doing returning the data is the last one
              >in
              >> this code - getResponseFromDispatch()
              >>
              >> Thanks
              >>
              >> Tom
              >>
              >> package com.nexterna.optiform.server.b2b;
              >>
              >> import javax.servlet.*;
              >> import javax.servlet.http.*;
              >> import java.io.*;
              >> import java.util.*;
              >> import javax.naming.*;
              >>
              >> import org.apache.log4j.Category;
              >> import org.apache.log4j.PropertyConfigurator;
              >> import org.w3c.tools.codec.Base64Encoder;
              >>
              >> import com.nexterna.optiform.server.ejb.dispatcher.*;
              >> import com.nexterna.optiform.common.*;
              >> import com.nexterna.ejb.usermanager.*;
              >> import com.nexterna.common.security.*;
              >> /**
              >> * Title: B2BInterfaces
              >> * Description:
              >> * Copyright: Copyright (c) 2001
              >> * Company:
              >> * @author
              >> * @version 1.0
              >> */
              >>
              >> public class ExportResponseAsXML extends HttpServlet {
              >> private static final String CONTENT_TYPE = "text/html";
              >> /**Initialize global variables*/
              >> private Context jndiContext = null;
              >> private String poolName = "";
              >> private String providerURL = "";
              >> private String icf = "";
              >> private String command = null;
              >> private DispatcherServices dispatcher = null;
              >> private UserManager usermgr = null;
              >> private String ccode = "b2b.9284s3a41";
              >>
              >> private static Category cat =
              >> Category.getInstance(ExportResponseAsXML.class.getName());
              >>
              >> public void init(ServletConfig config) throws ServletException {
              >> super.init(config);
              >>
              >> try {
              >> InitialContext ic = new InitialContext();
              >> Context environment = (Context) ic.lookup("java:comp/env");
              >>
              >> PropertyConfigurator.configure(
              >> config.getInitParameter("LOG4J"));
              >> poolName =
              >> config.getInitParameter("POOLNAME");
              >> providerURL = config.getInitParameter("PROVIDER_URL");
              >> icf = config.getInitParameter("INITIAL_CONTEXT_FACTORY");
              >> }
              >> catch (NamingException e) {
              >> cat.error("Exception in EJBCreate trying to lookup
              >> initializations");
              >> cat.error("Servlet Failed Initialization " + poolName +
              >":"
              >> + providerURL + ":" + icf);
              >> cat.error(e);
              >> }
              >>
              >> getDispatchServices();
              >> getUserManager();
              >>
              >> if (cat.isDebugEnabled()) {
              >> cat.debug("Servlet Initialized " + poolName + ":" +
              >> providerURL + ":" + icf);
              >> }
              >>
              >> }
              >> /**Process the HTTP Get request*/
              >> public void doGet(HttpServletRequest request, HttpServletResponse
              >> response) throws ServletException, IOException {
              >> response.setContentType(CONTENT_TYPE);
              >> PrintWriter out = response.getWriter();
              >> out.println("<html>");
              >> out.println("<head><title>ExportResponseAsXML</title></head>");
              >> out.println("<body>");
              >> out.println("<p>The servlet has received a GET. This is the
              >> reply.</p>");
              >> out.println("</body></html>");
              >> }
              >> /**Process the HTTP Post request*/
              >> public void doPost(HttpServletRequest request, HttpServletResponse
              >> response)
              >> throws ServletException, IOException {
              >>
              >> // first we need to get the user-id/password and create a user
              >profile
              >> Base64Encoder b = new
              >Base64Encoder(request.getParameter("passwd"));
              >> String pass = b.processString();
              >>
              >> if (usermgr == null)
              >> log("User manager is null!");
              >>
              >> UserProfile up = usermgr.getUserProfile(
              >> request.getParameter("userid").toUpperCase(), pass);
              >>
              >> if ((up == null) ||
              >> (!ccode.startsWith(request.getParameter("controlcode"))))
              >{
              >> response.setContentType("text/html");
              >> PrintWriter out = response.getWriter();
              >> out.println("<html>");
              >> out.println("<head><title>ExportResponse</title></head>");
              >> out.println("<body>");
              >> out.println("<p>Incorrect parameters");
              >> out.println("</body></html>");
              >> cat.error("incorrect parameters: " + up + " : " +
              >> request.getParameter("controlcode"));
              >> }
              >> else {
              >>
              >> // there are 3 ways to export responses
              >> // 1. via the dispath id
              >> // 2. via the response id
              >> // 3. vis the form name and last retrieved date
              >> // the third one allows you to get all new responses for a
              >form
              >> type
              >> // and for a time period.
              >> String rid = request.getParameter("rid");
              >> String did = request.getParameter("did");
              >> String formname = request.getParameter("formname");
              >> String date = request.getParameter("datefrom");
              >> boolean failed = false;
              >> if (cat.isDebugEnabled()) {
              >> cat.debug("rid " + rid);
              >> cat.debug("did " + did);
              >> cat.debug("formname " + formname);
              >> cat.debug("datefrom " + date);
              >> }
              >> if (did != null)
              >> failed = getResponseFromDispatch(response, did);
              >>
              >> else if (rid != null)
              >> //failed = getResponse(response, rid);
              >> System.out.println("temp");
              >>
              >> else if (formname != null && date != null)
              >> //failed = getAllResponses(response, formname, date);
              >> System.out.println("temp");
              >>
              >> else {
              >> response.setContentType(CONTENT_TYPE);
              >> PrintWriter out = response.getWriter();
              >> out.println("<html>");
              >> out.println("<head><title>ExportResponseAsXML</title></head>");
              >> out.println("<body>");
              >> out.println("<p>No Responses available.</p>");
              >> out.println("</body></html>");
              >> }
              >>
              >> if (failed) {
              >> response.setContentType(CONTENT_TYPE);
              >> PrintWriter out = response.getWriter();
              >> out.println("<html>");
              >> out.println("<head><title>ExportResponseAsXML</title></head>");
              >> out.println("<body>");
              >> out.println("<p>No Responses available due to error.</p>");
              >> out.println("</body></html>");
              >> }
              >>
              >> }
              >> }
              >> /**Clean up resources*/
              >> public void destroy() {
              >> }
              >>
              >> protected static Context getInitialContext(String purl, String picf)
              >> throws javax.naming.NamingException{
              >>
              >> cat.debug("URL: " + purl);
              >> cat.debug("Initial_context_factory: " + picf);
              >> Properties p = new Properties();
              >> // ... Specify the JNDI properties specific to the vendor.
              >> p.put(Context.INITIAL_CONTEXT_FACTORY, picf);
              >> p.put(Context.PROVIDER_URL, purl);
              >> return new javax.naming.InitialContext(p);
              >> }
              >>
              >>
              >> protected void getDispatchServices() {
              >> DispatcherServicesHome home = null;
              >> try {
              >>
              >> //if (jndiContext == null)
              >> //{
              >> cat.debug("trying to get jndi - dispatcher");
              >> jndiContext = getInitialContext(providerURL, icf);
              >> //}
              >>
              >> cat.debug("doing lookup - dispatcher");
              >> Object obj = jndiContext.lookup("nexterna.DispatcherServices");
              >> cat.debug("getting home ref - dispatcher");
              >> home = (DispatcherServicesHome)
              >> javax.rmi.PortableRemoteObject.narrow(
              >> obj, DispatcherServicesHome.class);
              >> }
              >> catch (javax.naming.NamingException ne)
              >> {
              >> cat.error(ne);
              >> }
              >>
              >> catch (Exception e)
              >> {
              >> cat.error(e);
              >> };
              >>
              >> try {
              >> cat.debug("home.create - dispatcher");
              >> dispatcher = home.create();
              >> }
              >> catch (javax.ejb.CreateException ce)
              >> {
              >> cat.error(ce);
              >> }
              >> catch (java.rmi.RemoteException re)
              >> {
              >> cat.error(re);
              >> }
              >> catch (Exception e)
              >> {
              >> cat.error(e);
              >> };
              >> }
              >>
              >> protected void getUserManager() {
              >> UserManagerHome home = null;
              >> try {
              >>
              >> if (jndiContext == null)
              >> {
              >> cat.debug("trying to get jndi - usermanager");
              >> jndiContext = getInitialContext(providerURL, icf);
              >> }
              >>
              >> cat.debug("doing lookup - usermanager");
              >> Object obj = jndiContext.lookup("nexterna.UserManager");
              >> cat.debug("getting home ref - usermanager");
              >> home = (UserManagerHome) javax.rmi.PortableRemoteObject.narrow(
              >> obj, UserManagerHome.class);
              >> }
              >> catch (javax.naming.NamingException ne)
              >> {
              >> cat.error(ne);
              >> }
              >>
              >> catch (Exception e)
              >> {
              >> cat.error(e);
              >> };
              >>
              >> try {
              >> cat.debug("home.create - usermanager");
              >> usermgr = home.create();
              >> }
              >> catch (javax.ejb.CreateException ce)
              >> {
              >> cat.error(ce);
              >> }
              >> catch (java.rmi.RemoteException re)
              >> {
              >> cat.error(re);
              >> }
              >> catch (Exception e)
              >> {
              >> cat.error(e);
              >> };
              >> }
              >>
              >> protected boolean getResponseFromDispatch(HttpServletResponse resp,
              >> String id) {
              >>
              >> String s = null;
              >> try {
              >> //before we will export responses to a dispatch, the dispatch
              >> must be complete
              >> s = dispatcher.getDispatchStatusString(id);
              >> }
              >> catch (java.rmi.RemoteException e)
              >> {
              >> cat.error(e);
              >> return true;
              >> }
              >>
              >> if (s.compareToIgnoreCase("Completed") != 0) {
              >> cat.debug("Dispatch status is not COMPLETED. Cannot export
              >> responses");
              >> return true;
              >> }
              >>
              >> resp.setContentType("application/RFC822");
              >> resp.setHeader("Content-Type", "application/RFC822"); // set
              >both
              >> ways to be safe
              >> resp.setHeader("Content-disposition",
              >> "attachment; filename=\"" + id + ".txt\"");
              >> cat.debug("Setting headers");
              >> cat.debug("Content-disposition",
              >> "attachment; filename=\"" + id + ".txt\"");
              >>
              >> HashMap responses = null;
              >> try {
              >> responses = dispatcher.getResponses(id,
              >> DispatcherServices.DISPATCH_ID);
              >> }
              >> catch (java.rmi.RemoteException e)
              >> {
              >> cat.error(e);
              >> return true;
              >> }
              >>
              >> try {
              >> ServletOutputStream os = resp.getOutputStream();
              >> Iterator i = responses.values().iterator();
              >> while (i.hasNext()) {
              >> Object o = i.next();
              >> os.print(o.toString());
              >> cat.debug("Writing XML");
              >> cat.debug(o.toString());
              >> }
              >> os.flush();
              >> os.close();
              >> }
              >> catch (Exception e)
              >> {
              >> cat.error(e);
              >> return true;
              >> }
              >>
              >> return false;
              >> }
              >>
              >
              >
              

  • How to make New Document and Upload Document to have same Content Type in Document Library in Sharepoint 2010

    Hi,
    How to make 'New Document' and 'Upload Document' to have same content type(Custom) in Document Library in Sharepoint2010.
    Note : I have created custom Content Type since I have custom columns along with upload column..
    Regards, Shreyas R S

    go to library settings 
    Change new button order and default content type
    set your custom content type to be #1
    when you upload new document it will automatically have your custom content type
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • Can't create a Content Type List Item on Visual Studio 2010

    Can't create a Content
    Type List Item on Visual Studio 2010

    Hi,
    According to your description, my understanding is that you want to select the specific content type in new item form.
    This is a default behavior. The "Add new item" link uses the default content type and does not display a dropdown list to change that value. This behavior is hard coded into the control and can't be changed.
    Here are some similar threads for your reference:
    https://social.technet.microsoft.com/Forums/en-US/de60f2a1-df91-4a67-a606-02a593c977b4/choose-a-content-type-when-creating-a-new-list-item?forum=sharepointcustomizationlegacy
    http://sharepoint.stackexchange.com/questions/13281/content-type-field-missing-from-new-form
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • SP 2013 Workflow Associations - get the content type for associated tasks with PowerShell

    I am creating a PowerShell script to document SharePoint 2013 workflow associations on a site. I can get the Subscription object for the workflow association, but I can't figure out how to dig into it to find out the Content Type for tasks generated
    by workflows created by this WF association. I can get the Task List ID from the Subscription.PropertyDefinitions, and from there can get the Task List. But the task list may use many different content types, because when you associate a 2013 workflow
    to a list, SharePoint adds the workflow's content type to the set of content types used by the workflow task list. If you have a lot of workflows that use the same task list, that task list gets a lot of content types.
    I have the Subscription object for the workflow association. How can I divine the content type for tasks that the workflow will generate?
    Leigh Webber

    I would suggest you to consider using the SPListItem that running the workflow instance to check the task content type.
    First, find the list item that associated with the workflow, then SPListItem.Tasks returns a collection of workflow tasks for the item, you can check the content type from the task item.
    Qiao Wei
    TechNet Community Support

  • BCS External Content Type using Stored Procedure with parameter

    I have a requirement wherein I will be using External Content Type (BCS) using a Stored Procedure.
    The stored procedure has parameters.
    I have set up Read List and Read Item
    However, when I visited my list, I cannot enter any parameter.
    Can you show me a guide on how to configure this with parameters?
    Thanks!
    ----------------------- Sharepoint Newbie

    Hi,
    Here are the references for creating an External Content Type to support Read List and Read Item operations:
    http://troyscott.ca/2010/07/02/creating-an-external-content-type-in-sharepoint-2010/
    https://msdn.microsoft.com/en-us/library/office/ff728816(v=office.14).aspx
    Regards,
    Rebecca Tu
    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]

  • Is it possible to use Firefox to debug javascript files when running a web application using visual studio 2010

    I am trying to debug a ASP.Net web application within visual studio 2010 using Firefox. I am able to set breakpoints in my C# code and they work but if I set a breakpoint in a javascript file then these do not work when using Firefox. Is there any way to do this?

    Of course you can. I use the VS2010 built-in Javascript debug tool a lot, not only for IE, but also for firefox.
    I encountered the "break point not working" issue several times, according to my experience, following is the solution to this problem, give them a shot:
    1. There maybe errors in your javascript code, have a close look at your code, try to find the errors or eliminate this possibility.
    2. Sometimes you have to refresh the page once after the page is loaded the first time. This solves the problem most of the time.

  • Framemaker12 is shutdown when I type the Korean language with keyboard.

    Please let me know the solution of  the error of FrameMaker12 
    what can I do ?
    < personal info removed by admin to reduce SPAM >

    That is default behavior for OS X 10.7 and up, but it should only happen when you hold a key down for a while.  If it happens with a quick tap, the key may be damaged.
    To turn off, see
    http://m10lmac.blogspot.com/2011/07/os-x-107-lion-getting-rid-of-character.html

Maybe you are looking for

  • How can I get Firefox to default to Unicode rather that Western ?

    This is the same question as the unanswered, archived thread https://support.mozilla.org/en-US/questions/989012?fpa=1 Firefox 33.0 displays mojibake+English instead of Japanese+English. It shouldn't matter whether the web page is encoded in ShiftJIS,

  • New to Mac and considering a macbook?

    Hey Ya'll, I am posting a question because I am in need of help. I am new to Mac except for the iPods, and I am just scared to take the plunge. I am have been talking to people online about whether to go with a macbook or another PC, and have receive

  • Show/hide elements

    Hi In DW8 I often used the possibility to put several layers on top of eachother with images in them, this way I could show/hide layers so the images would be visible when having a mouse-over action on a thumbnail for example. Now DW-CS3 gives the op

  • Creative Mixer Doesnt work after auto-upda

    So I recently Updated my SB Audigy 2 drivers (from the CD) to the ones supplied by creative auto update. It updated the ones that mentioned Audigy 2 | 4 drivers or something like that. Ever since I updated to that, my Mixer will no work anymore. Ever

  • Can I go back to to my older version of Firefox... this isn't working for me right now

    Love Firefox but the beta version is hanging on my and it will not let me use Fire FTP which I use all the time. Can I go back to my older version? If so how do I do it? Thanks Shane